diff options
Diffstat (limited to 'gl/m4')
192 files changed, 8933 insertions, 1984 deletions
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index 7fe03e0b..2b205b35 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # 00gnulib.m4 serial 8 | 1 | # 00gnulib.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl This file must be named something that sorts before all other | 9 | dnl This file must be named something that sorts before all other |
| 8 | dnl gnulib-provided .m4 files. It is needed until the clang fix has | 10 | dnl gnulib-provided .m4 files. It is needed until the clang fix has |
| @@ -49,14 +51,14 @@ dnl AC_REQUIRE([gl_COMPILER_CLANG]) | |||
| 49 | [if test $gl_cv_compiler_clang = yes; then | 51 | [if test $gl_cv_compiler_clang = yes; then |
| 50 | dnl Test whether the compiler supports the option | 52 | dnl Test whether the compiler supports the option |
| 51 | dnl '-Werror=implicit-function-declaration'. | 53 | dnl '-Werror=implicit-function-declaration'. |
| 52 | save_ac_compile="$ac_compile" | 54 | saved_ac_compile="$ac_compile" |
| 53 | ac_compile="$ac_compile -Werror=implicit-function-declaration" | 55 | ac_compile="$ac_compile -Werror=implicit-function-declaration" |
| 54 | dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a | 56 | dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a |
| 55 | dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". | 57 | dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". |
| 56 | _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], | 58 | _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], |
| 57 | [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], | 59 | [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], |
| 58 | [gl_cv_compiler_check_decl_option=none]) | 60 | [gl_cv_compiler_check_decl_option=none]) |
| 59 | ac_compile="$save_ac_compile" | 61 | ac_compile="$saved_ac_compile" |
| 60 | else | 62 | else |
| 61 | gl_cv_compiler_check_decl_option=none | 63 | gl_cv_compiler_check_decl_option=none |
| 62 | fi | 64 | fi |
| @@ -71,11 +73,11 @@ dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl | |||
| 71 | dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC | 73 | dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC |
| 72 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. | 74 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. |
| 73 | m4_define([_AC_CHECK_DECL_BODY], | 75 | m4_define([_AC_CHECK_DECL_BODY], |
| 74 | [ ac_save_ac_compile="$ac_compile" | 76 | [ ac_saved_ac_compile="$ac_compile" |
| 75 | if test -n "$ac_compile_for_check_decl"; then | 77 | if test -n "$ac_compile_for_check_decl"; then |
| 76 | ac_compile="$ac_compile_for_check_decl" | 78 | ac_compile="$ac_compile_for_check_decl" |
| 77 | fi] | 79 | fi] |
| 78 | m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" | 80 | m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_saved_ac_compile" |
| 79 | ]) | 81 | ]) |
| 80 | 82 | ||
| 81 | # gl_00GNULIB | 83 | # gl_00GNULIB |
diff --git a/gl/m4/__inline.m4 b/gl/m4/__inline.m4 index acf8668b..d1b8257b 100644 --- a/gl/m4/__inline.m4 +++ b/gl/m4/__inline.m4 | |||
| @@ -1,8 +1,12 @@ | |||
| 1 | # Test for __inline keyword | 1 | # __inline.m4 |
| 2 | dnl Copyright 2017-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright 2017-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 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 | # Test for __inline keyword | ||
| 6 | 10 | ||
| 7 | AC_DEFUN([gl___INLINE], | 11 | AC_DEFUN([gl___INLINE], |
| 8 | [ | 12 | [ |
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4 index e7947648..5501b07b 100644 --- a/gl/m4/absolute-header.m4 +++ b/gl/m4/absolute-header.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # absolute-header.m4 serial 17 | 1 | # absolute-header.m4 |
| 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
| 3 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Derek Price. | 9 | dnl From Derek Price. |
| 8 | 10 | ||
| @@ -66,7 +68,7 @@ AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], | |||
| 66 | esac | 68 | esac |
| 67 | changequote(,) | 69 | changequote(,) |
| 68 | case "$host_os" in | 70 | case "$host_os" in |
| 69 | mingw*) | 71 | mingw* | windows*) |
| 70 | dnl For the sake of native Windows compilers (excluding gcc), | 72 | dnl For the sake of native Windows compilers (excluding gcc), |
| 71 | dnl treat backslash as a directory separator, like /. | 73 | dnl treat backslash as a directory separator, like /. |
| 72 | dnl Actually, these compilers use a double-backslash as | 74 | dnl Actually, these compilers use a double-backslash as |
diff --git a/gl/m4/af_alg.m4 b/gl/m4/af_alg.m4 index f4c0d624..38575b6d 100644 --- a/gl/m4/af_alg.m4 +++ b/gl/m4/af_alg.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # af_alg.m4 serial 6 | 1 | # af_alg.m4 |
| 2 | dnl Copyright 2018-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
| 3 | dnl Copyright 2018-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Matteo Croce. | 9 | dnl From Matteo Croce. |
| 8 | 10 | ||
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index c685fac9..68fc6211 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # alloca.m4 serial 21 | 1 | # alloca.m4 |
| 2 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 21 |
| 3 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | AC_DEFUN([gl_FUNC_ALLOCA], | 10 | AC_DEFUN([gl_FUNC_ALLOCA], |
| 9 | [ | 11 | [ |
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 index fa5fe831..5dae6f72 100644 --- a/gl/m4/arpa_inet_h.m4 +++ b/gl/m4/arpa_inet_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # arpa_inet_h.m4 serial 17 | 1 | # arpa_inet_h.m4 |
| 2 | dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
| 3 | dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Written by Simon Josefsson and Bruno Haible | 9 | dnl Written by Simon Josefsson and Bruno Haible |
| 8 | 10 | ||
| @@ -67,8 +69,12 @@ AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS], | |||
| 67 | AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], | 69 | AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], |
| 68 | [ | 70 | [ |
| 69 | dnl Assume proper GNU behavior unless another module says otherwise. | 71 | dnl Assume proper GNU behavior unless another module says otherwise. |
| 72 | HAVE_DECL_HTONL=1; AC_SUBST([HAVE_DECL_HTONL]) | ||
| 73 | HAVE_DECL_HTONS=1; AC_SUBST([HAVE_DECL_HTONS]) | ||
| 70 | HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) | 74 | HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) |
| 71 | HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) | 75 | HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) |
| 76 | HAVE_DECL_NTOHL=1; AC_SUBST([HAVE_DECL_NTOHL]) | ||
| 77 | HAVE_DECL_NTOHS=1; AC_SUBST([HAVE_DECL_NTOHS]) | ||
| 72 | REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) | 78 | REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) |
| 73 | REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) | 79 | REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) |
| 74 | ]) | 80 | ]) |
diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4 index abba4fa3..e77524ca 100644 --- a/gl/m4/assert_h.m4 +++ b/gl/m4/assert_h.m4 | |||
| @@ -1,40 +1,43 @@ | |||
| 1 | # assert-h.m4 | 1 | # assert_h.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Paul Eggert. | 9 | dnl From Paul Eggert. |
| 8 | 10 | ||
| 9 | AC_DEFUN([gl_ASSERT_H], | 11 | AC_DEFUN([gl_ASSERT_H], |
| 10 | [ | 12 | [ |
| 11 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], | 13 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], |
| 12 | [gl_save_CFLAGS=$CFLAGS | 14 | [gl_saved_CFLAGS=$CFLAGS |
| 13 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do | 15 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do |
| 14 | AS_CASE([$gl_working], | 16 | AS_CASE([$gl_working], |
| 15 | [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"]) | 17 | [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) |
| 16 | 18 | AC_COMPILE_IFELSE( | |
| 17 | AC_COMPILE_IFELSE( | 19 | [AC_LANG_PROGRAM( |
| 18 | [AC_LANG_PROGRAM( | 20 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 |
| 19 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 | 21 | #pragma clang diagnostic error "-Wc2x-extensions" |
| 20 | #pragma clang diagnostic error "-Wc2x-extensions" | 22 | #pragma clang diagnostic error "-Wc++1z-extensions" |
| 21 | #pragma clang diagnostic error "-Wc++17-extensions" | 23 | #endif |
| 22 | #endif | 24 | #ifdef INCLUDE_ASSERT_H |
| 23 | #ifdef INCLUDE_ASSERT_H | 25 | #include <assert.h> |
| 24 | #include <assert.h> | 26 | #endif |
| 25 | #endif | 27 | static_assert (2 + 2 == 4, "arithmetic does not work"); |
| 26 | static_assert (2 + 2 == 4, "arithmetic does not work"); | 28 | static_assert (2 + 2 == 4); |
| 27 | static_assert (2 + 2 == 4); | 29 | ]], |
| 28 | ]], | 30 | [[ |
| 29 | [[ | 31 | static_assert (sizeof (char) == 1, "sizeof does not work"); |
| 30 | static_assert (sizeof (char) == 1, "sizeof does not work"); | 32 | static_assert (sizeof (char) == 1); |
| 31 | static_assert (sizeof (char) == 1); | 33 | ]]) |
| 32 | ]])], | 34 | ], |
| 33 | [gl_cv_static_assert=$gl_working], | 35 | [gl_cv_static_assert=$gl_working], |
| 34 | [gl_cv_static_assert=no]) | 36 | [gl_cv_static_assert=no]) |
| 35 | CFLAGS=$gl_save_CFLAGS | 37 | CFLAGS=$gl_saved_CFLAGS |
| 36 | test "$gl_cv_static_assert" != no && break | 38 | test "$gl_cv_static_assert" != no && break |
| 37 | done]) | 39 | done |
| 40 | ]) | ||
| 38 | 41 | ||
| 39 | GL_GENERATE_ASSERT_H=false | 42 | GL_GENERATE_ASSERT_H=false |
| 40 | AS_CASE([$gl_cv_static_assert], | 43 | AS_CASE([$gl_cv_static_assert], |
| @@ -46,20 +49,42 @@ AC_DEFUN([gl_ASSERT_H], | |||
| 46 | gl_NEXT_HEADERS([assert.h])]) | 49 | gl_NEXT_HEADERS([assert.h])]) |
| 47 | 50 | ||
| 48 | dnl The "zz" puts this toward config.h's end, to avoid potential | 51 | dnl The "zz" puts this toward config.h's end, to avoid potential |
| 49 | dnl collisions with other definitions. #undef assert so that | 52 | dnl collisions with other definitions. |
| 50 | dnl programs are not tempted to use it without specifically | 53 | dnl Hardcode the known configuration results for GCC and clang, so that |
| 51 | dnl including assert.h. Break the #undef apart with a comment | 54 | dnl a configuration made with the C compiler works also with the C++ compiler |
| 52 | dnl so that 'configure' does not comment it out. | 55 | dnl and vice versa. |
| 56 | dnl The seemingly redundant parentheses are necessary for MSVC 14. | ||
| 57 | dnl #undef assert so that programs are not tempted to use it without | ||
| 58 | dnl specifically including assert.h. | ||
| 59 | dnl #undef __ASSERT_H__ so that on IRIX, when programs later include | ||
| 60 | dnl <assert.h>, this include actually defines assert. | ||
| 61 | dnl Break the #undef_s apart with a comment so that 'configure' does | ||
| 62 | dnl not comment them out. | ||
| 53 | AH_VERBATIM([zzstatic_assert], | 63 | AH_VERBATIM([zzstatic_assert], |
| 54 | [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ | 64 | [#if (!(defined __clang__ \ |
| 65 | ? (defined __cplusplus \ | ||
| 66 | ? __cplusplus >= 201703L \ | ||
| 67 | : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \ | ||
| 68 | && !defined __sun) \ | ||
| 69 | : (defined __GNUC__ \ | ||
| 70 | ? (defined __cplusplus \ | ||
| 71 | ? __cplusplus >= 201103L && __GNUG__ >= 6 \ | ||
| 72 | : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \ | ||
| 73 | && !defined __sun) \ | ||
| 74 | : defined HAVE_C_STATIC_ASSERT)) \ | ||
| 75 | && !defined assert \ | ||
| 55 | && (!defined __cplusplus \ | 76 | && (!defined __cplusplus \ |
| 56 | || (__cpp_static_assert < 201411 \ | 77 | || (__cpp_static_assert < 201411 \ |
| 57 | && __GNUG__ < 6 && __clang_major__ < 6))) | 78 | && __GNUG__ < 6 && __clang_major__ < 6))) |
| 58 | #include <assert.h> | 79 | #include <assert.h> |
| 59 | #undef/**/assert | 80 | #undef/**/assert |
| 81 | #ifdef __sgi | ||
| 82 | #undef/**/__ASSERT_H__ | ||
| 83 | #endif | ||
| 60 | /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. | 84 | /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. |
| 61 | We need it also to be invocable with a single argument. */ | 85 | We need it also to be invocable with a single argument. |
| 62 | #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus | 86 | Haiku 2022 <assert.h> does not define static_assert at all. */ |
| 87 | #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus | ||
| 63 | #undef/**/static_assert | 88 | #undef/**/static_assert |
| 64 | #define static_assert _Static_assert | 89 | #define static_assert _Static_assert |
| 65 | #endif | 90 | #endif |
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4 index 987930ab..785d31c0 100644 --- a/gl/m4/base64.m4 +++ b/gl/m4/base64.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # base64.m4 serial 4 | 1 | # base64.m4 |
| 2 | dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
| 3 | dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_BASE64], | 9 | AC_DEFUN([gl_FUNC_BASE64], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index 77218a7d..59d52be6 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 | |||
| @@ -1,12 +1,15 @@ | |||
| 1 | # btowc.m4 serial 12 | 1 | # btowc.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_BTOWC], | 9 | AC_DEFUN([gl_FUNC_BTOWC], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
| 12 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 10 | 13 | ||
| 11 | dnl Check whether <wchar.h> is usable at all, first. Otherwise the test | 14 | dnl Check whether <wchar.h> is usable at all, first. Otherwise the test |
| 12 | dnl program below may lead to an endless loop. See | 15 | dnl program below may lead to an endless loop. See |
| @@ -40,12 +43,12 @@ int main () | |||
| 40 | [ | 43 | [ |
| 41 | changequote(,)dnl | 44 | changequote(,)dnl |
| 42 | case "$host_os" in | 45 | case "$host_os" in |
| 43 | # Guess no on Cygwin. | 46 | # Guess no on Cygwin. |
| 44 | cygwin*) gl_cv_func_btowc_nul="guessing no" ;; | 47 | cygwin*) gl_cv_func_btowc_nul="guessing no" ;; |
| 45 | # Guess yes on native Windows. | 48 | # Guess yes on native Windows. |
| 46 | mingw*) gl_cv_func_btowc_nul="guessing yes" ;; | 49 | mingw* | windows*) gl_cv_func_btowc_nul="guessing yes" ;; |
| 47 | # Guess yes otherwise. | 50 | # Guess yes otherwise. |
| 48 | *) gl_cv_func_btowc_nul="guessing yes" ;; | 51 | *) gl_cv_func_btowc_nul="guessing yes" ;; |
| 49 | esac | 52 | esac |
| 50 | changequote([,])dnl | 53 | changequote([,])dnl |
| 51 | ]) | 54 | ]) |
| @@ -59,12 +62,12 @@ changequote([,])dnl | |||
| 59 | dnl is present. | 62 | dnl is present. |
| 60 | changequote(,)dnl | 63 | changequote(,)dnl |
| 61 | case "$host_os" in | 64 | case "$host_os" in |
| 62 | # Guess no on IRIX. | 65 | # Guess no on IRIX. |
| 63 | irix*) gl_cv_func_btowc_eof="guessing no" ;; | 66 | irix*) gl_cv_func_btowc_eof="guessing no" ;; |
| 64 | # Guess yes on native Windows. | 67 | # Guess yes on native Windows. |
| 65 | mingw*) gl_cv_func_btowc_eof="guessing yes" ;; | 68 | mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;; |
| 66 | # Guess yes otherwise. | 69 | # Guess yes otherwise. |
| 67 | *) gl_cv_func_btowc_eof="guessing yes" ;; | 70 | *) gl_cv_func_btowc_eof="guessing yes" ;; |
| 68 | esac | 71 | esac |
| 69 | changequote([,])dnl | 72 | changequote([,])dnl |
| 70 | if test $LOCALE_FR != none; then | 73 | if test $LOCALE_FR != none; then |
| @@ -88,6 +91,57 @@ int main () | |||
| 88 | fi | 91 | fi |
| 89 | ]) | 92 | ]) |
| 90 | 93 | ||
| 94 | dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc: | ||
| 95 | dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and | ||
| 96 | dnl ___lc_codepage_func() is 0, but btowc is lacking this special case. | ||
| 97 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | ||
| 98 | AC_CACHE_CHECK([whether btowc is consistent with mbrtowc in the C locale], | ||
| 99 | [gl_cv_func_btowc_consistent], | ||
| 100 | [ | ||
| 101 | AC_RUN_IFELSE( | ||
| 102 | [AC_LANG_SOURCE([[ | ||
| 103 | #include <stdlib.h> | ||
| 104 | #include <string.h> | ||
| 105 | #include <wchar.h> | ||
| 106 | int main () | ||
| 107 | { | ||
| 108 | #if HAVE_MBRTOWC | ||
| 109 | wint_t wc1 = btowc (0x80); | ||
| 110 | wchar_t wc2 = (wchar_t) 0xbadface; | ||
| 111 | char buf[1] = { 0x80 }; | ||
| 112 | mbstate_t state; | ||
| 113 | memset (&state, 0, sizeof (mbstate_t)); | ||
| 114 | if (mbrtowc (&wc2, buf, 1, &state) != 1 || wc1 != wc2) | ||
| 115 | return 1; | ||
| 116 | #endif | ||
| 117 | return 0; | ||
| 118 | }]])], | ||
| 119 | [gl_cv_func_btowc_consistent=yes], | ||
| 120 | [gl_cv_func_btowc_consistent=no], | ||
| 121 | [case "$host_os" in | ||
| 122 | # Guess no on mingw. | ||
| 123 | mingw* | windows*) | ||
| 124 | AC_EGREP_CPP([Problem], [ | ||
| 125 | #ifdef __MINGW32__ | ||
| 126 | Problem | ||
| 127 | #endif | ||
| 128 | ], | ||
| 129 | [gl_cv_func_btowc_consistent="guessing no"], | ||
| 130 | [gl_cv_func_btowc_consistent="guessing yes"]) | ||
| 131 | ;; | ||
| 132 | # Guess yes otherwise. | ||
| 133 | *) gl_cv_func_btowc_consistent="guessing yes" ;; | ||
| 134 | esac | ||
| 135 | ]) | ||
| 136 | ]) | ||
| 137 | |||
| 138 | if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then | ||
| 139 | dnl On mingw/ucrt, we override the return type of btowc(). | ||
| 140 | dnl While the original wint_t (= unsigned short) and the overridden wint_t | ||
| 141 | dnl (= unsigned int) are equivalent in function parameters, this is not | ||
| 142 | dnl the case for function return types. | ||
| 143 | REPLACE_BTOWC=1 | ||
| 144 | fi | ||
| 91 | case "$gl_cv_func_btowc_nul" in | 145 | case "$gl_cv_func_btowc_nul" in |
| 92 | *yes) ;; | 146 | *yes) ;; |
| 93 | *) REPLACE_BTOWC=1 ;; | 147 | *) REPLACE_BTOWC=1 ;; |
| @@ -96,10 +150,22 @@ int main () | |||
| 96 | *yes) ;; | 150 | *yes) ;; |
| 97 | *) REPLACE_BTOWC=1 ;; | 151 | *) REPLACE_BTOWC=1 ;; |
| 98 | esac | 152 | esac |
| 153 | case "$gl_cv_func_btowc_consistent" in | ||
| 154 | *yes) ;; | ||
| 155 | *) REPLACE_BTOWC=1 ;; | ||
| 156 | esac | ||
| 157 | if test $REPLACE_BTOWC = 0; then | ||
| 158 | gl_MBRTOWC_C_LOCALE | ||
| 159 | case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
| 160 | *yes) ;; | ||
| 161 | *) REPLACE_BTOWC=1 ;; | ||
| 162 | esac | ||
| 163 | fi | ||
| 99 | fi | 164 | fi |
| 100 | ]) | 165 | ]) |
| 101 | 166 | ||
| 102 | # Prerequisites of lib/btowc.c. | 167 | # Prerequisites of lib/btowc.c. |
| 103 | AC_DEFUN([gl_PREREQ_BTOWC], [ | 168 | AC_DEFUN([gl_PREREQ_BTOWC], [ |
| 104 | : | 169 | : |
| 170 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | ||
| 105 | ]) | 171 | ]) |
diff --git a/gl/m4/build-to-host.m4 b/gl/m4/build-to-host.m4 new file mode 100644 index 00000000..01bff8f3 --- /dev/null +++ b/gl/m4/build-to-host.m4 | |||
| @@ -0,0 +1,274 @@ | |||
| 1 | # build-to-host.m4 | ||
| 2 | # serial 5 | ||
| 3 | dnl Copyright (C) 2023-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 | dnl Written by Bruno Haible. | ||
| 10 | |||
| 11 | dnl When the build environment ($build_os) is different from the target runtime | ||
| 12 | dnl environment ($host_os), file names may need to be converted from the build | ||
| 13 | dnl environment syntax to the target runtime environment syntax. This is | ||
| 14 | dnl because the Makefiles are executed (mostly) by build environment tools and | ||
| 15 | dnl therefore expect file names in build environment syntax, whereas the runtime | ||
| 16 | dnl expects file names in target runtime environment syntax. | ||
| 17 | dnl | ||
| 18 | dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need | ||
| 19 | dnl be converted from Cygwin syntax to native Windows syntax: | ||
| 20 | dnl /cygdrive/c/foo/bar -> C:\foo\bar | ||
| 21 | dnl /usr/local/share -> C:\cygwin64\usr\local\share | ||
| 22 | dnl | ||
| 23 | dnl gl_BUILD_TO_HOST([somedir]) | ||
| 24 | dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must | ||
| 25 | dnl already have its final value assigned, and produces two additional | ||
| 26 | dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the | ||
| 27 | dnl same file name value, just in different syntax: | ||
| 28 | dnl - somedir_c is the file name in target runtime environment syntax, | ||
| 29 | dnl as a C string (starting and ending with a double-quote, | ||
| 30 | dnl and with escaped backslashes and double-quotes in | ||
| 31 | dnl between). | ||
| 32 | dnl - somedir_c_make is the same thing, escaped for use in a Makefile. | ||
| 33 | |||
| 34 | AC_DEFUN([gl_BUILD_TO_HOST], | ||
| 35 | [ | ||
| 36 | AC_REQUIRE([AC_CANONICAL_BUILD]) | ||
| 37 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 38 | AC_REQUIRE([gl_BUILD_TO_HOST_INIT]) | ||
| 39 | |||
| 40 | dnl Define somedir_c. | ||
| 41 | gl_final_[$1]="$[$1]" | ||
| 42 | dnl Translate it from build syntax to host syntax. | ||
| 43 | case "$build_os" in | ||
| 44 | cygwin*) | ||
| 45 | case "$host_os" in | ||
| 46 | mingw* | windows*) | ||
| 47 | gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;; | ||
| 48 | esac | ||
| 49 | ;; | ||
| 50 | esac | ||
| 51 | dnl Convert it to C string syntax. | ||
| 52 | [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` | ||
| 53 | [$1]_c='"'"$[$1]_c"'"' | ||
| 54 | AC_SUBST([$1_c]) | ||
| 55 | |||
| 56 | dnl Define somedir_c_make. | ||
| 57 | [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"` | ||
| 58 | dnl Use the substituted somedir variable, when possible, so that the user | ||
| 59 | dnl may adjust somedir a posteriori when there are no special characters. | ||
| 60 | if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then | ||
| 61 | [$1]_c_make='\"$([$1])\"' | ||
| 62 | fi | ||
| 63 | AC_SUBST([$1_c_make]) | ||
| 64 | ]) | ||
| 65 | |||
| 66 | dnl Some initializations for gl_BUILD_TO_HOST. | ||
| 67 | AC_DEFUN([gl_BUILD_TO_HOST_INIT], | ||
| 68 | [ | ||
| 69 | gl_sed_double_backslashes='s/\\/\\\\/g' | ||
| 70 | gl_sed_escape_doublequotes='s/"/\\"/g' | ||
| 71 | changequote(,)dnl | ||
| 72 | gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" | ||
| 73 | changequote([,])dnl | ||
| 74 | gl_sed_escape_for_make_2='s,\$,\\$$,g' | ||
| 75 | dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr | ||
| 76 | dnl does not understand '\r'. | ||
| 77 | case `echo r | tr -d '\r'` in | ||
| 78 | '') gl_tr_cr='\015' ;; | ||
| 79 | *) gl_tr_cr='\r' ;; | ||
| 80 | esac | ||
| 81 | ]) | ||
| 82 | |||
| 83 | |||
| 84 | dnl The following macros are convenience invocations of gl_BUILD_TO_HOST | ||
| 85 | dnl for some of the variables that are defined by Autoconf. | ||
| 86 | dnl To do so for _all_ the possible variables, use the module 'configmake'. | ||
| 87 | |||
| 88 | dnl Defines bindir_c and bindir_c_make. | ||
| 89 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR], | ||
| 90 | [ | ||
| 91 | dnl Find the final value of bindir. | ||
| 92 | gl_saved_prefix="${prefix}" | ||
| 93 | gl_saved_exec_prefix="${exec_prefix}" | ||
| 94 | gl_saved_bindir="${bindir}" | ||
| 95 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
| 96 | dnl at the end of configure. | ||
| 97 | if test "X$prefix" = "XNONE"; then | ||
| 98 | prefix="$ac_default_prefix" | ||
| 99 | fi | ||
| 100 | if test "X$exec_prefix" = "XNONE"; then | ||
| 101 | exec_prefix='${prefix}' | ||
| 102 | fi | ||
| 103 | eval exec_prefix="$exec_prefix" | ||
| 104 | eval bindir="$bindir" | ||
| 105 | gl_BUILD_TO_HOST([bindir]) | ||
| 106 | bindir="${gl_saved_bindir}" | ||
| 107 | exec_prefix="${gl_saved_exec_prefix}" | ||
| 108 | prefix="${gl_saved_prefix}" | ||
| 109 | ]) | ||
| 110 | |||
| 111 | dnl Defines datadir_c and datadir_c_make, | ||
| 112 | dnl where datadir = $(datarootdir) | ||
| 113 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR], | ||
| 114 | [ | ||
| 115 | dnl Find the final value of datadir. | ||
| 116 | gl_saved_prefix="${prefix}" | ||
| 117 | gl_saved_datarootdir="${datarootdir}" | ||
| 118 | gl_saved_datadir="${datadir}" | ||
| 119 | dnl Unfortunately, prefix gets only finally determined at the end of | ||
| 120 | dnl configure. | ||
| 121 | if test "X$prefix" = "XNONE"; then | ||
| 122 | prefix="$ac_default_prefix" | ||
| 123 | fi | ||
| 124 | eval datarootdir="$datarootdir" | ||
| 125 | eval datadir="$datadir" | ||
| 126 | gl_BUILD_TO_HOST([datadir]) | ||
| 127 | datadir="${gl_saved_datadir}" | ||
| 128 | datarootdir="${gl_saved_datarootdir}" | ||
| 129 | prefix="${gl_saved_prefix}" | ||
| 130 | ]) | ||
| 131 | |||
| 132 | dnl Defines libdir_c and libdir_c_make. | ||
| 133 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR], | ||
| 134 | [ | ||
| 135 | dnl Find the final value of libdir. | ||
| 136 | gl_saved_prefix="${prefix}" | ||
| 137 | gl_saved_exec_prefix="${exec_prefix}" | ||
| 138 | gl_saved_libdir="${libdir}" | ||
| 139 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
| 140 | dnl at the end of configure. | ||
| 141 | if test "X$prefix" = "XNONE"; then | ||
| 142 | prefix="$ac_default_prefix" | ||
| 143 | fi | ||
| 144 | if test "X$exec_prefix" = "XNONE"; then | ||
| 145 | exec_prefix='${prefix}' | ||
| 146 | fi | ||
| 147 | eval exec_prefix="$exec_prefix" | ||
| 148 | eval libdir="$libdir" | ||
| 149 | gl_BUILD_TO_HOST([libdir]) | ||
| 150 | libdir="${gl_saved_libdir}" | ||
| 151 | exec_prefix="${gl_saved_exec_prefix}" | ||
| 152 | prefix="${gl_saved_prefix}" | ||
| 153 | ]) | ||
| 154 | |||
| 155 | dnl Defines libexecdir_c and libexecdir_c_make. | ||
| 156 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR], | ||
| 157 | [ | ||
| 158 | dnl Find the final value of libexecdir. | ||
| 159 | gl_saved_prefix="${prefix}" | ||
| 160 | gl_saved_exec_prefix="${exec_prefix}" | ||
| 161 | gl_saved_libexecdir="${libexecdir}" | ||
| 162 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
| 163 | dnl at the end of configure. | ||
| 164 | if test "X$prefix" = "XNONE"; then | ||
| 165 | prefix="$ac_default_prefix" | ||
| 166 | fi | ||
| 167 | if test "X$exec_prefix" = "XNONE"; then | ||
| 168 | exec_prefix='${prefix}' | ||
| 169 | fi | ||
| 170 | eval exec_prefix="$exec_prefix" | ||
| 171 | eval libexecdir="$libexecdir" | ||
| 172 | gl_BUILD_TO_HOST([libexecdir]) | ||
| 173 | libexecdir="${gl_saved_libexecdir}" | ||
| 174 | exec_prefix="${gl_saved_exec_prefix}" | ||
| 175 | prefix="${gl_saved_prefix}" | ||
| 176 | ]) | ||
| 177 | |||
| 178 | dnl Defines localedir_c and localedir_c_make. | ||
| 179 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR], | ||
| 180 | [ | ||
| 181 | dnl Find the final value of localedir. | ||
| 182 | gl_saved_prefix="${prefix}" | ||
| 183 | gl_saved_datarootdir="${datarootdir}" | ||
| 184 | gl_saved_localedir="${localedir}" | ||
| 185 | dnl Unfortunately, prefix gets only finally determined at the end of | ||
| 186 | dnl configure. | ||
| 187 | if test "X$prefix" = "XNONE"; then | ||
| 188 | prefix="$ac_default_prefix" | ||
| 189 | fi | ||
| 190 | eval datarootdir="$datarootdir" | ||
| 191 | eval localedir="$localedir" | ||
| 192 | gl_BUILD_TO_HOST([localedir]) | ||
| 193 | localedir="${gl_saved_localedir}" | ||
| 194 | datarootdir="${gl_saved_datarootdir}" | ||
| 195 | prefix="${gl_saved_prefix}" | ||
| 196 | ]) | ||
| 197 | |||
| 198 | dnl Defines pkgdatadir_c and pkgdatadir_c_make, | ||
| 199 | dnl where pkgdatadir = $(datadir)/$(PACKAGE) | ||
| 200 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR], | ||
| 201 | [ | ||
| 202 | dnl Find the final value of pkgdatadir. | ||
| 203 | gl_saved_prefix="${prefix}" | ||
| 204 | gl_saved_datarootdir="${datarootdir}" | ||
| 205 | gl_saved_datadir="${datadir}" | ||
| 206 | gl_saved_pkgdatadir="${pkgdatadir}" | ||
| 207 | dnl Unfortunately, prefix gets only finally determined at the end of | ||
| 208 | dnl configure. | ||
| 209 | if test "X$prefix" = "XNONE"; then | ||
| 210 | prefix="$ac_default_prefix" | ||
| 211 | fi | ||
| 212 | eval datarootdir="$datarootdir" | ||
| 213 | eval datadir="$datadir" | ||
| 214 | eval pkgdatadir="$pkgdatadir" | ||
| 215 | gl_BUILD_TO_HOST([pkgdatadir]) | ||
| 216 | pkgdatadir="${gl_saved_pkgdatadir}" | ||
| 217 | datadir="${gl_saved_datadir}" | ||
| 218 | datarootdir="${gl_saved_datarootdir}" | ||
| 219 | prefix="${gl_saved_prefix}" | ||
| 220 | ]) | ||
| 221 | |||
| 222 | dnl Defines pkglibdir_c and pkglibdir_c_make, | ||
| 223 | dnl where pkglibdir = $(libdir)/$(PACKAGE) | ||
| 224 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR], | ||
| 225 | [ | ||
| 226 | dnl Find the final value of pkglibdir. | ||
| 227 | gl_saved_prefix="${prefix}" | ||
| 228 | gl_saved_exec_prefix="${exec_prefix}" | ||
| 229 | gl_saved_libdir="${libdir}" | ||
| 230 | gl_saved_pkglibdir="${pkglibdir}" | ||
| 231 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
| 232 | dnl at the end of configure. | ||
| 233 | if test "X$prefix" = "XNONE"; then | ||
| 234 | prefix="$ac_default_prefix" | ||
| 235 | fi | ||
| 236 | if test "X$exec_prefix" = "XNONE"; then | ||
| 237 | exec_prefix='${prefix}' | ||
| 238 | fi | ||
| 239 | eval exec_prefix="$exec_prefix" | ||
| 240 | eval libdir="$libdir" | ||
| 241 | eval pkglibdir="$pkglibdir" | ||
| 242 | gl_BUILD_TO_HOST([pkglibdir]) | ||
| 243 | pkglibdir="${gl_saved_pkglibdir}" | ||
| 244 | libdir="${gl_saved_libdir}" | ||
| 245 | exec_prefix="${gl_saved_exec_prefix}" | ||
| 246 | prefix="${gl_saved_prefix}" | ||
| 247 | ]) | ||
| 248 | |||
| 249 | dnl Defines pkglibexecdir_c and pkglibexecdir_c_make, | ||
| 250 | dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE) | ||
| 251 | AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR], | ||
| 252 | [ | ||
| 253 | dnl Find the final value of pkglibexecdir. | ||
| 254 | gl_saved_prefix="${prefix}" | ||
| 255 | gl_saved_exec_prefix="${exec_prefix}" | ||
| 256 | gl_saved_libexecdir="${libexecdir}" | ||
| 257 | gl_saved_pkglibexecdir="${pkglibexecdir}" | ||
| 258 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
| 259 | dnl at the end of configure. | ||
| 260 | if test "X$prefix" = "XNONE"; then | ||
| 261 | prefix="$ac_default_prefix" | ||
| 262 | fi | ||
| 263 | if test "X$exec_prefix" = "XNONE"; then | ||
| 264 | exec_prefix='${prefix}' | ||
| 265 | fi | ||
| 266 | eval exec_prefix="$exec_prefix" | ||
| 267 | eval libexecdir="$libexecdir" | ||
| 268 | eval pkglibexecdir="$pkglibexecdir" | ||
| 269 | gl_BUILD_TO_HOST([pkglibexecdir]) | ||
| 270 | pkglibexecdir="${gl_saved_pkglibexecdir}" | ||
| 271 | libexecdir="${gl_saved_libexecdir}" | ||
| 272 | exec_prefix="${gl_saved_exec_prefix}" | ||
| 273 | prefix="${gl_saved_prefix}" | ||
| 274 | ]) | ||
diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4 index 531ed48a..76d32867 100644 --- a/gl/m4/builtin-expect.m4 +++ b/gl/m4/builtin-expect.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | dnl Check for __builtin_expect. | 1 | # builtin-expect.m4 |
| 2 | 2 | # serial 3 | |
| 3 | dnl Copyright 2016-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2016-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | dnl Provide a GCC-compatible __builtin_expect macro in <config.h>. | ||
| 7 | 10 | ||
| 8 | dnl Written by Paul Eggert. | 11 | dnl Written by Paul Eggert. |
| 9 | 12 | ||
| @@ -45,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT], | |||
| 45 | #elif HAVE___BUILTIN_EXPECT == 2 | 48 | #elif HAVE___BUILTIN_EXPECT == 2 |
| 46 | # include <builtins.h> | 49 | # include <builtins.h> |
| 47 | #endif | 50 | #endif |
| 48 | ]) | 51 | ])]) |
| 49 | ]) | ||
diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4 index 8058d178..b53cb4d0 100644 --- a/gl/m4/byteswap.m4 +++ b/gl/m4/byteswap.m4 | |||
| @@ -1,17 +1,42 @@ | |||
| 1 | # byteswap.m4 serial 5 | 1 | # byteswap.m4 |
| 2 | dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Written by Oskar Liljeblad. | 9 | dnl Written by Oskar Liljeblad. |
| 8 | 10 | ||
| 9 | AC_DEFUN([gl_BYTESWAP], | 11 | AC_DEFUN([gl_BYTESWAP], |
| 10 | [ | 12 | [ |
| 11 | dnl Prerequisites of lib/byteswap.in.h. | 13 | dnl Prerequisites of lib/byteswap.in.h. |
| 12 | AC_CHECK_HEADERS([byteswap.h], [ | 14 | AC_CHECK_HEADERS_ONCE([byteswap.h]) |
| 15 | if test $ac_cv_header_byteswap_h = yes; then | ||
| 16 | AC_CACHE_CHECK([for working bswap_16, bswap_32, bswap_64], | ||
| 17 | [gl_cv_header_working_byteswap_h], | ||
| 18 | [gl_cv_header_working_byteswap_h=no | ||
| 19 | dnl Check that floating point arguments work. | ||
| 20 | dnl This also checks C libraries with implementations like | ||
| 21 | dnl '#define bswap_16(x) (((x) >> 8 & 0xff) | (((x) & 0xff) << 8))' | ||
| 22 | dnl that mistakenly evaluate their arguments multiple times. | ||
| 23 | AC_COMPILE_IFELSE( | ||
| 24 | [AC_LANG_PROGRAM( | ||
| 25 | [[#include <byteswap.h> | ||
| 26 | ]], | ||
| 27 | [[int value_16 = bswap_16 (0.0); | ||
| 28 | int value_32 = bswap_32 (0.0); | ||
| 29 | int value_64 = bswap_64 (0.0); | ||
| 30 | return !(value_16 + value_32 + value_64); | ||
| 31 | ]]) | ||
| 32 | ], | ||
| 33 | [gl_cv_header_working_byteswap_h=yes], | ||
| 34 | [gl_cv_header_working_byteswap_h=no]) | ||
| 35 | ]) | ||
| 36 | fi | ||
| 37 | if test "$gl_cv_header_working_byteswap_h" = yes; then | ||
| 13 | GL_GENERATE_BYTESWAP_H=false | 38 | GL_GENERATE_BYTESWAP_H=false |
| 14 | ], [ | 39 | else |
| 15 | GL_GENERATE_BYTESWAP_H=true | 40 | GL_GENERATE_BYTESWAP_H=true |
| 16 | ]) | 41 | fi |
| 17 | ]) | 42 | ]) |
diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4 index f614371b..8fa8bfc8 100644 --- a/gl/m4/c-bool.m4 +++ b/gl/m4/c-bool.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | # Check for bool that conforms to C2023. | 1 | # c-bool.m4 |
| 2 | 2 | # serial 3 | |
| 3 | dnl Copyright 2022-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2022-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | # Check for bool that conforms to C2023. | ||
| 7 | 10 | ||
| 8 | AC_DEFUN([gl_C_BOOL], | 11 | AC_DEFUN([gl_C_BOOL], |
| 9 | [ | 12 | [ |
| @@ -27,12 +30,23 @@ AC_DEFUN([gl_C_BOOL], | |||
| 27 | dnl The "zz" puts this toward config.h's end, to avoid potential | 30 | dnl The "zz" puts this toward config.h's end, to avoid potential |
| 28 | dnl collisions with other definitions. | 31 | dnl collisions with other definitions. |
| 29 | dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. | 32 | dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. |
| 30 | dnl In C, this means including <stdbool.h> if it is not already included. | 33 | dnl Hardcode the known configuration results for GCC and clang, so that |
| 34 | dnl a configuration made with the C compiler works also with the C++ compiler | ||
| 35 | dnl and vice versa. | ||
| 36 | dnl The seemingly redundant parentheses are necessary for MSVC 14. | ||
| 37 | dnl "Arrange for them to work", in C, means including <stdbool.h> if it is | ||
| 38 | dnl not already included. | ||
| 31 | dnl However, if the preprocessor mistakenly treats 'true' as 0, | 39 | dnl However, if the preprocessor mistakenly treats 'true' as 0, |
| 32 | dnl define it to a bool expression equal to 1; this is needed in | 40 | dnl define it to a bool expression equal to 1; this is needed in |
| 33 | dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. | 41 | dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. |
| 34 | AH_VERBATIM([zzbool], | 42 | AH_VERBATIM([zzbool], |
| 35 | [#ifndef HAVE_C_BOOL | 43 | [#if !(defined __cplusplus \ |
| 44 | ? 1 \ | ||
| 45 | : (defined __clang__ \ | ||
| 46 | ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \ | ||
| 47 | : (defined __GNUC__ \ | ||
| 48 | ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \ | ||
| 49 | : defined HAVE_C_BOOL))) | ||
| 36 | # if !defined __cplusplus && !defined __bool_true_false_are_defined | 50 | # if !defined __cplusplus && !defined __bool_true_false_are_defined |
| 37 | # if HAVE_STDBOOL_H | 51 | # if HAVE_STDBOOL_H |
| 38 | # include <stdbool.h> | 52 | # include <stdbool.h> |
diff --git a/gl/m4/c32rtomb.m4 b/gl/m4/c32rtomb.m4 new file mode 100644 index 00000000..ce26a31e --- /dev/null +++ b/gl/m4/c32rtomb.m4 | |||
| @@ -0,0 +1,187 @@ | |||
| 1 | # c32rtomb.m4 | ||
| 2 | # serial 8 | ||
| 3 | dnl Copyright (C) 2020-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_C32RTOMB], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 13 | |||
| 14 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 15 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 16 | |||
| 17 | AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB]) | ||
| 18 | if test $gl_cv_func_c32rtomb = no; then | ||
| 19 | HAVE_C32RTOMB=0 | ||
| 20 | else | ||
| 21 | dnl When we override mbrtoc32, redefining the meaning of the char32_t | ||
| 22 | dnl values, we need to override c32rtomb as well, for consistency. | ||
| 23 | if test $HAVE_WORKING_MBRTOC32 = 0; then | ||
| 24 | REPLACE_C32RTOMB=1 | ||
| 25 | fi | ||
| 26 | AC_CACHE_CHECK([whether c32rtomb return value is correct], | ||
| 27 | [gl_cv_func_c32rtomb_retval], | ||
| 28 | [ | ||
| 29 | dnl Initial guess, used when cross-compiling. | ||
| 30 | changequote(,)dnl | ||
| 31 | case "$host_os" in | ||
| 32 | # Guess no on AIX. | ||
| 33 | aix*) gl_cv_func_c32rtomb_retval="guessing no" ;; | ||
| 34 | # Guess yes otherwise. | ||
| 35 | *) gl_cv_func_c32rtomb_retval="guessing yes" ;; | ||
| 36 | esac | ||
| 37 | changequote([,])dnl | ||
| 38 | AC_RUN_IFELSE( | ||
| 39 | [AC_LANG_SOURCE([[ | ||
| 40 | #include <stddef.h> | ||
| 41 | #ifdef __HAIKU__ | ||
| 42 | #include <stdint.h> | ||
| 43 | #endif | ||
| 44 | #include <uchar.h> | ||
| 45 | int main () | ||
| 46 | { | ||
| 47 | int result = 0; | ||
| 48 | if (c32rtomb (NULL, 0, NULL) != 1) | ||
| 49 | result |= 1; | ||
| 50 | return result; | ||
| 51 | }]])], | ||
| 52 | [gl_cv_func_c32rtomb_retval=yes], | ||
| 53 | [gl_cv_func_c32rtomb_retval=no], | ||
| 54 | [:]) | ||
| 55 | ]) | ||
| 56 | case "$gl_cv_func_c32rtomb_retval" in | ||
| 57 | *yes) ;; | ||
| 58 | *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1], | ||
| 59 | [Define if the c32rtomb function has an incorrect return value.]) | ||
| 60 | REPLACE_C32RTOMB=1 ;; | ||
| 61 | esac | ||
| 62 | if test $HAVE_WORKING_C32RTOMB = 0; then | ||
| 63 | REPLACE_C32RTOMB=1 | ||
| 64 | fi | ||
| 65 | fi | ||
| 66 | ]) | ||
| 67 | |||
| 68 | AC_DEFUN([gl_CHECK_FUNC_C32RTOMB], | ||
| 69 | [ | ||
| 70 | dnl Cf. gl_CHECK_FUNCS_ANDROID | ||
| 71 | AC_CHECK_DECL([c32rtomb], , , | ||
| 72 | [[#ifdef __HAIKU__ | ||
| 73 | #include <stdint.h> | ||
| 74 | #endif | ||
| 75 | #include <uchar.h> | ||
| 76 | ]]) | ||
| 77 | if test $ac_cv_have_decl_c32rtomb = yes; then | ||
| 78 | dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a | ||
| 79 | dnl static inline function on Haiku 2020. | ||
| 80 | AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb], | ||
| 81 | [AC_LINK_IFELSE( | ||
| 82 | [AC_LANG_PROGRAM( | ||
| 83 | [[#include <stdlib.h> | ||
| 84 | #ifdef __HAIKU__ | ||
| 85 | #include <stdint.h> | ||
| 86 | #endif | ||
| 87 | #include <uchar.h> | ||
| 88 | ]], | ||
| 89 | [[char buf[8]; | ||
| 90 | return c32rtomb (buf, 0, NULL) == 0; | ||
| 91 | ]]) | ||
| 92 | ], | ||
| 93 | [gl_cv_func_c32rtomb=yes], | ||
| 94 | [gl_cv_func_c32rtomb=no]) | ||
| 95 | ]) | ||
| 96 | else | ||
| 97 | gl_cv_func_c32rtomb=no | ||
| 98 | fi | ||
| 99 | ]) | ||
| 100 | |||
| 101 | dnl Test whether c32rtomb works not worse than wcrtomb. | ||
| 102 | dnl Result is HAVE_WORKING_C32RTOMB. | ||
| 103 | |||
| 104 | AC_DEFUN([gl_C32RTOMB_SANITYCHECK], | ||
| 105 | [ | ||
| 106 | AC_REQUIRE([AC_PROG_CC]) | ||
| 107 | AC_REQUIRE([gl_TYPE_CHAR32_T]) | ||
| 108 | AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB]) | ||
| 109 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
| 110 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 111 | if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_c32rtomb = no; then | ||
| 112 | HAVE_WORKING_C32RTOMB=0 | ||
| 113 | else | ||
| 114 | AC_CACHE_CHECK([whether c32rtomb works as well as wcrtomb], | ||
| 115 | [gl_cv_func_c32rtomb_sanitycheck], | ||
| 116 | [ | ||
| 117 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
| 118 | dnl is present. | ||
| 119 | changequote(,)dnl | ||
| 120 | case "$host_os" in | ||
| 121 | # Guess no on Solaris derivatives. | ||
| 122 | solaris*) | ||
| 123 | if test -f /etc/release && grep 'Oracle Solaris' /etc/release >/dev/null; then | ||
| 124 | gl_cv_func_c32rtomb_sanitycheck="guessing yes" | ||
| 125 | else | ||
| 126 | gl_cv_func_c32rtomb_sanitycheck="guessing no" | ||
| 127 | fi | ||
| 128 | ;; | ||
| 129 | # Guess yes otherwise. | ||
| 130 | *) | ||
| 131 | gl_cv_func_c32rtomb_sanitycheck="guessing yes" | ||
| 132 | ;; | ||
| 133 | esac | ||
| 134 | changequote([,])dnl | ||
| 135 | if test $LOCALE_ZH_CN != none; then | ||
| 136 | AC_RUN_IFELSE( | ||
| 137 | [AC_LANG_SOURCE([[ | ||
| 138 | #include <locale.h> | ||
| 139 | #include <stdlib.h> | ||
| 140 | #include <string.h> | ||
| 141 | #include <wchar.h> | ||
| 142 | #ifdef __HAIKU__ | ||
| 143 | #include <stdint.h> | ||
| 144 | #endif | ||
| 145 | #include <uchar.h> | ||
| 146 | int main () | ||
| 147 | { | ||
| 148 | int result = 0; | ||
| 149 | /* This fails on Solaris 11 OmniOS: | ||
| 150 | c32rtomb returns (size_t)-1. | ||
| 151 | wcrtomb returns 4 (correct). */ | ||
| 152 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 | ||
| 153 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
| 154 | { | ||
| 155 | mbstate_t state; | ||
| 156 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
| 157 | char buf[16]; | ||
| 158 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 159 | if (mbrtowc (&wc, "\201\060\211\070", 4, &state) == 4 | ||
| 160 | && wcrtomb (buf, wc, NULL) == 4 | ||
| 161 | && memcmp (buf, "\201\060\211\070", 4) == 0) | ||
| 162 | { | ||
| 163 | char32_t c32 = (wchar_t) 0xBADFACE; | ||
| 164 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 165 | if (mbrtoc32 (&c32, "\201\060\211\070", 4, &state) == 4 | ||
| 166 | && c32rtomb (buf, c32, NULL) != 4) | ||
| 167 | result |= 1; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | return result; | ||
| 171 | }]])], | ||
| 172 | [gl_cv_func_c32rtomb_sanitycheck=yes], | ||
| 173 | [gl_cv_func_c32rtomb_sanitycheck=no], | ||
| 174 | [:]) | ||
| 175 | fi | ||
| 176 | ]) | ||
| 177 | case "$gl_cv_func_c32rtomb_sanitycheck" in | ||
| 178 | *yes) | ||
| 179 | HAVE_WORKING_C32RTOMB=1 | ||
| 180 | AC_DEFINE([HAVE_WORKING_C32RTOMB], [1], | ||
| 181 | [Define if the c32rtomb function basically works.]) | ||
| 182 | ;; | ||
| 183 | *) HAVE_WORKING_C32RTOMB=0 ;; | ||
| 184 | esac | ||
| 185 | fi | ||
| 186 | AC_SUBST([HAVE_WORKING_C32RTOMB]) | ||
| 187 | ]) | ||
diff --git a/gl/m4/calloc.m4 b/gl/m4/calloc.m4 index 23c0dd9f..ac7d08d4 100644 --- a/gl/m4/calloc.m4 +++ b/gl/m4/calloc.m4 | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | # calloc.m4 serial 29 | 1 | # calloc.m4 |
| 2 | 2 | # serial 36 | |
| 3 | # Copyright (C) 2004-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. |
| 4 | # This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | # with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 8 | ||
| 8 | # Written by Jim Meyering. | 9 | # Written by Jim Meyering. |
| 9 | 10 | ||
| @@ -12,42 +13,35 @@ | |||
| 12 | # If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc | 13 | # If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc |
| 13 | # and arrange to use a calloc wrapper function that does work in that case. | 14 | # and arrange to use a calloc wrapper function that does work in that case. |
| 14 | 15 | ||
| 15 | # _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) | 16 | # gl_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) |
| 16 | # ------------------------------------- | 17 | # --------------------------------------- |
| 17 | # If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. | 18 | # If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. |
| 18 | AC_DEFUN([_AC_FUNC_CALLOC_IF], | 19 | AC_DEFUN([gl_FUNC_CALLOC_IF], |
| 19 | [ | 20 | [ |
| 20 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 21 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 21 | AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], | 22 | AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], |
| 22 | [ac_cv_func_calloc_0_nonnull], | 23 | [gl_cv_func_calloc_0_nonnull], |
| 23 | [if test $cross_compiling != yes; then | 24 | [AC_RUN_IFELSE( |
| 24 | ac_cv_func_calloc_0_nonnull=yes | 25 | [AC_LANG_PROGRAM( |
| 25 | AC_RUN_IFELSE( | 26 | [[#include <stdlib.h> |
| 26 | [AC_LANG_PROGRAM( | 27 | /* Use pcalloc to test; "volatile" prevents the compiler |
| 27 | [AC_INCLUDES_DEFAULT], | 28 | from optimizing the calloc call away. */ |
| 28 | [[int result = 0; | 29 | void *(*volatile pcalloc) (size_t, size_t) = calloc;]], |
| 29 | char * volatile p = calloc (0, 0); | 30 | [[void *p = pcalloc (0, 0); |
| 30 | if (!p) | 31 | int result = !p; |
| 31 | result |= 1; | 32 | free (p); |
| 32 | free (p); | 33 | return result;]])], |
| 33 | return result; | 34 | [gl_cv_func_calloc_0_nonnull=yes], |
| 34 | ]])], | 35 | [gl_cv_func_calloc_0_nonnull=no], |
| 35 | [], | 36 | [AS_CASE([$host_os], |
| 36 | [ac_cv_func_calloc_0_nonnull=no]) | 37 | [# Guess yes on platforms where we know the result. |
| 37 | else | 38 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ |
| 38 | case "$host_os" in | 39 | | gnu* | *-musl* | midipix* | midnightbsd* \ |
| 39 | # Guess yes on glibc systems. | 40 | | hpux* | solaris* | cygwin* | mingw* | windows* | msys*], |
| 40 | *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | 41 | [gl_cv_func_calloc_0_nonnull="guessing yes"], |
| 41 | # Guess yes on musl systems. | 42 | [# If we don't know, obey --enable-cross-guesses. |
| 42 | *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | 43 | gl_cv_func_calloc_0_nonnull="$gl_cross_guess_normal"])])]) |
| 43 | # Guess yes on native Windows. | 44 | AS_CASE([$gl_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) |
| 44 | mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | ||
| 45 | # If we don't know, obey --enable-cross-guesses. | ||
| 46 | *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; | ||
| 47 | esac | ||
| 48 | fi | ||
| 49 | ]) | ||
| 50 | AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) | ||
| 51 | ]) | 45 | ]) |
| 52 | 46 | ||
| 53 | 47 | ||
| @@ -58,9 +52,14 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU], | |||
| 58 | [ | 52 | [ |
| 59 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 53 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 60 | AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) | 54 | AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) |
| 55 | |||
| 56 | dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT | ||
| 57 | dnl gets defined already before this macro gets invoked. This helps | ||
| 58 | dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. | ||
| 59 | |||
| 61 | REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" | 60 | REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" |
| 62 | if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then | 61 | if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then |
| 63 | _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) | 62 | gl_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) |
| 64 | fi | 63 | fi |
| 65 | ])# gl_FUNC_CALLOC_GNU | 64 | ])# gl_FUNC_CALLOC_GNU |
| 66 | 65 | ||
| @@ -73,9 +72,7 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX], | |||
| 73 | [ | 72 | [ |
| 74 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 73 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 75 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) | 74 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) |
| 76 | if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then | 75 | REPLACE_CALLOC_FOR_CALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX |
| 77 | REPLACE_CALLOC_FOR_CALLOC_POSIX=1 | ||
| 78 | fi | ||
| 79 | dnl Although in theory we should also test for size_t overflow, | 76 | dnl Although in theory we should also test for size_t overflow, |
| 80 | dnl in practice testing for ptrdiff_t overflow suffices | 77 | dnl in practice testing for ptrdiff_t overflow suffices |
| 81 | dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. | 78 | dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. |
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4 index 9f95c670..314e321e 100644 --- a/gl/m4/close.m4 +++ b/gl/m4/close.m4 | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | # close.m4 serial 9 | 1 | # close.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_CLOSE], | 9 | AC_DEFUN_ONCE([gl_FUNC_CLOSE], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
| 10 | m4_ifdef([gl_MSVC_INVAL], [ | 12 | m4_ifdef([gl_MSVC_INVAL], [ |
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4 index 5804f472..6bed9dee 100644 --- a/gl/m4/codeset.m4 +++ b/gl/m4/codeset.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # codeset.m4 serial 5 (gettext-0.18.2) | 1 | # codeset.m4 |
| 2 | dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2023 Free Software | 2 | # serial 5 (gettext-0.18.2) |
| 3 | dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2025 Free Software | ||
| 3 | dnl Foundation, Inc. | 4 | dnl Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | dnl From Bruno Haible. | 10 | dnl From Bruno Haible. |
| 9 | 11 | ||
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4 index 1776e5eb..5c40b73c 100644 --- a/gl/m4/double-slash-root.m4 +++ b/gl/m4/double-slash-root.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # double-slash-root.m4 serial 4 -*- Autoconf -*- | 1 | # double-slash-root.m4 |
| 2 | dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 4 -*- Autoconf -*- |
| 3 | dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_DOUBLE_SLASH_ROOT], | 9 | AC_DEFUN([gl_DOUBLE_SLASH_ROOT], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4 index e1cc73e1..5da3a0b9 100644 --- a/gl/m4/dup2.m4 +++ b/gl/m4/dup2.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | #serial 27 | 1 | # dup2.m4 |
| 2 | dnl Copyright (C) 2002, 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 28 |
| 3 | dnl Copyright (C) 2002, 2005, 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_DUP2], | 9 | AC_DEFUN([gl_FUNC_DUP2], |
| 8 | [ | 10 | [ |
| @@ -67,7 +69,7 @@ AC_DEFUN([gl_FUNC_DUP2], | |||
| 67 | ], | 69 | ], |
| 68 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], | 70 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], |
| 69 | [case "$host_os" in | 71 | [case "$host_os" in |
| 70 | mingw*) # on this platform, dup2 always returns 0 for success | 72 | mingw* | windows*) # on this platform, dup2 always returns 0 for success |
| 71 | gl_cv_func_dup2_works="guessing no" ;; | 73 | gl_cv_func_dup2_works="guessing no" ;; |
| 72 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 | 74 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 |
| 73 | gl_cv_func_dup2_works="guessing no" ;; | 75 | gl_cv_func_dup2_works="guessing no" ;; |
diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4 deleted file mode 100644 index cb3e08fe..00000000 --- a/gl/m4/eealloc.m4 +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | # eealloc.m4 serial 3 | ||
| 2 | dnl Copyright (C) 2003, 2009-2023 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. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_EEALLOC], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_EEMALLOC]) | ||
| 10 | AC_REQUIRE([gl_EEREALLOC]) | ||
| 11 | ]) | ||
| 12 | |||
| 13 | AC_DEFUN([gl_EEMALLOC], | ||
| 14 | [ | ||
| 15 | _AC_FUNC_MALLOC_IF( | ||
| 16 | [gl_cv_func_malloc_0_nonnull=1], | ||
| 17 | [gl_cv_func_malloc_0_nonnull=0]) | ||
| 18 | AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], | ||
| 19 | [If malloc(0) is != NULL, define this to 1. Otherwise define this | ||
| 20 | to 0.]) | ||
| 21 | ]) | ||
| 22 | |||
| 23 | AC_DEFUN([gl_EEREALLOC], | ||
| 24 | [ | ||
| 25 | _AC_FUNC_REALLOC_IF( | ||
| 26 | [gl_cv_func_realloc_0_nonnull=1], | ||
| 27 | [gl_cv_func_realloc_0_nonnull=0]) | ||
| 28 | AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], | ||
| 29 | [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this | ||
| 30 | to 0.]) | ||
| 31 | ]) | ||
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 index 741dfc56..e0690e54 100644 --- a/gl/m4/environ.m4 +++ b/gl/m4/environ.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # environ.m4 serial 8 | 1 | # environ.m4 |
| 2 | dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
| 3 | dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_ENVIRON], | 9 | AC_DEFUN_ONCE([gl_ENVIRON], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index 4c70d225..420d5bb3 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 | |||
| @@ -1,14 +1,21 @@ | |||
| 1 | # errno_h.m4 serial 14 | 1 | # errno_h.m4 |
| 2 | dnl Copyright (C) 2004, 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
| 3 | dnl Copyright (C) 2004, 2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_PREREQ([2.61]) | 9 | AC_PREREQ([2.61]) |
| 8 | 10 | ||
| 9 | AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], | 11 | AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], |
| 10 | [ | 12 | [ |
| 11 | AC_REQUIRE([AC_PROG_CC]) | 13 | AC_REQUIRE([AC_PROG_CC]) |
| 14 | |||
| 15 | dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT | ||
| 16 | dnl gets defined already before this macro gets invoked. This persuades | ||
| 17 | dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST. | ||
| 18 | |||
| 12 | AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ | 19 | AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ |
| 13 | AC_EGREP_CPP([booboo],[ | 20 | AC_EGREP_CPP([booboo],[ |
| 14 | #include <errno.h> | 21 | #include <errno.h> |
| @@ -63,6 +70,9 @@ booboo | |||
| 63 | #if !defined EILSEQ | 70 | #if !defined EILSEQ |
| 64 | booboo | 71 | booboo |
| 65 | #endif | 72 | #endif |
| 73 | #if !defined ESOCKTNOSUPPORT | ||
| 74 | booboo | ||
| 75 | #endif | ||
| 66 | ], | 76 | ], |
| 67 | [gl_cv_header_errno_h_complete=no], | 77 | [gl_cv_header_errno_h_complete=no], |
| 68 | [gl_cv_header_errno_h_complete=yes]) | 78 | [gl_cv_header_errno_h_complete=yes]) |
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 8cc75dff..1572250a 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 | |||
| @@ -1,22 +1,14 @@ | |||
| 1 | #serial 15 | 1 | # error.m4 |
| 2 | 2 | # serial 16 | |
| 3 | # Copyright (C) 1996-1998, 2001-2004, 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 1996-1998, 2001-2004, 2009-2025 Free Software Foundation, |
| 4 | # | 4 | dnl Inc. |
| 5 | # This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl gives unlimited permission to copy and/or distribute it, |
| 7 | # with or without modifications, as long as this notice is preserved. | 7 | dnl with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 8 | 9 | ||
| 9 | AC_DEFUN([gl_ERROR], | 10 | AC_DEFUN([gl_ERROR], |
| 10 | [ | 11 | [ |
| 11 | dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer | ||
| 12 | dnl maintained in Autoconf and because it invokes AC_LIBOBJ. | ||
| 13 | AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], | ||
| 14 | [AC_LINK_IFELSE( | ||
| 15 | [AC_LANG_PROGRAM( | ||
| 16 | [[#include <error.h>]], | ||
| 17 | [[error_at_line (0, 0, "", 0, "an error occurred");]])], | ||
| 18 | [ac_cv_lib_error_at_line=yes], | ||
| 19 | [ac_cv_lib_error_at_line=no])]) | ||
| 20 | ]) | 12 | ]) |
| 21 | 13 | ||
| 22 | # Prerequisites of lib/error.c. | 14 | # Prerequisites of lib/error.c. |
diff --git a/gl/m4/error_h.m4 b/gl/m4/error_h.m4 new file mode 100644 index 00000000..4ef5cbff --- /dev/null +++ b/gl/m4/error_h.m4 | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | # error_h.m4 | ||
| 2 | # serial 5 | ||
| 3 | dnl Copyright (C) 1996-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 | dnl From Bruno Haible. | ||
| 10 | dnl Provide a working <error.h>. | ||
| 11 | |||
| 12 | AC_DEFUN_ONCE([gl_ERROR_H], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 15 | |||
| 16 | gl_CHECK_NEXT_HEADERS([error.h]) | ||
| 17 | if test $ac_cv_header_error_h = yes; then | ||
| 18 | HAVE_ERROR_H=1 | ||
| 19 | else | ||
| 20 | HAVE_ERROR_H=0 | ||
| 21 | fi | ||
| 22 | AC_SUBST([HAVE_ERROR_H]) | ||
| 23 | |||
| 24 | REPLACE_ERROR=0 | ||
| 25 | |||
| 26 | gl_CHECK_FUNCS_ANDROID([error], [[#include <error.h>]]) | ||
| 27 | if test $ac_cv_func_error = yes; then | ||
| 28 | HAVE_ERROR=1 | ||
| 29 | else | ||
| 30 | HAVE_ERROR=0 | ||
| 31 | case "$gl_cv_onwards_func_error" in | ||
| 32 | future*) REPLACE_ERROR=1 ;; | ||
| 33 | esac | ||
| 34 | fi | ||
| 35 | |||
| 36 | dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer | ||
| 37 | dnl maintained in Autoconf and because it invokes AC_LIBOBJ. | ||
| 38 | dnl We need to notice a missing declaration, like gl_CHECK_FUNCS_ANDROID does. | ||
| 39 | AC_CHECK_DECL([error_at_line], , , [[#include <error.h>]]) | ||
| 40 | if test $ac_cv_have_decl_error_at_line = yes; then | ||
| 41 | AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], | ||
| 42 | [AC_LINK_IFELSE( | ||
| 43 | [AC_LANG_PROGRAM( | ||
| 44 | [[#include <error.h>]], | ||
| 45 | [[error_at_line (0, 0, "", 0, "an error occurred");]])], | ||
| 46 | [ac_cv_lib_error_at_line=yes], | ||
| 47 | [ac_cv_lib_error_at_line=no])]) | ||
| 48 | else | ||
| 49 | ac_cv_lib_error_at_line=no | ||
| 50 | fi | ||
| 51 | if test $ac_cv_lib_error_at_line = yes; then | ||
| 52 | HAVE_ERROR_AT_LINE=1 | ||
| 53 | else | ||
| 54 | HAVE_ERROR_AT_LINE=0 | ||
| 55 | fi | ||
| 56 | REPLACE_ERROR_AT_LINE=0 | ||
| 57 | |||
| 58 | if test $ac_cv_func_error = yes && test $ac_cv_lib_error_at_line = yes; then | ||
| 59 | dnl On Android 11, when error_print_progname is set, the output of the | ||
| 60 | dnl error() function contains an extra space. | ||
| 61 | AC_CACHE_CHECK([for working error function], | ||
| 62 | [gl_cv_func_working_error], | ||
| 63 | [if test $cross_compiling != yes; then | ||
| 64 | AC_LINK_IFELSE( | ||
| 65 | [AC_LANG_PROGRAM([[ | ||
| 66 | #include <error.h> | ||
| 67 | static void print_no_progname (void) {} | ||
| 68 | ]], [[ | ||
| 69 | error_print_progname = print_no_progname; | ||
| 70 | error (0, 0, "foo"); | ||
| 71 | ]]) | ||
| 72 | ], | ||
| 73 | [rm -f conftest.out | ||
| 74 | if test -s conftest$ac_exeext \ | ||
| 75 | && ./conftest$ac_exeext 2> conftest.out; then | ||
| 76 | if grep ' ' conftest.out >/dev/null; then | ||
| 77 | gl_cv_func_working_error=no | ||
| 78 | else | ||
| 79 | gl_cv_func_working_error=yes | ||
| 80 | fi | ||
| 81 | else | ||
| 82 | gl_cv_func_working_error=no | ||
| 83 | fi | ||
| 84 | rm -f conftest.out | ||
| 85 | ], | ||
| 86 | [gl_cv_func_working_error=no]) | ||
| 87 | else | ||
| 88 | AC_COMPILE_IFELSE( | ||
| 89 | [AC_LANG_PROGRAM([[ | ||
| 90 | #include <error.h> | ||
| 91 | ]], [[ | ||
| 92 | error (0, 0, "foo"); | ||
| 93 | ]]) | ||
| 94 | ], | ||
| 95 | [case "$host_os" in | ||
| 96 | # Guess yes on glibc systems. | ||
| 97 | *-gnu* | gnu*) gl_cv_func_working_error="guessing yes" ;; | ||
| 98 | # Guess no on Android. | ||
| 99 | linux*-android*) gl_cv_func_working_error="guessing no" ;; | ||
| 100 | # If we don't know, obey --enable-cross-guesses. | ||
| 101 | *) gl_cv_func_working_error="$gl_cross_guess_normal" ;; | ||
| 102 | esac | ||
| 103 | ], | ||
| 104 | [gl_cv_func_working_error=no]) | ||
| 105 | fi | ||
| 106 | ]) | ||
| 107 | case "$gl_cv_func_working_error" in | ||
| 108 | *no) | ||
| 109 | REPLACE_ERROR=1 | ||
| 110 | REPLACE_ERROR_AT_LINE=1 | ||
| 111 | ;; | ||
| 112 | esac | ||
| 113 | fi | ||
| 114 | |||
| 115 | m4_ifdef([gl_HAVE_MODULE_VERROR], | ||
| 116 | [COMPILE_ERROR_C=1], | ||
| 117 | [if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ | ||
| 118 | || test $HAVE_ERROR_AT_LINE = 0 \ | ||
| 119 | || test $REPLACE_ERROR_AT_LINE = 1; then | ||
| 120 | COMPILE_ERROR_C=1 | ||
| 121 | else | ||
| 122 | COMPILE_ERROR_C=0 | ||
| 123 | fi]) | ||
| 124 | |||
| 125 | AC_SUBST([HAVE_ERROR]) | ||
| 126 | AC_SUBST([HAVE_ERROR_AT_LINE]) | ||
| 127 | AC_SUBST([REPLACE_ERROR]) | ||
| 128 | AC_SUBST([REPLACE_ERROR_AT_LINE]) | ||
| 129 | ]) | ||
diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4 index 2ef46437..08e93397 100644 --- a/gl/m4/exponentd.m4 +++ b/gl/m4/exponentd.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # exponentd.m4 serial 3 | 1 | # exponentd.m4 |
| 2 | dnl Copyright (C) 2007-2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 6 | AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], | 7 | dnl This file is offered as-is, without any warranty. |
| 8 | AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], | ||
| 7 | [ | 9 | [ |
| 8 | AC_CACHE_CHECK([where to find the exponent in a 'double'], | 10 | AC_CACHE_CHECK([where to find the exponent in a 'double'], |
| 9 | [gl_cv_cc_double_expbit0], | 11 | [gl_cv_cc_double_expbit0], |
| @@ -83,7 +85,7 @@ int main () | |||
| 83 | dnl The newer VFP instructions assume little-endian order | 85 | dnl The newer VFP instructions assume little-endian order |
| 84 | dnl consistently. | 86 | dnl consistently. |
| 85 | AC_EGREP_CPP([mixed_endianness], [ | 87 | AC_EGREP_CPP([mixed_endianness], [ |
| 86 | #if defined arm || defined __arm || defined __arm__ | 88 | #if defined __arm__ |
| 87 | mixed_endianness | 89 | mixed_endianness |
| 88 | #endif | 90 | #endif |
| 89 | ], | 91 | ], |
diff --git a/gl/m4/extensions-aix.m4 b/gl/m4/extensions-aix.m4 new file mode 100644 index 00000000..08b703b4 --- /dev/null +++ b/gl/m4/extensions-aix.m4 | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # extensions-aix.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2024-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 | # On AIX, most extensions are already enabled through the _ALL_SOURCE macro, | ||
| 10 | # defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally | ||
| 11 | # activates more GNU and Linux-like behaviours, affecting | ||
| 12 | # - the time_t type, | ||
| 13 | # - errno values in <errno.h>: ENOTEMPTY | ||
| 14 | # - functions in <stdlib.h>: malloc calloc realloc valloc | ||
| 15 | # <https://www.ibm.com/docs/en/aix/7.3?topic=m-malloc-free-realloc-calloc-mallopt-mallinfo-mallinfo-heap-alloca-valloc-posix-memalign-subroutine> | ||
| 16 | # - functions in <string.h>: strerror_r (returns 'char *', like glibc) | ||
| 17 | # - functions in <dirent.h>: scandir, alphasort, readdir_r | ||
| 18 | # - functions in <netdb.h>: gethostbyname_r gethostbyaddr_r | ||
| 19 | # - declarations in <unistd.h>: sbrk | ||
| 20 | # and a couple of secondary <sys/*> header files. | ||
| 21 | |||
| 22 | AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS], | ||
| 23 | [ | ||
| 24 | AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], | ||
| 25 | [Define so that AIX headers are more compatible with GNU/Linux.]) | ||
| 26 | ]) | ||
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 5336b8da..76516bce 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | # serial 23 -*- Autoconf -*- | 1 | # extensions.m4 |
| 2 | # Enable extensions on systems that normally disable them. | 2 | # serial 25 -*- Autoconf -*- |
| 3 | dnl Copyright (C) 2003, 2006-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. | ||
| 3 | 8 | ||
| 4 | # Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. | 9 | # Enable extensions on systems that normally disable them. |
| 5 | # This file is free software; the Free Software Foundation | ||
| 6 | # gives unlimited permission to copy and/or distribute it, | ||
| 7 | # with or without modifications, as long as this notice is preserved. | ||
| 8 | 10 | ||
| 9 | dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that | 11 | dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that |
| 10 | dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. | 12 | dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. |
| @@ -229,4 +231,15 @@ AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], | |||
| 229 | [Define to enable the declarations of ISO C 11 types and functions.]) | 231 | [Define to enable the declarations of ISO C 11 types and functions.]) |
| 230 | ;; | 232 | ;; |
| 231 | esac | 233 | esac |
| 234 | |||
| 235 | dnl On OpenSolaris derivatives, the include files contains a couple of | ||
| 236 | dnl declarations that are only activated with an explicit | ||
| 237 | dnl -D__STDC_WANT_LIB_EXT1__. | ||
| 238 | AH_VERBATIM([USE_ISO_C_23_ANNEX_K_EXTENSIONS], | ||
| 239 | [/* Define to enable the declarations of ISO C 23 Annex K types and functions. */ | ||
| 240 | #if !(defined __STDC_WANT_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__) | ||
| 241 | #undef/**/__STDC_WANT_LIB_EXT1__ | ||
| 242 | #define __STDC_WANT_LIB_EXT1__ 1 | ||
| 243 | #endif | ||
| 244 | ]) | ||
| 232 | ]) | 245 | ]) |
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index c001b1cf..d4fe6d82 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | dnl 'extern inline' a la ISO C99. | 1 | # extern-inline.m4 |
| 2 | 2 | # serial 1 | |
| 3 | dnl Copyright 2012-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2012-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | dnl 'extern inline' a la ISO C99. | ||
| 7 | 10 | ||
| 8 | AC_DEFUN([gl_EXTERN_INLINE], | 11 | AC_DEFUN([gl_EXTERN_INLINE], |
| 9 | [ | 12 | [ |
| @@ -79,7 +82,8 @@ AC_DEFUN([gl_EXTERN_INLINE], | |||
| 79 | # define _GL_EXTERN_INLINE_STDHEADER_BUG | 82 | # define _GL_EXTERN_INLINE_STDHEADER_BUG |
| 80 | #endif | 83 | #endif |
| 81 | #if ((__GNUC__ \ | 84 | #if ((__GNUC__ \ |
| 82 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | 85 | ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ |
| 86 | && !defined __PCC__) \ | ||
| 83 | : (199901L <= __STDC_VERSION__ \ | 87 | : (199901L <= __STDC_VERSION__ \ |
| 84 | && !defined __HP_cc \ | 88 | && !defined __HP_cc \ |
| 85 | && !defined __PGI \ | 89 | && !defined __PGI \ |
| @@ -89,6 +93,7 @@ AC_DEFUN([gl_EXTERN_INLINE], | |||
| 89 | # define _GL_EXTERN_INLINE extern inline | 93 | # define _GL_EXTERN_INLINE extern inline |
| 90 | # define _GL_EXTERN_INLINE_IN_USE | 94 | # define _GL_EXTERN_INLINE_IN_USE |
| 91 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | 95 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ |
| 96 | && !defined __PCC__ \ | ||
| 92 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) | 97 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) |
| 93 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ | 98 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ |
| 94 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | 99 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ |
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4 new file mode 100644 index 00000000..cfb92e28 --- /dev/null +++ b/gl/m4/fclose.m4 | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | # fclose.m4 | ||
| 2 | # serial 12 | ||
| 3 | dnl Copyright (C) 2008-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_ONCE([gl_FUNC_FCLOSE], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 13 | |||
| 14 | gl_FUNC_FFLUSH_STDIN | ||
| 15 | case "$gl_cv_func_fflush_stdin" in | ||
| 16 | *yes) ;; | ||
| 17 | *) REPLACE_FCLOSE=1 ;; | ||
| 18 | esac | ||
| 19 | |||
| 20 | AC_REQUIRE([gl_FUNC_CLOSE]) | ||
| 21 | if test $REPLACE_CLOSE = 1; then | ||
| 22 | REPLACE_FCLOSE=1 | ||
| 23 | fi | ||
| 24 | |||
| 25 | case "$host_os" in | ||
| 26 | openedition) REPLACE_FCLOSE=1 ;; | ||
| 27 | esac | ||
| 28 | |||
| 29 | if test $REPLACE_FCLOSE = 0; then | ||
| 30 | gl_FUNC_FCLOSE_STDIN | ||
| 31 | case "$gl_cv_func_fclose_stdin" in | ||
| 32 | *yes) ;; | ||
| 33 | *) REPLACE_FCLOSE=1 ;; | ||
| 34 | esac | ||
| 35 | fi | ||
| 36 | ]) | ||
| 37 | |||
| 38 | dnl Determine whether fclose works on input streams. | ||
| 39 | dnl Sets gl_cv_func_fclose_stdin. | ||
| 40 | |||
| 41 | AC_DEFUN([gl_FUNC_FCLOSE_STDIN], | ||
| 42 | [ | ||
| 43 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 44 | AC_CHECK_HEADERS_ONCE([unistd.h]) | ||
| 45 | AC_CACHE_CHECK([whether fclose works on input streams], | ||
| 46 | [gl_cv_func_fclose_stdin], | ||
| 47 | [echo hello world > conftest.txt | ||
| 48 | AC_RUN_IFELSE( | ||
| 49 | [AC_LANG_PROGRAM( | ||
| 50 | [[#include <fcntl.h> | ||
| 51 | #include <stdio.h> | ||
| 52 | #if HAVE_UNISTD_H | ||
| 53 | # include <unistd.h> | ||
| 54 | #else /* on Windows with MSVC */ | ||
| 55 | # include <io.h> | ||
| 56 | #endif | ||
| 57 | ]GL_MDA_DEFINES], | ||
| 58 | [[int fd; | ||
| 59 | int fd2; | ||
| 60 | FILE *fp; | ||
| 61 | fd = open ("conftest.txt", O_RDONLY); | ||
| 62 | if (fd < 0) | ||
| 63 | return 1; | ||
| 64 | if (lseek (fd, 1, SEEK_SET) != 1) | ||
| 65 | return 2; | ||
| 66 | fd2 = dup (fd); | ||
| 67 | if (fd2 < 0) | ||
| 68 | return 3; | ||
| 69 | fp = fdopen (fd2, "r"); | ||
| 70 | if (fp == NULL) | ||
| 71 | return 4; | ||
| 72 | if (fgetc (fp) != 'e') | ||
| 73 | { fclose (fp); return 5; } | ||
| 74 | /* This fclose() call should reposition the underlying file | ||
| 75 | descriptor. */ | ||
| 76 | if (fclose (fp) != 0) | ||
| 77 | return 6; | ||
| 78 | if (lseek (fd2, 0, SEEK_CUR) != -1) /* should fail with EBADF */ | ||
| 79 | return 7; | ||
| 80 | /* Verify the file position. */ | ||
| 81 | if (lseek (fd, 0, SEEK_CUR) != 2) | ||
| 82 | return 8; | ||
| 83 | return 0; | ||
| 84 | ]])], | ||
| 85 | [gl_cv_func_fclose_stdin=yes], | ||
| 86 | [gl_cv_func_fclose_stdin=no], | ||
| 87 | [case "$host_os" in | ||
| 88 | # Guess no on glibc systems. | ||
| 89 | *-gnu* | gnu*) gl_cv_func_fclose_stdin="guessing no" ;; | ||
| 90 | # Guess yes on musl systems. | ||
| 91 | *-musl* | midipix*) gl_cv_func_fclose_stdin="guessing yes" ;; | ||
| 92 | # Guess no on native Windows. | ||
| 93 | mingw* | windows*) gl_cv_func_fclose_stdin="guessing no" ;; | ||
| 94 | # If we don't know, obey --enable-cross-guesses. | ||
| 95 | *) gl_cv_func_fclose_stdin="$gl_cross_guess_normal" ;; | ||
| 96 | esac | ||
| 97 | ]) | ||
| 98 | rm conftest.txt | ||
| 99 | ]) | ||
| 100 | ]) | ||
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 index 59d558bd..8020c481 100644 --- a/gl/m4/fcntl-o.m4 +++ b/gl/m4/fcntl-o.m4 | |||
| @@ -1,14 +1,17 @@ | |||
| 1 | # fcntl-o.m4 serial 7 | 1 | # fcntl-o.m4 |
| 2 | dnl Copyright (C) 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
| 3 | dnl Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Written by Paul Eggert. | 9 | dnl Written by Paul Eggert. |
| 8 | 10 | ||
| 9 | AC_PREREQ([2.60]) | 11 | AC_PREREQ([2.60]) |
| 10 | 12 | ||
| 11 | # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. | 13 | # Test whether the flags O_DIRECTORY, O_NOATIME and O_NOFOLLOW actually work. |
| 14 | # Define HAVE_WORKING_O_DIRECTORY to 1 if O_DIRECTORY works, or to 0 otherwise. | ||
| 12 | # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. | 15 | # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. |
| 13 | # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. | 16 | # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. |
| 14 | AC_DEFUN([gl_FCNTL_O_FLAGS], | 17 | AC_DEFUN([gl_FCNTL_O_FLAGS], |
| @@ -29,16 +32,23 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], | |||
| 29 | #else /* on Windows with MSVC */ | 32 | #else /* on Windows with MSVC */ |
| 30 | # include <io.h> | 33 | # include <io.h> |
| 31 | # include <stdlib.h> | 34 | # include <stdlib.h> |
| 32 | # defined sleep(n) _sleep ((n) * 1000) | 35 | # define sleep(n) _sleep ((n) * 1000) |
| 33 | #endif | 36 | #endif |
| 37 | #include <errno.h> | ||
| 34 | #include <fcntl.h> | 38 | #include <fcntl.h> |
| 35 | ]GL_MDA_DEFINES[ | 39 | ]GL_MDA_DEFINES[ |
| 40 | #ifndef O_DIRECTORY | ||
| 41 | #define O_DIRECTORY 0 | ||
| 42 | #endif | ||
| 36 | #ifndef O_NOATIME | 43 | #ifndef O_NOATIME |
| 37 | #define O_NOATIME 0 | 44 | #define O_NOATIME 0 |
| 38 | #endif | 45 | #endif |
| 39 | #ifndef O_NOFOLLOW | 46 | #ifndef O_NOFOLLOW |
| 40 | #define O_NOFOLLOW 0 | 47 | #define O_NOFOLLOW 0 |
| 41 | #endif | 48 | #endif |
| 49 | #ifndef O_SEARCH | ||
| 50 | #define O_SEARCH O_RDONLY | ||
| 51 | #endif | ||
| 42 | static int const constants[] = | 52 | static int const constants[] = |
| 43 | { | 53 | { |
| 44 | O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, | 54 | O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, |
| @@ -51,31 +61,38 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], | |||
| 51 | { | 61 | { |
| 52 | static char const sym[] = "conftest.sym"; | 62 | static char const sym[] = "conftest.sym"; |
| 53 | if (symlink ("/dev/null", sym) != 0) | 63 | if (symlink ("/dev/null", sym) != 0) |
| 54 | result |= 2; | 64 | result |= 1; |
| 55 | else | 65 | else |
| 56 | { | 66 | { |
| 57 | int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); | 67 | int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); |
| 58 | if (fd >= 0) | 68 | if (fd >= 0) |
| 59 | { | 69 | { |
| 60 | close (fd); | 70 | close (fd); |
| 61 | result |= 4; | 71 | result |= 3; |
| 62 | } | 72 | } |
| 63 | } | 73 | } |
| 64 | if (unlink (sym) != 0 || symlink (".", sym) != 0) | 74 | if (unlink (sym) != 0 || symlink (".", sym) != 0) |
| 65 | result |= 2; | 75 | result |= 1; |
| 66 | else | 76 | else |
| 67 | { | 77 | { |
| 68 | int fd = open (sym, O_RDONLY | O_NOFOLLOW); | 78 | int fd = open (sym, O_RDONLY | O_NOFOLLOW); |
| 69 | if (fd >= 0) | 79 | if (fd >= 0) |
| 70 | { | 80 | { |
| 71 | close (fd); | 81 | close (fd); |
| 72 | result |= 4; | 82 | result |= 3; |
| 73 | } | 83 | } |
| 74 | } | 84 | } |
| 75 | unlink (sym); | 85 | unlink (sym); |
| 76 | } | 86 | } |
| 77 | #endif | 87 | #endif |
| 78 | { | 88 | { |
| 89 | int fd = open ("confdefs.h", O_SEARCH | O_DIRECTORY); | ||
| 90 | if (!(fd < 0 && errno == ENOTDIR)) | ||
| 91 | result |= 4; | ||
| 92 | if (0 <= fd) | ||
| 93 | close (fd); | ||
| 94 | } | ||
| 95 | { | ||
| 79 | static char const file[] = "confdefs.h"; | 96 | static char const file[] = "confdefs.h"; |
| 80 | int fd = open (file, O_RDONLY | O_NOATIME); | 97 | int fd = open (file, O_RDONLY | O_NOATIME); |
| 81 | if (fd < 0) | 98 | if (fd < 0) |
| @@ -110,31 +127,46 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], | |||
| 110 | } | 127 | } |
| 111 | return result;]])], | 128 | return result;]])], |
| 112 | [gl_cv_header_working_fcntl_h=yes], | 129 | [gl_cv_header_working_fcntl_h=yes], |
| 113 | [case $? in #( | 130 | [AS_CASE([$?], |
| 114 | 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( | 131 | dnl We cannot catch exit code 1 or 2 here, because |
| 115 | 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( | 132 | dnl - exit code 1 can occur through a compilation error on mingw (e.g. |
| 116 | 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( | 133 | dnl when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when |
| 117 | *) gl_cv_header_working_fcntl_h='no';; | 134 | dnl result = 1, whereas |
| 118 | esac], | 135 | dnl - exit code 2 can occur through a compilation error on MSVC (e.g. |
| 119 | [case "$host_os" in | 136 | dnl again when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when |
| 120 | # Guess 'no' on native Windows. | 137 | dnl result = 2. |
| 121 | mingw*) gl_cv_header_working_fcntl_h='no' ;; | 138 | [ 3], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"], |
| 122 | *) gl_cv_header_working_fcntl_h=cross-compiling ;; | 139 | [ 4], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY)"], |
| 123 | esac | 140 | [ 7], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"], |
| 124 | ]) | 141 | [64], [gl_cv_header_working_fcntl_h="no (bad O_NOATIME)"], |
| 125 | ]) | 142 | [67], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"], |
| 143 | [68], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY, O_NOATIME)"], | ||
| 144 | [71], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"], | ||
| 145 | [gl_cv_header_working_fcntl_h="no"])], | ||
| 146 | [AS_CASE([$host_os,$gl_cross_guess_normal], | ||
| 147 | # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007) | ||
| 148 | # (see <https://bugs.gnu.org/78509#95>) | ||
| 149 | # and to succeed on Mac OS X 10.5.8 [darwin9.8.0] (2009). | ||
| 150 | # Guess it fails on Mac OS X 10.4.x and earlier. | ||
| 151 | [darwin[[0-8]].*yes], | ||
| 152 | [gl_cv_header_working_fcntl_h="guessing no (bad O_DIRECTORY)"], | ||
| 153 | # Known to be "no" on native MS-Windows. | ||
| 154 | [mingw* | windows*], | ||
| 155 | [gl_cv_header_working_fcntl_h=no], | ||
| 156 | [gl_cv_header_working_fcntl_h=$gl_cross_guess_normal])])]) | ||
| 157 | |||
| 158 | AS_CASE([$gl_cv_header_working_fcntl_h], | ||
| 159 | [*O_DIRECTORY* | *no], [gl_val=0], [gl_val=1]) | ||
| 160 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$gl_val], | ||
| 161 | [Define to 1 if O_DIRECTORY works, 0 otherwise.]) | ||
| 126 | 162 | ||
| 127 | case $gl_cv_header_working_fcntl_h in #( | 163 | AS_CASE([$gl_cv_header_working_fcntl_h], |
| 128 | *O_NOATIME* | no | cross-compiling) ac_val=0;; #( | 164 | [*O_NOATIME* | *no], [gl_val=0], [gl_val=1]) |
| 129 | *) ac_val=1;; | 165 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$gl_val], |
| 130 | esac | 166 | [Define to 1 if O_NOATIME works, 0 otherwise.]) |
| 131 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], | ||
| 132 | [Define to 1 if O_NOATIME works.]) | ||
| 133 | 167 | ||
| 134 | case $gl_cv_header_working_fcntl_h in #( | 168 | AS_CASE([$gl_cv_header_working_fcntl_h], |
| 135 | *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( | 169 | [*O_NOFOLLOW* | *no], [gl_val=0], [gl_val=1]) |
| 136 | *) ac_val=1;; | 170 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$gl_val], |
| 137 | esac | 171 | [Define to 1 if O_NOFOLLOW works, 0 otherwise.]) |
| 138 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], | ||
| 139 | [Define to 1 if O_NOFOLLOW works.]) | ||
| 140 | ]) | 172 | ]) |
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4 index 524a99af..08ab936f 100644 --- a/gl/m4/fcntl.m4 +++ b/gl/m4/fcntl.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # fcntl.m4 serial 11 | 1 | # fcntl.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # For now, this module ensures that fcntl() | 9 | # For now, this module ensures that fcntl() |
| 8 | # - supports F_DUPFD correctly | 10 | # - supports F_DUPFD correctly |
| @@ -82,7 +84,7 @@ AC_DEFUN([gl_FUNC_FCNTL], | |||
| 82 | esac | 84 | esac |
| 83 | 85 | ||
| 84 | dnl Many systems lack F_DUPFD_CLOEXEC. | 86 | dnl Many systems lack F_DUPFD_CLOEXEC. |
| 85 | dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. | 87 | dnl NetBSD 10.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. |
| 86 | AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], | 88 | AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], |
| 87 | [gl_cv_func_fcntl_f_dupfd_cloexec], | 89 | [gl_cv_func_fcntl_f_dupfd_cloexec], |
| 88 | [AC_RUN_IFELSE( | 90 | [AC_RUN_IFELSE( |
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index 68f4e648..1c9f9cce 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | # fcntl_h.m4 | ||
| 1 | # serial 20 | 2 | # serial 20 |
| 2 | # Configure fcntl.h. | 3 | dnl Copyright (C) 2006-2007, 2009-2025 Free Software Foundation, Inc. |
| 3 | dnl Copyright (C) 2006-2007, 2009-2023 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | # Configure fcntl.h. | ||
| 7 | 10 | ||
| 8 | dnl Written by Paul Eggert. | 11 | dnl Written by Paul Eggert. |
| 9 | 12 | ||
diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4 index 3e3c8903..399065b6 100644 --- a/gl/m4/fflush.m4 +++ b/gl/m4/fflush.m4 | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | # fflush.m4 serial 18 | 1 | # fflush.m4 |
| 2 | 2 | # serial 20 | |
| 3 | # Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 4 | # This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | # with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 8 | ||
| 8 | dnl From Eric Blake | 9 | dnl From Eric Blake |
| 9 | 10 | ||
| @@ -79,9 +80,10 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], | |||
| 79 | [gl_cv_func_fflush_stdin=yes], | 80 | [gl_cv_func_fflush_stdin=yes], |
| 80 | [gl_cv_func_fflush_stdin=no], | 81 | [gl_cv_func_fflush_stdin=no], |
| 81 | [case "$host_os" in | 82 | [case "$host_os" in |
| 82 | # Guess no on native Windows. | 83 | # Guess no on NetBSD, OpenBSD, native Windows. |
| 83 | mingw*) gl_cv_func_fflush_stdin="guessing no" ;; | 84 | netbsd* | openbsd* | mingw* | windows*) |
| 84 | *) gl_cv_func_fflush_stdin=cross ;; | 85 | gl_cv_func_fflush_stdin="guessing no" ;; |
| 86 | *) gl_cv_func_fflush_stdin=cross ;; | ||
| 85 | esac | 87 | esac |
| 86 | ]) | 88 | ]) |
| 87 | rm conftest.txt | 89 | rm conftest.txt |
| @@ -92,8 +94,8 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], | |||
| 92 | *) gl_func_fflush_stdin='(-1)' ;; | 94 | *) gl_func_fflush_stdin='(-1)' ;; |
| 93 | esac | 95 | esac |
| 94 | AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], | 96 | AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], |
| 95 | [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, | 97 | [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008 |
| 96 | 0 if fflush is known to not work, -1 if unknown.]) | 98 | or later, 0 if fflush is known to not work, -1 if unknown.]) |
| 97 | ]) | 99 | ]) |
| 98 | 100 | ||
| 99 | # Prerequisites of lib/fflush.c. | 101 | # Prerequisites of lib/fflush.c. |
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index 2f0c9c4e..8580c9c9 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # float_h.m4 serial 13 | 1 | # float_h.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FLOAT_H], | 9 | AC_DEFUN([gl_FLOAT_H], |
| 8 | [ | 10 | [ |
| @@ -53,6 +55,31 @@ changequote([,])dnl | |||
| 53 | ;; | 55 | ;; |
| 54 | esac | 56 | esac |
| 55 | 57 | ||
| 58 | dnl Test for completeness w.r.t. ISO C 23. | ||
| 59 | REPLACE_FLOAT_SNAN=0 | ||
| 60 | AC_CACHE_CHECK([whether float.h conforms to ISO C23], | ||
| 61 | [gl_cv_header_float_h_isoc23], | ||
| 62 | [AC_COMPILE_IFELSE( | ||
| 63 | [AC_LANG_PROGRAM( | ||
| 64 | [[#include <float.h> | ||
| 65 | int x[] = { FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG }; | ||
| 66 | float maxf = FLT_NORM_MAX; | ||
| 67 | double maxd = DBL_NORM_MAX; | ||
| 68 | long double maxl = LDBL_NORM_MAX; | ||
| 69 | ]], | ||
| 70 | [[float sf = FLT_SNAN; | ||
| 71 | double sd = DBL_SNAN; | ||
| 72 | long double sl = LDBL_SNAN; | ||
| 73 | return (sf != 0) + (sd != 0) + (sl != 0); | ||
| 74 | ]])], | ||
| 75 | [gl_cv_header_float_h_isoc23=yes], | ||
| 76 | [gl_cv_header_float_h_isoc23=no]) | ||
| 77 | ]) | ||
| 78 | if test $gl_cv_header_float_h_isoc23 != yes; then | ||
| 79 | GL_GENERATE_FLOAT_H=true | ||
| 80 | REPLACE_FLOAT_SNAN=1 | ||
| 81 | fi | ||
| 82 | |||
| 56 | dnl Test against glibc-2.7 Linux/SPARC64 bug. | 83 | dnl Test against glibc-2.7 Linux/SPARC64 bug. |
| 57 | REPLACE_ITOLD=0 | 84 | REPLACE_ITOLD=0 |
| 58 | AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], | 85 | AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], |
| @@ -84,9 +111,11 @@ int main () | |||
| 84 | [gl_cv_func_itold_works="guessing no"], | 111 | [gl_cv_func_itold_works="guessing no"], |
| 85 | [gl_cv_func_itold_works="guessing yes"]) | 112 | [gl_cv_func_itold_works="guessing yes"]) |
| 86 | ;; | 113 | ;; |
| 87 | # Guess yes on native Windows. | 114 | # Guess yes on native Windows. |
| 88 | mingw*) gl_cv_func_itold_works="guessing yes" ;; | 115 | mingw* | windows*) |
| 89 | *) gl_cv_func_itold_works="guessing yes" ;; | 116 | gl_cv_func_itold_works="guessing yes" ;; |
| 117 | *) | ||
| 118 | gl_cv_func_itold_works="guessing yes" ;; | ||
| 90 | esac | 119 | esac |
| 91 | ]) | 120 | ]) |
| 92 | ]) | 121 | ]) |
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index c49ffa6b..cb75fce9 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # floorf.m4 serial 18 | 1 | # floorf.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 21 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FLOORF], | 9 | AC_DEFUN([gl_FUNC_FLOORF], |
| 8 | [ | 10 | [ |
| @@ -26,7 +28,7 @@ AC_DEFUN([gl_FUNC_FLOORF], | |||
| 26 | AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559], | 28 | AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559], |
| 27 | [gl_cv_func_floorf_ieee], | 29 | [gl_cv_func_floorf_ieee], |
| 28 | [ | 30 | [ |
| 29 | save_LIBS="$LIBS" | 31 | saved_LIBS="$LIBS" |
| 30 | LIBS="$LIBS $FLOORF_LIBM" | 32 | LIBS="$LIBS $FLOORF_LIBM" |
| 31 | AC_RUN_IFELSE( | 33 | AC_RUN_IFELSE( |
| 32 | [AC_LANG_SOURCE([[ | 34 | [AC_LANG_SOURCE([[ |
| @@ -49,17 +51,17 @@ int main (int argc, char *argv[]) | |||
| 49 | [gl_cv_func_floorf_ieee=yes], | 51 | [gl_cv_func_floorf_ieee=yes], |
| 50 | [gl_cv_func_floorf_ieee=no], | 52 | [gl_cv_func_floorf_ieee=no], |
| 51 | [case "$host_os" in | 53 | [case "$host_os" in |
| 52 | # Guess yes on glibc systems. | 54 | # Guess yes on glibc systems. |
| 53 | *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; | 55 | *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; |
| 54 | # Guess yes on musl systems. | 56 | # Guess yes on musl systems. |
| 55 | *-musl*) gl_cv_func_floorf_ieee="guessing yes" ;; | 57 | *-musl* | midipix*) gl_cv_func_floorf_ieee="guessing yes" ;; |
| 56 | # Guess yes on native Windows. | 58 | # Guess yes on native Windows. |
| 57 | mingw*) gl_cv_func_floorf_ieee="guessing yes" ;; | 59 | mingw* | windows*) gl_cv_func_floorf_ieee="guessing yes" ;; |
| 58 | # If we don't know, obey --enable-cross-guesses. | 60 | # If we don't know, obey --enable-cross-guesses. |
| 59 | *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; | 61 | *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; |
| 60 | esac | 62 | esac |
| 61 | ]) | 63 | ]) |
| 62 | LIBS="$save_LIBS" | 64 | LIBS="$saved_LIBS" |
| 63 | ]) | 65 | ]) |
| 64 | case "$gl_cv_func_floorf_ieee" in | 66 | case "$gl_cv_func_floorf_ieee" in |
| 65 | *yes) ;; | 67 | *yes) ;; |
| @@ -94,7 +96,7 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS], | |||
| 94 | [[x = funcptr(x) + floorf(x);]])], | 96 | [[x = funcptr(x) + floorf(x);]])], |
| 95 | [gl_cv_func_floorf_libm=]) | 97 | [gl_cv_func_floorf_libm=]) |
| 96 | if test "$gl_cv_func_floorf_libm" = "?"; then | 98 | if test "$gl_cv_func_floorf_libm" = "?"; then |
| 97 | save_LIBS="$LIBS" | 99 | saved_LIBS="$LIBS" |
| 98 | LIBS="$LIBS -lm" | 100 | LIBS="$LIBS -lm" |
| 99 | AC_LINK_IFELSE( | 101 | AC_LINK_IFELSE( |
| 100 | [AC_LANG_PROGRAM( | 102 | [AC_LANG_PROGRAM( |
| @@ -106,7 +108,7 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS], | |||
| 106 | float x;]], | 108 | float x;]], |
| 107 | [[x = funcptr(x) + floorf(x);]])], | 109 | [[x = funcptr(x) + floorf(x);]])], |
| 108 | [gl_cv_func_floorf_libm="-lm"]) | 110 | [gl_cv_func_floorf_libm="-lm"]) |
| 109 | LIBS="$save_LIBS" | 111 | LIBS="$saved_LIBS" |
| 110 | fi | 112 | fi |
| 111 | ]) | 113 | ]) |
| 112 | FLOORF_LIBM="$gl_cv_func_floorf_libm" | 114 | FLOORF_LIBM="$gl_cv_func_floorf_libm" |
diff --git a/gl/m4/fopen.m4 b/gl/m4/fopen.m4 index 9c39ff72..e27b3270 100644 --- a/gl/m4/fopen.m4 +++ b/gl/m4/fopen.m4 | |||
| @@ -1,15 +1,17 @@ | |||
| 1 | # fopen.m4 serial 13 | 1 | # fopen.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FOPEN], | 9 | AC_DEFUN([gl_FUNC_FOPEN_ITSELF], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
| 10 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 11 | case "$host_os" in | 13 | case "$host_os" in |
| 12 | mingw* | pw*) | 14 | mingw* | windows* | pw*) |
| 13 | dnl Replace fopen, for handling of "/dev/null". | 15 | dnl Replace fopen, for handling of "/dev/null". |
| 14 | REPLACE_FOPEN=1 | 16 | REPLACE_FOPEN=1 |
| 15 | dnl fopen on mingw also has the trailing slash bug. | 17 | dnl fopen on mingw also has the trailing slash bug. |
| @@ -58,6 +60,15 @@ changequote([,])dnl | |||
| 58 | esac | 60 | esac |
| 59 | ]) | 61 | ]) |
| 60 | 62 | ||
| 63 | AC_DEFUN([gl_FUNC_FOPEN], | ||
| 64 | [ | ||
| 65 | AC_REQUIRE([gl_FUNC_FOPEN_ITSELF]) | ||
| 66 | AC_REQUIRE([gl_FUNC_FCLOSE]) | ||
| 67 | if test $REPLACE_FCLOSE = 1; then | ||
| 68 | REPLACE_FOPEN=1 | ||
| 69 | fi | ||
| 70 | ]) | ||
| 71 | |||
| 61 | AC_DEFUN([gl_FUNC_FOPEN_GNU], | 72 | AC_DEFUN([gl_FUNC_FOPEN_GNU], |
| 62 | [ | 73 | [ |
| 63 | AC_REQUIRE([gl_FUNC_FOPEN]) | 74 | AC_REQUIRE([gl_FUNC_FOPEN]) |
| @@ -87,7 +98,7 @@ int main () | |||
| 87 | [gl_cv_func_fopen_mode_x=no], | 98 | [gl_cv_func_fopen_mode_x=no], |
| 88 | [case "$host_os" in | 99 | [case "$host_os" in |
| 89 | # Guess yes on glibc and musl systems. | 100 | # Guess yes on glibc and musl systems. |
| 90 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) | 101 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*) |
| 91 | gl_cv_func_fopen_mode_x="guessing yes" ;; | 102 | gl_cv_func_fopen_mode_x="guessing yes" ;; |
| 92 | # If we don't know, obey --enable-cross-guesses. | 103 | # If we don't know, obey --enable-cross-guesses. |
| 93 | *) | 104 | *) |
| @@ -124,10 +135,10 @@ int main () | |||
| 124 | [gl_cv_func_fopen_mode_e=no], | 135 | [gl_cv_func_fopen_mode_e=no], |
| 125 | [case "$host_os" in | 136 | [case "$host_os" in |
| 126 | # Guess yes on glibc and musl systems. | 137 | # Guess yes on glibc and musl systems. |
| 127 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) | 138 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*) |
| 128 | gl_cv_func_fopen_mode_e="guessing yes" ;; | 139 | gl_cv_func_fopen_mode_e="guessing yes" ;; |
| 129 | # Guess no on native Windows. | 140 | # Guess no on native Windows. |
| 130 | mingw*) | 141 | mingw* | windows*) |
| 131 | gl_cv_func_fopen_mode_e="guessing no" ;; | 142 | gl_cv_func_fopen_mode_e="guessing no" ;; |
| 132 | # If we don't know, obey --enable-cross-guesses. | 143 | # If we don't know, obey --enable-cross-guesses. |
| 133 | *) | 144 | *) |
diff --git a/gl/m4/fpurge.m4 b/gl/m4/fpurge.m4 index b365409d..408a2579 100644 --- a/gl/m4/fpurge.m4 +++ b/gl/m4/fpurge.m4 | |||
| @@ -1,64 +1,65 @@ | |||
| 1 | # fpurge.m4 serial 12 | 1 | # fpurge.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FPURGE], | 9 | AC_DEFUN([gl_FUNC_FPURGE], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
| 10 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 11 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) | 12 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) |
| 12 | AC_CHECK_FUNCS_ONCE([fpurge]) | 13 | AC_CHECK_FUNCS_ONCE([fpurge]) |
| 13 | AC_CHECK_FUNCS_ONCE([__fpurge]) | 14 | gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]]) |
| 14 | AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) | 15 | AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) |
| 15 | if test "x$ac_cv_func_fpurge" = xyes; then | 16 | if test $ac_cv_func_fpurge = yes; then |
| 16 | HAVE_FPURGE=1 | 17 | HAVE_FPURGE=1 |
| 17 | # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune. | 18 | # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune. |
| 18 | AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], | 19 | AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], |
| 19 | [AC_RUN_IFELSE( | 20 | [if test $ac_cv_have_decl_fpurge = yes; then |
| 20 | [AC_LANG_PROGRAM( | 21 | AC_RUN_IFELSE( |
| 21 | [[#include <stdio.h> | 22 | [AC_LANG_PROGRAM( |
| 22 | ]], | 23 | [[#include <stdio.h> |
| 23 | [[FILE *f = fopen ("conftest.txt", "w+"); | 24 | ]], |
| 24 | if (!f) | 25 | [[FILE *f = fopen ("conftest.txt", "w+"); |
| 25 | return 1; | 26 | if (!f) |
| 26 | if (fputc ('a', f) != 'a') | 27 | return 1; |
| 27 | { fclose (f); return 2; } | 28 | if (fputc ('a', f) != 'a') |
| 28 | rewind (f); | 29 | { fclose (f); return 2; } |
| 29 | if (fgetc (f) != 'a') | 30 | rewind (f); |
| 30 | { fclose (f); return 3; } | 31 | if (fgetc (f) != 'a') |
| 31 | if (fgetc (f) != EOF) | 32 | { fclose (f); return 3; } |
| 32 | { fclose (f); return 4; } | 33 | if (fgetc (f) != EOF) |
| 33 | if (fpurge (f) != 0) | 34 | { fclose (f); return 4; } |
| 34 | { fclose (f); return 5; } | 35 | if (fpurge (f) != 0) |
| 35 | if (putc ('b', f) != 'b') | 36 | { fclose (f); return 5; } |
| 36 | { fclose (f); return 6; } | 37 | if (putc ('b', f) != 'b') |
| 37 | if (fclose (f) != 0) | 38 | { fclose (f); return 6; } |
| 38 | return 7; | 39 | if (fclose (f) != 0) |
| 39 | if ((f = fopen ("conftest.txt", "r")) == NULL) | 40 | return 7; |
| 40 | return 8; | 41 | if ((f = fopen ("conftest.txt", "r")) == NULL) |
| 41 | if (fgetc (f) != 'a') | 42 | return 8; |
| 42 | { fclose (f); return 9; } | 43 | if (fgetc (f) != 'a') |
| 43 | if (fgetc (f) != 'b') | 44 | { fclose (f); return 9; } |
| 44 | { fclose (f); return 10; } | 45 | if (fgetc (f) != 'b') |
| 45 | if (fgetc (f) != EOF) | 46 | { fclose (f); return 10; } |
| 46 | { fclose (f); return 11; } | 47 | if (fgetc (f) != EOF) |
| 47 | if (fclose (f) != 0) | 48 | { fclose (f); return 11; } |
| 48 | return 12; | 49 | if (fclose (f) != 0) |
| 49 | if (remove ("conftest.txt") != 0) | 50 | return 12; |
| 50 | return 13; | 51 | if (remove ("conftest.txt") != 0) |
| 51 | return 0; | 52 | return 13; |
| 52 | ]])], | 53 | return 0; |
| 53 | [gl_cv_func_fpurge_works=yes], | 54 | ]])], |
| 54 | [gl_cv_func_fpurge_works=no], | 55 | [gl_cv_func_fpurge_works=yes], |
| 55 | [case "$host_os" in | 56 | [gl_cv_func_fpurge_works=no], |
| 56 | # Guess yes on musl systems. | 57 | [# Obey --enable-cross-guesses. |
| 57 | *-musl*) gl_cv_func_fpurge_works="guessing yes" ;; | 58 | gl_cv_func_fpurge_works="$gl_cross_guess_normal" |
| 58 | # Otherwise obey --enable-cross-guesses. | 59 | ]) |
| 59 | *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; | 60 | else |
| 60 | esac | 61 | gl_cv_func_fpurge_works=no |
| 61 | ]) | 62 | fi |
| 62 | ]) | 63 | ]) |
| 63 | case "$gl_cv_func_fpurge_works" in | 64 | case "$gl_cv_func_fpurge_works" in |
| 64 | *yes) ;; | 65 | *yes) ;; |
diff --git a/gl/m4/freading.m4 b/gl/m4/freading.m4 index 35333369..373d2bff 100644 --- a/gl/m4/freading.m4 +++ b/gl/m4/freading.m4 | |||
| @@ -1,11 +1,16 @@ | |||
| 1 | # freading.m4 serial 2 | 1 | # freading.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FREADING], | 9 | AC_DEFUN([gl_FUNC_FREADING], |
| 8 | [ | 10 | [ |
| 9 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) | 11 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) |
| 10 | AC_CHECK_FUNCS_ONCE([__freading]) | 12 | gl_CHECK_FUNCS_ANDROID([__freading], |
| 13 | [[#include <stdio.h> | ||
| 14 | #include <stdio_ext.h> | ||
| 15 | ]]) | ||
| 11 | ]) | 16 | ]) |
diff --git a/gl/m4/free.m4 b/gl/m4/free.m4 index 0389dea3..485d8243 100644 --- a/gl/m4/free.m4 +++ b/gl/m4/free.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # free.m4 serial 6 | 1 | # free.m4 |
| 2 | # Copyright (C) 2003-2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
| 3 | # This file is free software; the Free Software Foundation | 3 | dnl Copyright (C) 2003-2005, 2009-2025 Free Software Foundation, Inc. |
| 4 | # gives unlimited permission to copy and/or distribute it, | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # with or without modifications, as long as this notice is preserved. | 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. | ||
| 6 | 8 | ||
| 7 | # Written by Paul Eggert and Bruno Haible. | 9 | # Written by Paul Eggert and Bruno Haible. |
| 8 | 10 | ||
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4 index c5fe688c..ce728f60 100644 --- a/gl/m4/fseek.m4 +++ b/gl/m4/fseek.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # fseek.m4 serial 4 | 1 | # fseek.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FSEEK], | 9 | AC_DEFUN([gl_FUNC_FSEEK], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4 index 05ee06bc..c093d399 100644 --- a/gl/m4/fseeko.m4 +++ b/gl/m4/fseeko.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # fseeko.m4 serial 20 | 1 | # fseeko.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 21 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FSEEKO], | 9 | AC_DEFUN([gl_FUNC_FSEEKO], |
| 8 | [ | 10 | [ |
| @@ -68,6 +70,10 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET], | |||
| 68 | # Prerequisites of lib/fseeko.c. | 70 | # Prerequisites of lib/fseeko.c. |
| 69 | AC_DEFUN([gl_PREREQ_FSEEKO], | 71 | AC_DEFUN([gl_PREREQ_FSEEKO], |
| 70 | [ | 72 | [ |
| 73 | if test $gl_cv_func_fseeko != no; then | ||
| 74 | AC_DEFINE([HAVE_FSEEKO], [1], | ||
| 75 | [Define to 1 if the system has the fseeko function.]) | ||
| 76 | fi | ||
| 71 | dnl Native Windows has the function _fseeki64. mingw hides it in some | 77 | dnl Native Windows has the function _fseeki64. mingw hides it in some |
| 72 | dnl circumstances, but mingw64 makes it usable again. | 78 | dnl circumstances, but mingw64 makes it usable again. |
| 73 | AC_CHECK_FUNCS([_fseeki64]) | 79 | AC_CHECK_FUNCS([_fseeki64]) |
diff --git a/gl/m4/fseterr.m4 b/gl/m4/fseterr.m4 new file mode 100644 index 00000000..3a94c288 --- /dev/null +++ b/gl/m4/fseterr.m4 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # fseterr.m4 | ||
| 2 | # serial 2 | ||
| 3 | dnl Copyright (C) 2012-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_FSETERR], | ||
| 10 | [ | ||
| 11 | gl_CHECK_FUNCS_ANDROID([__fseterr], | ||
| 12 | [[#include <stdio.h> | ||
| 13 | #include <stdio_ext.h> | ||
| 14 | ]]) | ||
| 15 | ]) | ||
diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4 index 7cb2edb0..e89bbc32 100644 --- a/gl/m4/fstat.m4 +++ b/gl/m4/fstat.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # fstat.m4 serial 8 | 1 | # fstat.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FSTAT], | 9 | AC_DEFUN([gl_FUNC_FSTAT], |
| 8 | [ | 10 | [ |
| @@ -10,10 +12,10 @@ AC_DEFUN([gl_FUNC_FSTAT], | |||
| 10 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | 12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) |
| 11 | 13 | ||
| 12 | case "$host_os" in | 14 | case "$host_os" in |
| 13 | mingw* | solaris*) | 15 | darwin* | mingw* | windows* | solaris*) |
| 16 | dnl macOS and Solaris stat can return a negative tv_nsec. | ||
| 14 | dnl On MinGW, the original stat() returns st_atime, st_mtime, | 17 | dnl On MinGW, the original stat() returns st_atime, st_mtime, |
| 15 | dnl st_ctime values that are affected by the time zone. | 18 | dnl st_ctime values that are affected by the time zone. |
| 16 | dnl Solaris stat can return a negative tv_nsec. | ||
| 17 | REPLACE_FSTAT=1 | 19 | REPLACE_FSTAT=1 |
| 18 | ;; | 20 | ;; |
| 19 | esac | 21 | esac |
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4 index f65c459f..4407b765 100644 --- a/gl/m4/fstypename.m4 +++ b/gl/m4/fstypename.m4 | |||
| @@ -1,4 +1,11 @@ | |||
| 1 | #serial 6 | 1 | # fstypename.m4 |
| 2 | # serial 6 | ||
| 3 | dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2025 Free Software | ||
| 4 | dnl Foundation, Inc. | ||
| 5 | dnl This file is free software; the Free Software Foundation | ||
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 2 | 9 | ||
| 3 | dnl From Jim Meyering. | 10 | dnl From Jim Meyering. |
| 4 | dnl | 11 | dnl |
| @@ -6,12 +13,6 @@ dnl See if struct statfs has the f_fstypename member. | |||
| 6 | dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. | 13 | dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. |
| 7 | dnl | 14 | dnl |
| 8 | 15 | ||
| 9 | # Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2023 Free Software | ||
| 10 | # Foundation, Inc. | ||
| 11 | # This file is free software; the Free Software Foundation | ||
| 12 | # gives unlimited permission to copy and/or distribute it, | ||
| 13 | # with or without modifications, as long as this notice is preserved. | ||
| 14 | |||
| 15 | AC_DEFUN([gl_FSTYPENAME], | 16 | AC_DEFUN([gl_FSTYPENAME], |
| 16 | [ | 17 | [ |
| 17 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, | 18 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, |
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 88f3ca81..bb7b6e43 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | # fsusage.m4 | ||
| 1 | # serial 35 | 2 | # serial 35 |
| 2 | # Obtaining file system usage information. | 3 | dnl Copyright (C) 1997-1998, 2000-2001, 2003-2025 Free Software Foundation, |
| 4 | dnl Inc. | ||
| 5 | dnl This file is free software; the Free Software Foundation | ||
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 3 | 9 | ||
| 4 | # Copyright (C) 1997-1998, 2000-2001, 2003-2023 Free Software Foundation, Inc. | 10 | # Obtaining file system usage information. |
| 5 | # | ||
| 6 | # This file is free software; the Free Software Foundation | ||
| 7 | # gives unlimited permission to copy and/or distribute it, | ||
| 8 | # with or without modifications, as long as this notice is preserved. | ||
| 9 | 11 | ||
| 10 | # Written by Jim Meyering. | 12 | # Written by Jim Meyering. |
| 11 | 13 | ||
| @@ -269,7 +271,7 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; | |||
| 269 | 271 | ||
| 270 | # Check for SunOS statfs brokenness wrt partitions 2GB and larger. | 272 | # Check for SunOS statfs brokenness wrt partitions 2GB and larger. |
| 271 | # If <sys/vfs.h> exists and struct statfs has a member named f_spare, | 273 | # If <sys/vfs.h> exists and struct statfs has a member named f_spare, |
| 272 | # enable the work-around code in fsusage.c. | 274 | # enable the workaround code in fsusage.c. |
| 273 | AC_DEFUN([gl_STATFS_TRUNCATES], | 275 | AC_DEFUN([gl_STATFS_TRUNCATES], |
| 274 | [ | 276 | [ |
| 275 | AC_CACHE_CHECK([for statfs that truncates block counts], | 277 | AC_CACHE_CHECK([for statfs that truncates block counts], |
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4 index 79f1aaf2..d5610b70 100644 --- a/gl/m4/ftell.m4 +++ b/gl/m4/ftell.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # ftell.m4 serial 3 | 1 | # ftell.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FTELL], | 9 | AC_DEFUN([gl_FUNC_FTELL], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4 index 4901b168..35d30f98 100644 --- a/gl/m4/ftello.m4 +++ b/gl/m4/ftello.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # ftello.m4 serial 14 | 1 | # ftello.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 17 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_FTELLO], | 9 | AC_DEFUN([gl_FUNC_FTELLO], |
| 8 | [ | 10 | [ |
| @@ -37,13 +39,24 @@ AC_DEFUN([gl_FUNC_FTELLO], | |||
| 37 | if test $gl_cv_var_stdin_large_offset = no; then | 39 | if test $gl_cv_var_stdin_large_offset = no; then |
| 38 | REPLACE_FTELLO=1 | 40 | REPLACE_FTELLO=1 |
| 39 | fi | 41 | fi |
| 42 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 43 | if test $REPLACE_FTELLO = 0; then | ||
| 44 | dnl On native Windows, in some circumstances, ftell(), ftello(), | ||
| 45 | dnl fgetpos(), lseek(), _lseeki64() all succeed on devices of type | ||
| 46 | dnl FILE_TYPE_PIPE. However, to match POSIX behaviour, we want | ||
| 47 | dnl ftell(), ftello(), fgetpos(), lseek() to fail when the argument fd | ||
| 48 | dnl designates a pipe. See also | ||
| 49 | dnl https://github.com/python/cpython/issues/78961#issuecomment-1093800325 | ||
| 50 | case "$host_os" in | ||
| 51 | mingw* | windows*) REPLACE_FTELLO=1 ;; | ||
| 52 | esac | ||
| 53 | fi | ||
| 40 | if test $REPLACE_FTELLO = 0; then | 54 | if test $REPLACE_FTELLO = 0; then |
| 41 | dnl Detect bug on Solaris. | 55 | dnl Detect bug on Solaris. |
| 42 | dnl ftell and ftello produce incorrect results after putc that followed a | 56 | dnl ftell and ftello produce incorrect results after putc that followed a |
| 43 | dnl getc call that reached EOF on Solaris. This is because the _IOREAD | 57 | dnl getc call that reached EOF on Solaris. This is because the _IOREAD |
| 44 | dnl flag does not get cleared in this case, even though _IOWRT gets set, | 58 | dnl flag does not get cleared in this case, even though _IOWRT gets set, |
| 45 | dnl and ftell and ftello look whether the _IOREAD flag is set. | 59 | dnl and ftell and ftello look whether the _IOREAD flag is set. |
| 46 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 47 | AC_CACHE_CHECK([whether ftello works], | 60 | AC_CACHE_CHECK([whether ftello works], |
| 48 | [gl_cv_func_ftello_works], | 61 | [gl_cv_func_ftello_works], |
| 49 | [ | 62 | [ |
| @@ -51,12 +64,12 @@ AC_DEFUN([gl_FUNC_FTELLO], | |||
| 51 | dnl be opened. | 64 | dnl be opened. |
| 52 | changequote(,)dnl | 65 | changequote(,)dnl |
| 53 | case "$host_os" in | 66 | case "$host_os" in |
| 54 | # Guess no on Solaris. | 67 | # Guess no on Solaris. |
| 55 | solaris*) gl_cv_func_ftello_works="guessing no" ;; | 68 | solaris*) gl_cv_func_ftello_works="guessing no" ;; |
| 56 | # Guess yes on native Windows. | 69 | # Guess yes on native Windows. |
| 57 | mingw*) gl_cv_func_ftello_works="guessing yes" ;; | 70 | mingw* | windows*) gl_cv_func_ftello_works="guessing yes" ;; |
| 58 | # Guess yes otherwise. | 71 | # Guess yes otherwise. |
| 59 | *) gl_cv_func_ftello_works="guessing yes" ;; | 72 | *) gl_cv_func_ftello_works="guessing yes" ;; |
| 60 | esac | 73 | esac |
| 61 | changequote([,])dnl | 74 | changequote([,])dnl |
| 62 | AC_RUN_IFELSE( | 75 | AC_RUN_IFELSE( |
| @@ -145,6 +158,10 @@ main (void) | |||
| 145 | # Prerequisites of lib/ftello.c. | 158 | # Prerequisites of lib/ftello.c. |
| 146 | AC_DEFUN([gl_PREREQ_FTELLO], | 159 | AC_DEFUN([gl_PREREQ_FTELLO], |
| 147 | [ | 160 | [ |
| 161 | if test $gl_cv_func_ftello != no; then | ||
| 162 | AC_DEFINE([HAVE_FTELLO], [1], | ||
| 163 | [Define to 1 if the system has the ftello function.]) | ||
| 164 | fi | ||
| 148 | dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 | 165 | dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 |
| 149 | dnl makes it usable again. | 166 | dnl makes it usable again. |
| 150 | AC_CHECK_FUNCS([_ftelli64]) | 167 | AC_CHECK_FUNCS([_ftelli64]) |
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 15f09ffb..2931d526 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 | |||
| @@ -1,13 +1,16 @@ | |||
| 1 | # getaddrinfo.m4 serial 34 | 1 | # getaddrinfo.m4 |
| 2 | dnl Copyright (C) 2004-2023 Free Software Foundation, Inc. | 2 | # serial 38 |
| 3 | dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_GETADDRINFO], | 9 | AC_DEFUN([gl_GETADDRINFO], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 11 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
| 10 | AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H | 12 | AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H |
| 13 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 11 | GETADDRINFO_LIB= | 14 | GETADDRINFO_LIB= |
| 12 | gai_saved_LIBS="$LIBS" | 15 | gai_saved_LIBS="$LIBS" |
| 13 | 16 | ||
| @@ -41,7 +44,7 @@ AC_DEFUN([gl_GETADDRINFO], | |||
| 41 | AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], | 44 | AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], |
| 42 | gl_cv_w32_getaddrinfo, [ | 45 | gl_cv_w32_getaddrinfo, [ |
| 43 | gl_cv_w32_getaddrinfo=no | 46 | gl_cv_w32_getaddrinfo=no |
| 44 | am_save_LIBS="$LIBS" | 47 | gl_saved_LIBS="$LIBS" |
| 45 | LIBS="$LIBS -lws2_32" | 48 | LIBS="$LIBS -lws2_32" |
| 46 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 49 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 47 | #ifdef HAVE_WS2TCPIP_H | 50 | #ifdef HAVE_WS2TCPIP_H |
| @@ -49,7 +52,7 @@ AC_DEFUN([gl_GETADDRINFO], | |||
| 49 | #endif | 52 | #endif |
| 50 | #include <stddef.h> | 53 | #include <stddef.h> |
| 51 | ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) | 54 | ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) |
| 52 | LIBS="$am_save_LIBS" | 55 | LIBS="$gl_saved_LIBS" |
| 53 | ]) | 56 | ]) |
| 54 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then | 57 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then |
| 55 | GETADDRINFO_LIB="-lws2_32" | 58 | GETADDRINFO_LIB="-lws2_32" |
| @@ -86,6 +89,46 @@ int getaddrinfo (const char *, const char *, const struct addrinfo *, struct add | |||
| 86 | HAVE_GETADDRINFO=0 | 89 | HAVE_GETADDRINFO=0 |
| 87 | fi | 90 | fi |
| 88 | fi | 91 | fi |
| 92 | if test $HAVE_GETADDRINFO != 0; then | ||
| 93 | AC_CACHE_CHECK([whether getaddrinfo supports AI_NUMERICSERV], | ||
| 94 | [gl_cv_func_getaddrinfo_works], | ||
| 95 | [AC_RUN_IFELSE( | ||
| 96 | [AC_LANG_PROGRAM([[ | ||
| 97 | #include <sys/types.h> | ||
| 98 | #ifdef HAVE_SYS_SOCKET_H | ||
| 99 | #include <sys/socket.h> | ||
| 100 | #endif | ||
| 101 | #ifdef HAVE_NETDB_H | ||
| 102 | #include <netdb.h> | ||
| 103 | #endif | ||
| 104 | #ifdef HAVE_WS2TCPIP_H | ||
| 105 | #include <ws2tcpip.h> | ||
| 106 | #endif | ||
| 107 | #include <stddef.h> | ||
| 108 | #include <string.h> | ||
| 109 | ]], [[ | ||
| 110 | struct addrinfo hints; | ||
| 111 | struct addrinfo *ai; | ||
| 112 | memset (&hints, 0, sizeof (hints)); | ||
| 113 | hints.ai_flags = AI_NUMERICSERV; | ||
| 114 | return getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME; | ||
| 115 | ]]) | ||
| 116 | ], | ||
| 117 | [gl_cv_func_getaddrinfo_works=yes], | ||
| 118 | [gl_cv_func_getaddrinfo_works=no], | ||
| 119 | [case "$host_os" in | ||
| 120 | # Guess no on native Windows. | ||
| 121 | mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;; | ||
| 122 | # Guess yes otherwise. | ||
| 123 | *) gl_cv_func_getaddrinfo_works="guessing yes" ;; | ||
| 124 | esac | ||
| 125 | ]) | ||
| 126 | ]) | ||
| 127 | case "$gl_cv_func_getaddrinfo_works" in | ||
| 128 | *yes) ;; | ||
| 129 | *) REPLACE_GETADDRINFO=1 ;; | ||
| 130 | esac | ||
| 131 | fi | ||
| 89 | AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], | 132 | AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], |
| 90 | [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) | 133 | [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) |
| 91 | 134 | ||
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 9aaed202..63d88306 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | # getdelim.m4 serial 16 | 1 | # getdelim.m4 |
| 2 | # serial 19 | ||
| 2 | 3 | ||
| 3 | dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. | 4 | dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. |
| 4 | dnl | 5 | dnl |
| 5 | dnl This file is free software; the Free Software Foundation | 6 | dnl This file is free software; the Free Software Foundation |
| 6 | dnl gives unlimited permission to copy and/or distribute it, | 7 | dnl gives unlimited permission to copy and/or distribute it, |
| 7 | dnl with or without modifications, as long as this notice is preserved. | 8 | dnl with or without modifications, as long as this notice is preserved. |
| 9 | dnl This file is offered as-is, without any warranty. | ||
| 8 | 10 | ||
| 9 | AC_PREREQ([2.59]) | 11 | AC_PREREQ([2.59]) |
| 10 | 12 | ||
| @@ -18,7 +20,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 18 | 20 | ||
| 19 | AC_CHECK_DECLS_ONCE([getdelim]) | 21 | AC_CHECK_DECLS_ONCE([getdelim]) |
| 20 | 22 | ||
| 21 | AC_CHECK_FUNCS_ONCE([getdelim]) | 23 | gl_CHECK_FUNCS_ANDROID([getdelim], [[#include <stdio.h>]]) |
| 22 | if test $ac_cv_func_getdelim = yes; then | 24 | if test $ac_cv_func_getdelim = yes; then |
| 23 | HAVE_GETDELIM=1 | 25 | HAVE_GETDELIM=1 |
| 24 | dnl Found it in some library. Verify that it works. | 26 | dnl Found it in some library. Verify that it works. |
| @@ -82,8 +84,8 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 82 | ], | 84 | ], |
| 83 | [gl_cv_func_working_getdelim="guessing yes"], | 85 | [gl_cv_func_working_getdelim="guessing yes"], |
| 84 | [case "$host_os" in | 86 | [case "$host_os" in |
| 85 | *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; | 87 | *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; |
| 86 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; | 88 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; |
| 87 | esac | 89 | esac |
| 88 | ]) | 90 | ]) |
| 89 | ]) | 91 | ]) |
| @@ -96,6 +98,9 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 96 | esac | 98 | esac |
| 97 | else | 99 | else |
| 98 | HAVE_GETDELIM=0 | 100 | HAVE_GETDELIM=0 |
| 101 | case "$gl_cv_onwards_func_getdelim" in | ||
| 102 | future*) REPLACE_GETDELIM=1 ;; | ||
| 103 | esac | ||
| 99 | fi | 104 | fi |
| 100 | 105 | ||
| 101 | if test $ac_cv_have_decl_getdelim = no; then | 106 | if test $ac_cv_have_decl_getdelim = no; then |
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4 index 8bcda905..112c1c4d 100644 --- a/gl/m4/getdtablesize.m4 +++ b/gl/m4/getdtablesize.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # getdtablesize.m4 serial 8 | 1 | # getdtablesize.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_GETDTABLESIZE], | 9 | AC_DEFUN([gl_FUNC_GETDTABLESIZE], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index 63f5f636..be71ff78 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # gethostname.m4 serial 15 | 1 | # gethostname.m4 |
| 2 | dnl Copyright (C) 2002, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
| 3 | dnl Copyright (C) 2002, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # Ensure | 9 | # Ensure |
| 8 | # - the gethostname() function, | 10 | # - the gethostname() function, |
| @@ -20,7 +22,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], | |||
| 20 | AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], | 22 | AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], |
| 21 | [gl_cv_w32_gethostname], | 23 | [gl_cv_w32_gethostname], |
| 22 | [gl_cv_w32_gethostname=no | 24 | [gl_cv_w32_gethostname=no |
| 23 | gl_save_LIBS="$LIBS" | 25 | gl_saved_LIBS="$LIBS" |
| 24 | LIBS="$LIBS -lws2_32" | 26 | LIBS="$LIBS -lws2_32" |
| 25 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 27 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 26 | #ifdef HAVE_WINSOCK2_H | 28 | #ifdef HAVE_WINSOCK2_H |
| @@ -28,7 +30,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], | |||
| 28 | #endif | 30 | #endif |
| 29 | #include <stddef.h> | 31 | #include <stddef.h> |
| 30 | ]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes]) | 32 | ]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes]) |
| 31 | LIBS="$gl_save_LIBS" | 33 | LIBS="$gl_saved_LIBS" |
| 32 | ]) | 34 | ]) |
| 33 | if test "$gl_cv_w32_gethostname" = "yes"; then | 35 | if test "$gl_cv_w32_gethostname" = "yes"; then |
| 34 | GETHOSTNAME_LIB="-lws2_32" | 36 | GETHOSTNAME_LIB="-lws2_32" |
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 03569f06..b97b8011 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | # getline.m4 serial 30 | 1 | # getline.m4 |
| 2 | # serial 33 | ||
| 2 | 3 | ||
| 3 | dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, | 4 | dnl Copyright (C) 1998-2003, 2005-2007, 2009-2025 Free Software Foundation, |
| 4 | dnl Inc. | 5 | dnl Inc. |
| 5 | dnl | 6 | dnl |
| 6 | dnl This file is free software; the Free Software Foundation | 7 | dnl This file is free software; the Free Software Foundation |
| 7 | dnl gives unlimited permission to copy and/or distribute it, | 8 | dnl gives unlimited permission to copy and/or distribute it, |
| 8 | dnl with or without modifications, as long as this notice is preserved. | 9 | dnl with or without modifications, as long as this notice is preserved. |
| 10 | dnl This file is offered as-is, without any warranty. | ||
| 9 | 11 | ||
| 10 | AC_PREREQ([2.59]) | 12 | AC_PREREQ([2.59]) |
| 11 | 13 | ||
| @@ -23,12 +25,9 @@ AC_DEFUN([gl_FUNC_GETLINE], | |||
| 23 | 25 | ||
| 24 | AC_CHECK_DECLS_ONCE([getline]) | 26 | AC_CHECK_DECLS_ONCE([getline]) |
| 25 | 27 | ||
| 26 | gl_getline_needs_run_time_check=no | 28 | gl_CHECK_FUNCS_ANDROID([getline], [[#include <stdio.h>]]) |
| 27 | AC_CHECK_FUNC([getline], | 29 | if test $ac_cv_func_getline = yes; then |
| 28 | [dnl Found it in some library. Verify that it works. | 30 | dnl Found it in some library. Verify that it works. |
| 29 | gl_getline_needs_run_time_check=yes], | ||
| 30 | [am_cv_func_working_getline=no]) | ||
| 31 | if test $gl_getline_needs_run_time_check = yes; then | ||
| 32 | AC_CACHE_CHECK([for working getline function], | 31 | AC_CACHE_CHECK([for working getline function], |
| 33 | [am_cv_func_working_getline], | 32 | [am_cv_func_working_getline], |
| 34 | [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data | 33 | [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data |
| @@ -79,12 +78,17 @@ AC_DEFUN([gl_FUNC_GETLINE], | |||
| 79 | ], | 78 | ], |
| 80 | [am_cv_func_working_getline="guessing yes"], | 79 | [am_cv_func_working_getline="guessing yes"], |
| 81 | [case "$host_os" in | 80 | [case "$host_os" in |
| 82 | *-musl*) am_cv_func_working_getline="guessing yes" ;; | 81 | *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;; |
| 83 | *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; | 82 | *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; |
| 84 | esac | 83 | esac |
| 85 | ]) | 84 | ]) |
| 86 | ]) | 85 | ]) |
| 87 | ]) | 86 | ]) |
| 87 | else | ||
| 88 | am_cv_func_working_getline=no | ||
| 89 | case "$gl_cv_onwards_func_getline" in | ||
| 90 | future*) REPLACE_GETLINE=1 ;; | ||
| 91 | esac | ||
| 88 | fi | 92 | fi |
| 89 | 93 | ||
| 90 | if test $ac_cv_have_decl_getline = no; then | 94 | if test $ac_cv_have_decl_getline = no; then |
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 79e420ba..8ab613db 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | # Check for getloadavg. | 1 | # getloadavg.m4 |
| 2 | 2 | # serial 13 | |
| 3 | # Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2023 Free Software | 3 | dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2025 Free |
| 4 | # Foundation, Inc. | 4 | dnl Software Foundation, Inc. |
| 5 | dnl This file is free software; the Free Software Foundation | ||
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 5 | 9 | ||
| 6 | # This file is free software; the Free Software Foundation | 10 | # Check for getloadavg. |
| 7 | # gives unlimited permission to copy and/or distribute it, | ||
| 8 | # with or without modifications, as long as this notice is preserved. | ||
| 9 | |||
| 10 | #serial 10 | ||
| 11 | 11 | ||
| 12 | # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. | 12 | # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. |
| 13 | # New applications should use gl_GETLOADAVG instead. | 13 | # New applications should use gl_GETLOADAVG instead. |
| @@ -20,13 +20,18 @@ AC_DEFUN([gl_GETLOADAVG], | |||
| 20 | # Persuade glibc <stdlib.h> to declare getloadavg(). | 20 | # Persuade glibc <stdlib.h> to declare getloadavg(). |
| 21 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 21 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
| 22 | 22 | ||
| 23 | gl_save_LIBS=$LIBS | 23 | gl_saved_LIBS=$LIBS |
| 24 | 24 | ||
| 25 | # getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, | 25 | # getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, |
| 26 | # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. | 26 | # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. |
| 27 | HAVE_GETLOADAVG=1 | 27 | HAVE_GETLOADAVG=1 |
| 28 | AC_CHECK_FUNC([getloadavg], [], | 28 | gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include <stdlib.h>]]) |
| 29 | [gl_func_getloadavg_done=no | 29 | if test $ac_cv_func_getloadavg != yes; then |
| 30 | case "$gl_cv_onwards_func_getloadavg" in | ||
| 31 | future*) REPLACE_GETLOADAVG=1 ;; | ||
| 32 | esac | ||
| 33 | |||
| 34 | gl_func_getloadavg_done=no | ||
| 30 | 35 | ||
| 31 | # Some systems with -lutil have (and need) -lkvm as well, some do not. | 36 | # Some systems with -lutil have (and need) -lkvm as well, some do not. |
| 32 | # On Solaris, -lkvm requires nlist from -lelf, so check that first | 37 | # On Solaris, -lkvm requires nlist from -lelf, so check that first |
| @@ -73,14 +78,15 @@ AC_CHECK_FUNC([getloadavg], [], | |||
| 73 | AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) | 78 | AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) |
| 74 | AC_CHECK_LIB([dgc], [dg_sys_info])]) | 79 | AC_CHECK_LIB([dgc], [dg_sys_info])]) |
| 75 | fi | 80 | fi |
| 76 | fi]) | 81 | fi |
| 82 | fi | ||
| 77 | 83 | ||
| 78 | if test "x$gl_save_LIBS" = x; then | 84 | if test "x$gl_saved_LIBS" = x; then |
| 79 | GETLOADAVG_LIBS=$LIBS | 85 | GETLOADAVG_LIBS=$LIBS |
| 80 | else | 86 | else |
| 81 | GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"` | 87 | GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_saved_LIBS!!"` |
| 82 | fi | 88 | fi |
| 83 | LIBS=$gl_save_LIBS | 89 | LIBS=$gl_saved_LIBS |
| 84 | 90 | ||
| 85 | AC_SUBST([GETLOADAVG_LIBS])dnl | 91 | AC_SUBST([GETLOADAVG_LIBS])dnl |
| 86 | 92 | ||
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4 index 7981a095..cb344c15 100644 --- a/gl/m4/getopt.m4 +++ b/gl/m4/getopt.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # getopt.m4 serial 48 | 1 | # getopt.m4 |
| 2 | dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 50 |
| 3 | dnl Copyright (C) 2002-2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # Request a POSIX compliant getopt function. | 9 | # Request a POSIX compliant getopt function. |
| 8 | AC_DEFUN([gl_FUNC_GETOPT_POSIX], | 10 | AC_DEFUN([gl_FUNC_GETOPT_POSIX], |
| @@ -76,7 +78,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], | |||
| 76 | fi | 78 | fi |
| 77 | 79 | ||
| 78 | dnl POSIX 2008 does not specify leading '+' behavior, but see | 80 | dnl POSIX 2008 does not specify leading '+' behavior, but see |
| 79 | dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on | 81 | dnl https://austingroupbugs.net/view.php?id=191 for a recommendation on |
| 80 | dnl the next version of POSIX. For now, we only guarantee leading '+' | 82 | dnl the next version of POSIX. For now, we only guarantee leading '+' |
| 81 | dnl behavior with getopt-gnu. | 83 | dnl behavior with getopt-gnu. |
| 82 | if test -z "$gl_replace_getopt"; then | 84 | if test -z "$gl_replace_getopt"; then |
| @@ -197,8 +199,8 @@ main () | |||
| 197 | fi | 199 | fi |
| 198 | else | 200 | else |
| 199 | case "$host_os" in | 201 | case "$host_os" in |
| 200 | darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; | 202 | darwin* | aix* | mingw* | windows*) gl_cv_func_getopt_posix="guessing no";; |
| 201 | *) gl_cv_func_getopt_posix="guessing yes";; | 203 | *) gl_cv_func_getopt_posix="guessing yes";; |
| 202 | esac | 204 | esac |
| 203 | fi | 205 | fi |
| 204 | ]) | 206 | ]) |
| @@ -365,14 +367,7 @@ dnl is ambiguous with environment values that contain newlines. | |||
| 365 | 367 | ||
| 366 | AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], | 368 | AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], |
| 367 | [ | 369 | [ |
| 368 | AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) | 370 | gl_CHECK_HEADER_SYS_CDEFS_H |
| 369 | if test $ac_cv_header_sys_cdefs_h = yes; then | ||
| 370 | HAVE_SYS_CDEFS_H=1 | ||
| 371 | else | ||
| 372 | HAVE_SYS_CDEFS_H=0 | ||
| 373 | fi | ||
| 374 | AC_SUBST([HAVE_SYS_CDEFS_H]) | ||
| 375 | |||
| 376 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], | 371 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], |
| 377 | [Define to rpl_ if the getopt replacement functions and variables | 372 | [Define to rpl_ if the getopt replacement functions and variables |
| 378 | should be used.]) | 373 | should be used.]) |
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4 index b67c527c..90f34c74 100644 --- a/gl/m4/getprogname.m4 +++ b/gl/m4/getprogname.m4 | |||
| @@ -1,16 +1,34 @@ | |||
| 1 | # getprogname.m4 - check for getprogname or replacements for it | 1 | # getprogname.m4 |
| 2 | # serial 8 | ||
| 3 | dnl Copyright (C) 2016-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. | ||
| 2 | 8 | ||
| 3 | # Copyright (C) 2016-2023 Free Software Foundation, Inc. | 9 | # Check for getprogname or replacements for it |
| 4 | # This file is free software; the Free Software Foundation | ||
| 5 | # gives unlimited permission to copy and/or distribute it, | ||
| 6 | # with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | # serial 4 | ||
| 9 | 10 | ||
| 10 | AC_DEFUN([gl_FUNC_GETPROGNAME], | 11 | AC_DEFUN([gl_FUNC_GETPROGNAME], |
| 11 | [ | 12 | [ |
| 12 | AC_CHECK_FUNCS_ONCE([getprogname getexecname]) | 13 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 14 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 15 | gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]]) | ||
| 16 | if test $ac_cv_func_getprogname = no; then | ||
| 17 | HAVE_GETPROGNAME=0 | ||
| 18 | case "$gl_cv_onwards_func_getprogname" in | ||
| 19 | future*) REPLACE_GETPROGNAME=1 ;; | ||
| 20 | esac | ||
| 21 | fi | ||
| 22 | AC_CHECK_DECLS([program_invocation_name], | ||
| 23 | [], | ||
| 24 | [HAVE_DECL_PROGRAM_INVOCATION_NAME=0], | ||
| 25 | [[#include <errno.h>]]) | ||
| 26 | ]) | ||
| 27 | |||
| 28 | AC_DEFUN([gl_PREREQ_GETPROGNAME], | ||
| 29 | [ | ||
| 13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 30 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 31 | AC_CHECK_FUNCS_ONCE([getexecname]) | ||
| 14 | ac_found=0 | 32 | ac_found=0 |
| 15 | AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], | 33 | AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], |
| 16 | [#include <errno.h>]) | 34 | [#include <errno.h>]) |
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4 index 7eab4e10..3cfea50f 100644 --- a/gl/m4/gl-openssl.m4 +++ b/gl/m4/gl-openssl.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # gl-openssl.m4 serial 6 | 1 | # gl-openssl.m4 |
| 2 | dnl Copyright (C) 2013-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2013-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], | 9 | AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], |
| 8 | [ | 10 | [ |
| @@ -39,6 +41,9 @@ AC_DEFUN([gl_CRYPTO_CHECK], | |||
| 39 | AC_SUBST([LIB_CRYPTO]) | 41 | AC_SUBST([LIB_CRYPTO]) |
| 40 | if test "x$with_openssl" != xno; then | 42 | if test "x$with_openssl" != xno; then |
| 41 | if test "x$with_openssl" = xauto-gpl-compat; then | 43 | if test "x$with_openssl" = xauto-gpl-compat; then |
| 44 | dnl OpenSSL versions < 3 are under the OpenSSL license, which is not | ||
| 45 | dnl GPL compatible. | ||
| 46 | dnl See <https://www.gnu.org/licenses/license-list.en.html#OpenSSL>. | ||
| 42 | AC_CACHE_CHECK([whether openssl is GPL compatible], | 47 | AC_CACHE_CHECK([whether openssl is GPL compatible], |
| 43 | [gl_cv_openssl_gpl_compat], | 48 | [gl_cv_openssl_gpl_compat], |
| 44 | [AC_COMPILE_IFELSE( | 49 | [AC_COMPILE_IFELSE( |
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 267f0692..6a6e8593 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # Copyright (C) 2002-2023 Free Software Foundation, Inc. | 1 | # Copyright (C) 2002-2025 Free Software Foundation, Inc. |
| 2 | # | 2 | # |
| 3 | # This file is free software; you can redistribute it and/or modify | 3 | # This file is free software; you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License as published by | 4 | # it under the terms of the GNU General Public License as published by |
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index facc3404..034dae69 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # gnulib-common.m4 serial 75a | 1 | # gnulib-common.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 113 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_PREREQ([2.62]) | 9 | AC_PREREQ([2.62]) |
| 8 | 10 | ||
| @@ -15,43 +17,65 @@ AC_DEFUN([gl_COMMON], [ | |||
| 15 | AC_REQUIRE([gl_ZZGNULIB]) | 17 | AC_REQUIRE([gl_ZZGNULIB]) |
| 16 | ]) | 18 | ]) |
| 17 | AC_DEFUN([gl_COMMON_BODY], [ | 19 | AC_DEFUN([gl_COMMON_BODY], [ |
| 20 | AH_VERBATIM([0witness], | ||
| 21 | [/* Witness that <config.h> has been included. */ | ||
| 22 | #define _GL_CONFIG_H_INCLUDED 1 | ||
| 23 | ]) | ||
| 24 | dnl Avoid warnings from gcc -Wtrailing-whitespace. | ||
| 25 | dnl This is a temporary workaround until Autoconf fixes it. | ||
| 26 | dnl Test case: | ||
| 27 | dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...]) | ||
| 28 | dnl should produce "#define FOO /**/", not "#define FOO ". | ||
| 29 | AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ | ||
| 30 | # pragma GCC diagnostic push | ||
| 31 | # pragma GCC diagnostic ignored "-Wtrailing-whitespace" | ||
| 32 | #endif | ||
| 33 | ]) | ||
| 34 | AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ | ||
| 35 | # pragma GCC diagnostic pop | ||
| 36 | #endif | ||
| 37 | ]) | ||
| 18 | AH_VERBATIM([_GL_GNUC_PREREQ], | 38 | AH_VERBATIM([_GL_GNUC_PREREQ], |
| 19 | [/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ | 39 | [/* True if the compiler says it groks GNU C version MAJOR.MINOR. |
| 20 | #if defined __GNUC__ && defined __GNUC_MINOR__ | 40 | Except that |
| 41 | - clang groks GNU C 4.2, even on Windows, where it does not define | ||
| 42 | __GNUC__. | ||
| 43 | - The OpenMandriva-modified clang compiler pretends that it groks | ||
| 44 | GNU C version 13.1, but it doesn't: It does not support | ||
| 45 | __attribute__ ((__malloc__ (f, i))), nor does it support | ||
| 46 | __attribute__ ((__warning__ (message))) on a function redeclaration. | ||
| 47 | - Users can make clang lie as well, through the -fgnuc-version option. */ | ||
| 48 | #if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__ | ||
| 21 | # define _GL_GNUC_PREREQ(major, minor) \ | 49 | # define _GL_GNUC_PREREQ(major, minor) \ |
| 22 | ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) | 50 | ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) |
| 51 | #elif defined __clang__ | ||
| 52 | /* clang really only groks GNU C 4.2. */ | ||
| 53 | # define _GL_GNUC_PREREQ(major, minor) \ | ||
| 54 | ((major) < 4 + ((minor) <= 2)) | ||
| 23 | #else | 55 | #else |
| 24 | # define _GL_GNUC_PREREQ(major, minor) 0 | 56 | # define _GL_GNUC_PREREQ(major, minor) 0 |
| 25 | #endif | 57 | #endif |
| 26 | ]) | 58 | ]) |
| 27 | AH_VERBATIM([_Noreturn], | 59 | AH_VERBATIM([_Noreturn], |
| 28 | [/* The _Noreturn keyword of C11. */ | 60 | [/* The _Noreturn keyword of C11. |
| 61 | Do not use [[noreturn]], because with it the syntax | ||
| 62 | extern _Noreturn void func (...); | ||
| 63 | would not be valid; such a declaration would be valid only with 'extern' | ||
| 64 | and '_Noreturn' swapped, or without the 'extern' keyword. However, some | ||
| 65 | AIX system header files and several gnulib header files use precisely | ||
| 66 | this syntax with 'extern'. So even though C23 deprecates _Noreturn, | ||
| 67 | it is currently more portable to prefer it to [[noreturn]]. | ||
| 68 | |||
| 69 | Also, do not try to work around LLVM bug 59792 (clang 15 or earlier). | ||
| 70 | This rare bug can be worked around by compiling with 'clang -D_Noreturn=', | ||
| 71 | though the workaround may generate many false-alarm warnings. */ | ||
| 29 | #ifndef _Noreturn | 72 | #ifndef _Noreturn |
| 30 | # if (defined __cplusplus \ | 73 | # if ((!defined __cplusplus || defined __clang__) \ |
| 31 | && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ | 74 | && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0))) |
| 32 | || (defined _MSC_VER && 1900 <= _MSC_VER)) \ | ||
| 33 | && 0) | ||
| 34 | /* [[noreturn]] is not practically usable, because with it the syntax | ||
| 35 | extern _Noreturn void func (...); | ||
| 36 | would not be valid; such a declaration would only be valid with 'extern' | ||
| 37 | and '_Noreturn' swapped, or without the 'extern' keyword. However, some | ||
| 38 | AIX system header files and several gnulib header files use precisely | ||
| 39 | this syntax with 'extern'. */ | ||
| 40 | # define _Noreturn [[noreturn]] | ||
| 41 | # elif (defined __clang__ && __clang_major__ < 16 \ | ||
| 42 | && defined _GL_WORK_AROUND_LLVM_BUG_59792) | ||
| 43 | /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around | ||
| 44 | that rare LLVM bug, though you may get many false-alarm warnings. */ | ||
| 45 | # define _Noreturn | ||
| 46 | # elif ((!defined __cplusplus || defined __clang__) \ | ||
| 47 | && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ | ||
| 48 | || (!defined __STRICT_ANSI__ \ | ||
| 49 | && (_GL_GNUC_PREREQ (4, 7) \ | ||
| 50 | || (defined __apple_build_version__ \ | ||
| 51 | ? 6000000 <= __apple_build_version__ \ | ||
| 52 | : 3 < __clang_major__ + (5 <= __clang_minor__)))))) | ||
| 53 | /* _Noreturn works as-is. */ | 75 | /* _Noreturn works as-is. */ |
| 54 | # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C | 76 | # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C |
| 77 | /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the | ||
| 78 | latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */ | ||
| 55 | # define _Noreturn __attribute__ ((__noreturn__)) | 79 | # define _Noreturn __attribute__ ((__noreturn__)) |
| 56 | # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) | 80 | # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) |
| 57 | # define _Noreturn __declspec (noreturn) | 81 | # define _Noreturn __declspec (noreturn) |
| @@ -72,50 +96,267 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 72 | #endif]) | 96 | #endif]) |
| 73 | AH_VERBATIM([attribute], | 97 | AH_VERBATIM([attribute], |
| 74 | [/* Attributes. */ | 98 | [/* Attributes. */ |
| 75 | #if (defined __has_attribute \ | 99 | /* Define _GL_HAS_ATTRIBUTE only once, because on FreeBSD, with gcc < 5, if |
| 76 | && (!defined __clang_minor__ \ | 100 | <config.h> gets included once again after <sys/cdefs.h>, __has_attribute(x) |
| 77 | || (defined __apple_build_version__ \ | 101 | expands to 0 always, and redefining _GL_HAS_ATTRIBUTE would turn off all |
| 78 | ? 6000000 <= __apple_build_version__ \ | 102 | attributes. */ |
| 79 | : 3 < __clang_major__ + (5 <= __clang_minor__)))) | 103 | #ifndef _GL_HAS_ATTRIBUTE |
| 80 | # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) | 104 | # if (defined __has_attribute \ |
| 81 | #else | 105 | && (!defined __clang_minor__ \ |
| 82 | # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr | 106 | || (defined __apple_build_version__ \ |
| 83 | # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) | 107 | ? 7000000 <= __apple_build_version__ \ |
| 84 | # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) | 108 | : 5 <= __clang_major__))) |
| 85 | # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) | 109 | # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) |
| 86 | # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) | ||
| 87 | # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) | ||
| 88 | # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) | ||
| 89 | # define _GL_ATTR_diagnose_if 0 | ||
| 90 | # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) | ||
| 91 | # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) | ||
| 92 | # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) | ||
| 93 | # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) | ||
| 94 | # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) | ||
| 95 | # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) | ||
| 96 | # ifdef _ICC | ||
| 97 | # define _GL_ATTR_may_alias 0 | ||
| 98 | # else | 110 | # else |
| 99 | # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) | 111 | # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr |
| 112 | /* The following lines list the first GCC version that supports the attribute. | ||
| 113 | Although the lines are not used in GCC 5 and later (as GCC 5 introduced | ||
| 114 | __has_attribute support), list GCC versions 5+ anyway for completeness. */ | ||
| 115 | # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) | ||
| 116 | # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) | ||
| 117 | # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) | ||
| 118 | # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) | ||
| 119 | # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) | ||
| 120 | # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) | ||
| 121 | # define _GL_ATTR_diagnose_if 0 | ||
| 122 | # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) | ||
| 123 | # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) | ||
| 124 | # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) | ||
| 125 | # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) | ||
| 126 | # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) | ||
| 127 | # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) | ||
| 128 | # ifdef _ICC | ||
| 129 | # define _GL_ATTR_may_alias 0 | ||
| 130 | # else | ||
| 131 | # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) | ||
| 132 | # endif | ||
| 133 | # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) | ||
| 134 | # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) | ||
| 135 | # define _GL_ATTR_nonnull_if_nonzero _GL_GNUC_PREREQ (15, 1) | ||
| 136 | # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) | ||
| 137 | # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) | ||
| 138 | # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) | ||
| 139 | # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) | ||
| 140 | # define _GL_ATTR_reproducible _GL_GNUC_PREREQ (15, 1) | ||
| 141 | # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) | ||
| 142 | # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) | ||
| 143 | # define _GL_ATTR_unsequenced _GL_GNUC_PREREQ (15, 1) | ||
| 144 | # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) | ||
| 145 | # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) | ||
| 100 | # endif | 146 | # endif |
| 101 | # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) | ||
| 102 | # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) | ||
| 103 | # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) | ||
| 104 | # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) | ||
| 105 | # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) | ||
| 106 | # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) | ||
| 107 | # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) | ||
| 108 | # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) | ||
| 109 | # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) | ||
| 110 | # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) | ||
| 111 | #endif | 147 | #endif |
| 112 | 148 | ||
| 113 | /* Disable GCC -Wpedantic if using __has_c_attribute and this is not C23+. */ | 149 | /* Use __has_c_attribute if available. However, do not use with |
| 114 | #if (defined __has_c_attribute && _GL_GNUC_PREREQ (4, 6) \ | 150 | pre-C23 GCC, which can issue false positives if -Wpedantic. */ |
| 115 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710) | 151 | #if (defined __has_c_attribute \ |
| 116 | # pragma GCC diagnostic ignored "-Wpedantic" | 152 | && ! (_GL_GNUC_PREREQ (4, 6) \ |
| 153 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710)) | ||
| 154 | # define _GL_HAVE___HAS_C_ATTRIBUTE 1 | ||
| 155 | #else | ||
| 156 | # define _GL_HAVE___HAS_C_ATTRIBUTE 0 | ||
| 157 | #endif | ||
| 158 | |||
| 159 | /* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) | ||
| 160 | syntax, in function declarations. There are two problems here. | ||
| 161 | (Last tested with gcc/g++ 14 and clang/clang++ 18.) | ||
| 162 | |||
| 163 | 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration | ||
| 164 | in any order. | ||
| 165 | =========================== foo.c = foo.cc =========================== | ||
| 166 | __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int); | ||
| 167 | [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int); | ||
| 168 | ====================================================================== | ||
| 169 | This gives a syntax error | ||
| 170 | - in C mode with gcc | ||
| 171 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>, and | ||
| 172 | - in C++ mode with clang++ version < 16, and | ||
| 173 | - in C++ mode, inside extern "C" {}, still in newer clang++ versions | ||
| 174 | <https://github.com/llvm/llvm-project/issues/101990>. | ||
| 175 | */ | ||
| 176 | /* Define if, in a function declaration, the attributes in bracket syntax | ||
| 177 | [[...]] must come before the attributes in __attribute__((...)) syntax. | ||
| 178 | If this is defined, it is best to avoid the bracket syntax, so that the | ||
| 179 | various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any | ||
| 180 | order. */ | ||
| 181 | #ifdef __cplusplus | ||
| 182 | # if defined __clang__ | ||
| 183 | # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 | ||
| 184 | # endif | ||
| 185 | #else | ||
| 186 | # if defined __GNUC__ && !defined __clang__ | ||
| 187 | # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 | ||
| 188 | # endif | ||
| 117 | #endif | 189 | #endif |
| 190 | /* | ||
| 191 | 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration | ||
| 192 | - without 'extern', in C as well as in C++, | ||
| 193 | - with 'extern', in C, | ||
| 194 | - with 'extern "C"', in C++ | ||
| 195 | in the same position. That is, we don't want to be forced to use a | ||
| 196 | macro which arranges for the attribute to come before 'extern' in | ||
| 197 | one case and after 'extern' in the other case, because such a macro | ||
| 198 | would make the source code of .h files pretty ugly. | ||
| 199 | =========================== foo.c = foo.cc =========================== | ||
| 200 | #ifdef __cplusplus | ||
| 201 | # define CC "C" | ||
| 202 | #else | ||
| 203 | # define CC | ||
| 204 | #endif | ||
| 205 | |||
| 206 | #define ND [[__nodiscard__]] | ||
| 207 | #define WUR __attribute__((__warn_unused_result__)) | ||
| 208 | |||
| 209 | #ifdef __cplusplus | ||
| 210 | extern "C" { | ||
| 211 | #endif | ||
| 212 | // gcc clang g++ clang++ | ||
| 213 | |||
| 214 | ND int foo (int); | ||
| 215 | int ND foo (int); // warn error warn error | ||
| 216 | int foo ND (int); | ||
| 217 | int foo (int) ND; // warn error warn error | ||
| 218 | |||
| 219 | WUR int foo (int); | ||
| 220 | int WUR foo (int); | ||
| 221 | int fo1 WUR (int); // error error error error | ||
| 222 | int foo (int) WUR; | ||
| 223 | |||
| 224 | #ifdef __cplusplus | ||
| 225 | } | ||
| 226 | #endif | ||
| 227 | |||
| 228 | // gcc clang g++ clang++ | ||
| 229 | |||
| 230 | ND extern CC int foo (int); // error error | ||
| 231 | extern CC ND int foo (int); // error error | ||
| 232 | extern CC int ND foo (int); // warn error warn error | ||
| 233 | extern CC int foo ND (int); | ||
| 234 | extern CC int foo (int) ND; // warn error warn error | ||
| 235 | |||
| 236 | WUR extern CC int foo (int); // warn | ||
| 237 | extern CC WUR int foo (int); | ||
| 238 | extern CC int WUR foo (int); | ||
| 239 | extern CC int foo WUR (int); // error error error error | ||
| 240 | extern CC int foo (int) WUR; | ||
| 118 | 241 | ||
| 242 | ND EXTERN_C_FUNC int foo (int); // error error | ||
| 243 | EXTERN_C_FUNC ND int foo (int); | ||
| 244 | EXTERN_C_FUNC int ND foo (int); // warn error warn error | ||
| 245 | EXTERN_C_FUNC int foo ND (int); | ||
| 246 | EXTERN_C_FUNC int foo (int) ND; // warn error warn error | ||
| 247 | |||
| 248 | WUR EXTERN_C_FUNC int foo (int); // warn | ||
| 249 | EXTERN_C_FUNC WUR int foo (int); | ||
| 250 | EXTERN_C_FUNC int WUR foo (int); | ||
| 251 | EXTERN_C_FUNC int fo2 WUR (int); // error error error error | ||
| 252 | EXTERN_C_FUNC int foo (int) WUR; | ||
| 253 | ====================================================================== | ||
| 254 | So, if we insist on using the 'extern' keyword ('extern CC' idiom): | ||
| 255 | * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] | ||
| 256 | in both C and C++, there is one available position: | ||
| 257 | - between the function name and the parameter list. | ||
| 258 | * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax | ||
| 259 | in both C and C++, there are several available positions: | ||
| 260 | - before the return type, | ||
| 261 | - between return type and function name, | ||
| 262 | - at the end of the declaration. | ||
| 263 | * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to | ||
| 264 | __attribute__((...)) syntax in C++, there is no available position: | ||
| 265 | it would need to come before 'extern' in C but after 'extern "C"' | ||
| 266 | in C++. | ||
| 267 | * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and | ||
| 268 | to bracket syntax [[...]] in C++, there is one available position: | ||
| 269 | - before the return type. | ||
| 270 | Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally | ||
| 271 | omits the 'extern' keyword: | ||
| 272 | * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] | ||
| 273 | in both C and C++, there are two available positions: | ||
| 274 | - before the return type, | ||
| 275 | - between the function name and the parameter list. | ||
| 276 | * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax | ||
| 277 | in both C and C++, there are several available positions: | ||
| 278 | - before the return type, | ||
| 279 | - between return type and function name, | ||
| 280 | - at the end of the declaration. | ||
| 281 | * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to | ||
| 282 | __attribute__((...)) syntax in C++, there is one available position: | ||
| 283 | - before the return type. | ||
| 284 | * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and | ||
| 285 | to bracket syntax [[...]] in C++, there is one available position: | ||
| 286 | - before the return type. | ||
| 287 | The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and | ||
| 288 | put the attributes before the return type. This works regardless | ||
| 289 | to what the _GL_ATTRIBUTE_* macros expand. | ||
| 290 | */ | ||
| 291 | |||
| 292 | /* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) | ||
| 293 | syntax, in static/inline function definitions. | ||
| 294 | |||
| 295 | There are similar constraints as for function declarations. However, here, | ||
| 296 | we cannot omit the storage-class specifier. Therefore, the following rule | ||
| 297 | applies: | ||
| 298 | * The macros | ||
| 299 | _GL_ATTRIBUTE_CONST | ||
| 300 | _GL_ATTRIBUTE_DEPRECATED | ||
| 301 | _GL_ATTRIBUTE_MAYBE_UNUSED | ||
| 302 | _GL_ATTRIBUTE_NODISCARD | ||
| 303 | _GL_ATTRIBUTE_PURE | ||
| 304 | _GL_ATTRIBUTE_REPRODUCIBLE | ||
| 305 | _GL_ATTRIBUTE_UNSEQUENCED | ||
| 306 | which may expand to bracket syntax [[...]], must come first, before the | ||
| 307 | storage-class specifier. | ||
| 308 | * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax, | ||
| 309 | are better placed between the storage-class specifier and the return | ||
| 310 | type. | ||
| 311 | */ | ||
| 312 | |||
| 313 | /* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) | ||
| 314 | syntax, in variable declarations. | ||
| 315 | |||
| 316 | At which position can they be placed? | ||
| 317 | (Last tested with gcc/g++ 14 and clang/clang++ 18.) | ||
| 318 | |||
| 319 | =========================== foo.c = foo.cc =========================== | ||
| 320 | #ifdef __cplusplus | ||
| 321 | # define CC "C" | ||
| 322 | #else | ||
| 323 | # define CC | ||
| 324 | #endif | ||
| 325 | |||
| 326 | #define BD [[__deprecated__]] | ||
| 327 | #define AD __attribute__ ((__deprecated__)) | ||
| 328 | |||
| 329 | // gcc clang g++ clang++ | ||
| 330 | |||
| 331 | BD extern CC int var; // error error | ||
| 332 | extern CC BD int var; // error error | ||
| 333 | extern CC int BD var; // warn error warn error | ||
| 334 | extern CC int var BD; | ||
| 335 | |||
| 336 | AD extern CC int var; // warn | ||
| 337 | extern CC AD int var; | ||
| 338 | extern CC int AD var; | ||
| 339 | extern CC int var AD; | ||
| 340 | |||
| 341 | BD extern CC int z[]; // error error | ||
| 342 | extern CC BD int z[]; // error error | ||
| 343 | extern CC int BD z[]; // warn error warn error | ||
| 344 | extern CC int z1 BD []; | ||
| 345 | extern CC int z[] BD; // warn error error | ||
| 346 | |||
| 347 | AD extern CC int z[]; // warn | ||
| 348 | extern CC AD int z[]; | ||
| 349 | extern CC int AD z[]; | ||
| 350 | extern CC int z2 AD []; // error error error error | ||
| 351 | extern CC int z[] AD; | ||
| 352 | ====================================================================== | ||
| 353 | |||
| 354 | * For non-array variables, the only good position is after the variable name, | ||
| 355 | that is, at the end of the declaration. | ||
| 356 | * For array variables, you will need to distinguish C and C++: | ||
| 357 | - In C, before the 'extern' keyword. | ||
| 358 | - In C++, between the 'extern "C"' and the variable's type. | ||
| 359 | */ | ||
| 119 | ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. | 360 | ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. |
| 120 | [ | 361 | [ |
| 121 | /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function | 362 | /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function |
| @@ -123,7 +364,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 123 | _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied | 364 | _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied |
| 124 | by the Nth argument of the function is the size of the returned memory block. | 365 | by the Nth argument of the function is the size of the returned memory block. |
| 125 | */ | 366 | */ |
| 126 | /* Applies to: function, pointer to function, function types. */ | 367 | /* Applies to: functions, pointer to functions, function types. */ |
| 127 | #ifndef _GL_ATTRIBUTE_ALLOC_SIZE | 368 | #ifndef _GL_ATTRIBUTE_ALLOC_SIZE |
| 128 | # if _GL_HAS_ATTRIBUTE (alloc_size) | 369 | # if _GL_HAS_ATTRIBUTE (alloc_size) |
| 129 | # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) | 370 | # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) |
| @@ -134,7 +375,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 134 | 375 | ||
| 135 | /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the | 376 | /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the |
| 136 | function and report an error if it cannot do so. */ | 377 | function and report an error if it cannot do so. */ |
| 137 | /* Applies to: function. */ | 378 | /* Applies to: functions. */ |
| 138 | #ifndef _GL_ATTRIBUTE_ALWAYS_INLINE | 379 | #ifndef _GL_ATTRIBUTE_ALWAYS_INLINE |
| 139 | # if _GL_HAS_ATTRIBUTE (always_inline) | 380 | # if _GL_HAS_ATTRIBUTE (always_inline) |
| 140 | # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) | 381 | # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) |
| @@ -146,7 +387,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 146 | /* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show | 387 | /* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show |
| 147 | in stack traces when debugging. The compiler should omit the function from | 388 | in stack traces when debugging. The compiler should omit the function from |
| 148 | stack traces. */ | 389 | stack traces. */ |
| 149 | /* Applies to: function. */ | 390 | /* Applies to: functions. */ |
| 150 | #ifndef _GL_ATTRIBUTE_ARTIFICIAL | 391 | #ifndef _GL_ATTRIBUTE_ARTIFICIAL |
| 151 | # if _GL_HAS_ATTRIBUTE (artificial) | 392 | # if _GL_HAS_ATTRIBUTE (artificial) |
| 152 | # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) | 393 | # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) |
| @@ -172,18 +413,23 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 172 | # endif | 413 | # endif |
| 173 | #endif | 414 | #endif |
| 174 | 415 | ||
| 175 | /* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate | 416 | /* _GL_ATTRIBUTE_CONST declares: |
| 176 | calls to the function with the same arguments. | 417 | It is OK for a compiler to move calls to the function and to omit |
| 177 | This attribute is safe for a function that neither depends on nor affects | 418 | calls to the function if another call has the same arguments or the |
| 178 | observable state, and always returns exactly once - e.g., does not loop | 419 | result is not used. |
| 179 | forever, and does not call longjmp. | 420 | This attribute is safe for a function that neither depends on |
| 180 | (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ | 421 | nor affects state, and always returns exactly once - |
| 422 | e.g., does not raise an exception, call longjmp, or loop forever. | ||
| 423 | (This attribute is stricter than _GL_ATTRIBUTE_PURE because the | ||
| 424 | function cannot observe state. It is stricter than | ||
| 425 | _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly | ||
| 426 | once and cannot depend on state addressed by its arguments.) */ | ||
| 181 | /* Applies to: functions. */ | 427 | /* Applies to: functions. */ |
| 182 | #ifndef _GL_ATTRIBUTE_CONST | 428 | #ifndef _GL_ATTRIBUTE_CONST |
| 183 | # if _GL_HAS_ATTRIBUTE (const) | 429 | # if _GL_HAS_ATTRIBUTE (const) |
| 184 | # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) | 430 | # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) |
| 185 | # else | 431 | # else |
| 186 | # define _GL_ATTRIBUTE_CONST | 432 | # define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED |
| 187 | # endif | 433 | # endif |
| 188 | #endif | 434 | #endif |
| 189 | 435 | ||
| @@ -223,9 +469,11 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 223 | - typedef, | 469 | - typedef, |
| 224 | in C++ also: namespace, class, template specialization. */ | 470 | in C++ also: namespace, class, template specialization. */ |
| 225 | #ifndef _GL_ATTRIBUTE_DEPRECATED | 471 | #ifndef _GL_ATTRIBUTE_DEPRECATED |
| 226 | # ifdef __has_c_attribute | 472 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE |
| 227 | # if __has_c_attribute (__deprecated__) | 473 | # if _GL_HAVE___HAS_C_ATTRIBUTE |
| 228 | # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] | 474 | # if __has_c_attribute (__deprecated__) |
| 475 | # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] | ||
| 476 | # endif | ||
| 229 | # endif | 477 | # endif |
| 230 | # endif | 478 | # endif |
| 231 | # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) | 479 | # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) |
| @@ -271,7 +519,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 271 | /* Applies to: Empty statement (;), inside a 'switch' statement. */ | 519 | /* Applies to: Empty statement (;), inside a 'switch' statement. */ |
| 272 | /* Always expands to something. */ | 520 | /* Always expands to something. */ |
| 273 | #ifndef _GL_ATTRIBUTE_FALLTHROUGH | 521 | #ifndef _GL_ATTRIBUTE_FALLTHROUGH |
| 274 | # ifdef __has_c_attribute | 522 | # if _GL_HAVE___HAS_C_ATTRIBUTE |
| 275 | # if __has_c_attribute (__fallthrough__) | 523 | # if __has_c_attribute (__fallthrough__) |
| 276 | # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] | 524 | # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] |
| 277 | # endif | 525 | # endif |
| @@ -351,11 +599,19 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 351 | in C++ also: class. */ | 599 | in C++ also: class. */ |
| 352 | /* In C++ and C23, this is spelled [[__maybe_unused__]]. | 600 | /* In C++ and C23, this is spelled [[__maybe_unused__]]. |
| 353 | GCC's syntax is __attribute__ ((__unused__)). | 601 | GCC's syntax is __attribute__ ((__unused__)). |
| 354 | clang supports both syntaxes. */ | 602 | clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode, |
| 603 | __has_c_attribute (__maybe_unused__) yields true but the use of | ||
| 604 | [[__maybe_unused__]] nevertheless produces a warning. */ | ||
| 355 | #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | 605 | #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED |
| 356 | # ifdef __has_c_attribute | 606 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE |
| 357 | # if __has_c_attribute (__maybe_unused__) | 607 | # if defined __clang__ && defined __cplusplus |
| 358 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | 608 | # if !defined __apple_build_version__ && __clang_major__ >= 10 |
| 609 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | ||
| 610 | # endif | ||
| 611 | # elif _GL_HAVE___HAS_C_ATTRIBUTE | ||
| 612 | # if __has_c_attribute (__maybe_unused__) | ||
| 613 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | ||
| 614 | # endif | ||
| 359 | # endif | 615 | # endif |
| 360 | # endif | 616 | # endif |
| 361 | # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | 617 | # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED |
| @@ -373,9 +629,20 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 373 | the return value, unless the caller uses something like ignore_value. */ | 629 | the return value, unless the caller uses something like ignore_value. */ |
| 374 | /* Applies to: function, enumeration, class. */ | 630 | /* Applies to: function, enumeration, class. */ |
| 375 | #ifndef _GL_ATTRIBUTE_NODISCARD | 631 | #ifndef _GL_ATTRIBUTE_NODISCARD |
| 376 | # ifdef __has_c_attribute | 632 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE |
| 377 | # if __has_c_attribute (__nodiscard__) | 633 | # if defined __clang__ && defined __cplusplus |
| 378 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | 634 | /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces |
| 635 | a warning. | ||
| 636 | The 1000 below means a yet unknown threshold. When clang++ version X | ||
| 637 | starts supporting [[__nodiscard__]] without warning about it, you can | ||
| 638 | replace the 1000 with X. */ | ||
| 639 | # if __clang_major__ >= 1000 | ||
| 640 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | ||
| 641 | # endif | ||
| 642 | # elif _GL_HAVE___HAS_C_ATTRIBUTE | ||
| 643 | # if __has_c_attribute (__nodiscard__) | ||
| 644 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | ||
| 645 | # endif | ||
| 379 | # endif | 646 | # endif |
| 380 | # endif | 647 | # endif |
| 381 | # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) | 648 | # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) |
| @@ -410,6 +677,17 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 410 | # endif | 677 | # endif |
| 411 | #endif | 678 | #endif |
| 412 | 679 | ||
| 680 | /* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP | ||
| 681 | (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ | ||
| 682 | /* Applies to: functions. */ | ||
| 683 | #ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO | ||
| 684 | # if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero) | ||
| 685 | # define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni))) | ||
| 686 | # else | ||
| 687 | # define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) | ||
| 688 | # endif | ||
| 689 | #endif | ||
| 690 | |||
| 413 | /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is | 691 | /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is |
| 414 | not meant to be NUL-terminated. */ | 692 | not meant to be NUL-terminated. */ |
| 415 | /* Applies to: struct/union members and variables that are arrays of element | 693 | /* Applies to: struct/union members and variables that are arrays of element |
| @@ -427,11 +705,25 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 427 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | 705 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. |
| 428 | */ | 706 | */ |
| 429 | /* Applies to: functions. */ | 707 | /* Applies to: functions. */ |
| 708 | /* After a function's parameter list, this attribute must come first, before | ||
| 709 | other attributes. */ | ||
| 430 | #ifndef _GL_ATTRIBUTE_NOTHROW | 710 | #ifndef _GL_ATTRIBUTE_NOTHROW |
| 431 | # if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus | 711 | # if defined __cplusplus |
| 432 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | 712 | # if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4 |
| 713 | # if __cplusplus >= 201103L | ||
| 714 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
| 715 | # else | ||
| 716 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
| 717 | # endif | ||
| 718 | # else | ||
| 719 | # define _GL_ATTRIBUTE_NOTHROW | ||
| 720 | # endif | ||
| 433 | # else | 721 | # else |
| 434 | # define _GL_ATTRIBUTE_NOTHROW | 722 | # if _GL_HAS_ATTRIBUTE (nothrow) |
| 723 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
| 724 | # else | ||
| 725 | # define _GL_ATTRIBUTE_NOTHROW | ||
| 726 | # endif | ||
| 435 | # endif | 727 | # endif |
| 436 | #endif | 728 | #endif |
| 437 | 729 | ||
| @@ -442,25 +734,60 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 442 | /* Applies to: struct members, struct, union, | 734 | /* Applies to: struct members, struct, union, |
| 443 | in C++ also: class. */ | 735 | in C++ also: class. */ |
| 444 | #ifndef _GL_ATTRIBUTE_PACKED | 736 | #ifndef _GL_ATTRIBUTE_PACKED |
| 445 | # if _GL_HAS_ATTRIBUTE (packed) | 737 | /* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite |
| 738 | __has_attribute OK. */ | ||
| 739 | # if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C | ||
| 446 | # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) | 740 | # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) |
| 447 | # else | 741 | # else |
| 448 | # define _GL_ATTRIBUTE_PACKED | 742 | # define _GL_ATTRIBUTE_PACKED |
| 449 | # endif | 743 | # endif |
| 450 | #endif | 744 | #endif |
| 451 | 745 | ||
| 452 | /* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate | 746 | /* _GL_ATTRIBUTE_PURE declares: |
| 453 | calls to the function with the same arguments if observable state is not | 747 | It is OK for a compiler to move calls to the function and to omit |
| 454 | changed between calls. | 748 | calls to the function if another call has the same arguments or the |
| 455 | This attribute is safe for a function that does not affect | 749 | result is not used, and if observable state is the same. |
| 456 | observable state, and always returns exactly once. | 750 | This attribute is safe for a function that does not affect observable state |
| 457 | (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ | 751 | and always returns exactly once. |
| 752 | (This attribute is looser than _GL_ATTRIBUTE_CONST because the function | ||
| 753 | can depend on observable state. It is stricter than | ||
| 754 | _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly | ||
| 755 | once and cannot affect state addressed by its arguments.) */ | ||
| 458 | /* Applies to: functions. */ | 756 | /* Applies to: functions. */ |
| 459 | #ifndef _GL_ATTRIBUTE_PURE | 757 | #ifndef _GL_ATTRIBUTE_PURE |
| 460 | # if _GL_HAS_ATTRIBUTE (pure) | 758 | # if _GL_HAS_ATTRIBUTE (pure) |
| 461 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | 759 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
| 462 | # else | 760 | # else |
| 463 | # define _GL_ATTRIBUTE_PURE | 761 | # define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE |
| 762 | # endif | ||
| 763 | #endif | ||
| 764 | |||
| 765 | /* _GL_ATTRIBUTE_REPRODUCIBLE declares: | ||
| 766 | It is OK for a compiler to move calls to the function and to omit duplicate | ||
| 767 | calls to the function with the same arguments, so long as the state | ||
| 768 | addressed by its arguments is the same and is updated in time for | ||
| 769 | the rest of the program. | ||
| 770 | This attribute is safe for a function that is effectless and idempotent; see | ||
| 771 | ISO C 23 § 6.7.12.7 for a definition of these terms. | ||
| 772 | (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because | ||
| 773 | the function need not be stateless and idempotent. It is looser | ||
| 774 | than _GL_ATTRIBUTE_PURE because the function need not return | ||
| 775 | exactly once and can affect state addressed by its arguments.) | ||
| 776 | See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and | ||
| 777 | <https://stackoverflow.com/questions/76847905/>. | ||
| 778 | ATTENTION! Efforts are underway to change the meaning of this attribute. | ||
| 779 | See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */ | ||
| 780 | /* Applies to: functions, pointer to functions, function types. */ | ||
| 781 | #ifndef _GL_ATTRIBUTE_REPRODUCIBLE | ||
| 782 | /* This may be revisited when gcc and clang support [[reproducible]] or possibly | ||
| 783 | __attribute__ ((__reproducible__)). */ | ||
| 784 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE | ||
| 785 | # if _GL_HAS_ATTRIBUTE (reproducible) | ||
| 786 | # define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]] | ||
| 787 | # endif | ||
| 788 | # endif | ||
| 789 | # ifndef _GL_ATTRIBUTE_REPRODUCIBLE | ||
| 790 | # define _GL_ATTRIBUTE_REPRODUCIBLE | ||
| 464 | # endif | 791 | # endif |
| 465 | #endif | 792 | #endif |
| 466 | 793 | ||
| @@ -488,6 +815,35 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 488 | # endif | 815 | # endif |
| 489 | #endif | 816 | #endif |
| 490 | 817 | ||
| 818 | /* _GL_ATTRIBUTE_UNSEQUENCED declares: | ||
| 819 | It is OK for a compiler to move calls to the function and to omit duplicate | ||
| 820 | calls to the function with the same arguments, so long as the state | ||
| 821 | addressed by its arguments is the same. | ||
| 822 | This attribute is safe for a function that is effectless, idempotent, | ||
| 823 | stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of | ||
| 824 | these terms. | ||
| 825 | (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because | ||
| 826 | the function must be stateless and independent. It is looser than | ||
| 827 | _GL_ATTRIBUTE_CONST because the function need not return exactly | ||
| 828 | once and can depend on state addressed by its arguments.) | ||
| 829 | See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and | ||
| 830 | <https://stackoverflow.com/questions/76847905/>. | ||
| 831 | ATTENTION! Efforts are underway to change the meaning of this attribute. | ||
| 832 | See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */ | ||
| 833 | /* Applies to: functions, pointer to functions, function types. */ | ||
| 834 | #ifndef _GL_ATTRIBUTE_UNSEQUENCED | ||
| 835 | /* This may be revisited when gcc and clang support [[unsequenced]] or possibly | ||
| 836 | __attribute__ ((__unsequenced__)). */ | ||
| 837 | # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE | ||
| 838 | # if _GL_HAS_ATTRIBUTE (unsequenced) | ||
| 839 | # define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]] | ||
| 840 | # endif | ||
| 841 | # endif | ||
| 842 | # ifndef _GL_ATTRIBUTE_UNSEQUENCED | ||
| 843 | # define _GL_ATTRIBUTE_UNSEQUENCED | ||
| 844 | # endif | ||
| 845 | #endif | ||
| 846 | |||
| 491 | /* A helper macro. Don't use it directly. */ | 847 | /* A helper macro. Don't use it directly. */ |
| 492 | #ifndef _GL_ATTRIBUTE_UNUSED | 848 | #ifndef _GL_ATTRIBUTE_UNUSED |
| 493 | # if _GL_HAS_ATTRIBUTE (unused) | 849 | # if _GL_HAS_ATTRIBUTE (unused) |
| @@ -512,6 +868,47 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 512 | # define _GL_UNUSED_LABEL | 868 | # define _GL_UNUSED_LABEL |
| 513 | # endif | 869 | # endif |
| 514 | #endif | 870 | #endif |
| 871 | |||
| 872 | /* The following attributes enable detection of multithread-safety problems | ||
| 873 | and resource leaks at compile-time, by clang ≥ 15, when the warning option | ||
| 874 | -Wthread-safety is enabled. For usage, see | ||
| 875 | <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */ | ||
| 876 | #ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE | ||
| 877 | # if __clang_major__ >= 15 | ||
| 878 | # define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \ | ||
| 879 | __attribute__ ((__capability__ (concept))) | ||
| 880 | # else | ||
| 881 | # define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) | ||
| 882 | # endif | ||
| 883 | #endif | ||
| 884 | #ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY | ||
| 885 | # if __clang_major__ >= 15 | ||
| 886 | # define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \ | ||
| 887 | __attribute__ ((__acquire_capability__ (resource))) | ||
| 888 | # else | ||
| 889 | # define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) | ||
| 890 | # endif | ||
| 891 | #endif | ||
| 892 | #ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY | ||
| 893 | # if __clang_major__ >= 15 | ||
| 894 | # define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \ | ||
| 895 | __attribute__ ((__release_capability__ (resource))) | ||
| 896 | # else | ||
| 897 | # define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) | ||
| 898 | # endif | ||
| 899 | #endif | ||
| 900 | ]) | ||
| 901 | AH_VERBATIM([c_linkage], | ||
| 902 | [/* In C++, there is the concept of "language linkage", that encompasses | ||
| 903 | name mangling and function calling conventions. | ||
| 904 | The following macros start and end a block of "C" linkage. */ | ||
| 905 | #ifdef __cplusplus | ||
| 906 | # define _GL_BEGIN_C_LINKAGE extern "C" { | ||
| 907 | # define _GL_END_C_LINKAGE } | ||
| 908 | #else | ||
| 909 | # define _GL_BEGIN_C_LINKAGE | ||
| 910 | # define _GL_END_C_LINKAGE | ||
| 911 | #endif | ||
| 515 | ]) | 912 | ]) |
| 516 | AH_VERBATIM([async_safe], | 913 | AH_VERBATIM([async_safe], |
| 517 | [/* The _GL_ASYNC_SAFE marker should be attached to functions that are | 914 | [/* The _GL_ASYNC_SAFE marker should be attached to functions that are |
| @@ -550,8 +947,8 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 550 | -1 if n1 < n2 | 947 | -1 if n1 < n2 |
| 551 | The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional | 948 | The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional |
| 552 | jump with nearly all GCC versions up to GCC 10. | 949 | jump with nearly all GCC versions up to GCC 10. |
| 553 | This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many | 950 | This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with |
| 554 | GCC versions up to GCC 9. | 951 | many GCC versions up to GCC 9. |
| 555 | The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 | 952 | The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 |
| 556 | avoids conditional jumps in all GCC versions >= 3.4. */ | 953 | avoids conditional jumps in all GCC versions >= 3.4. */ |
| 557 | #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) | 954 | #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) |
| @@ -568,7 +965,7 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
| 568 | dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), | 965 | dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), |
| 569 | dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). | 966 | dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). |
| 570 | AC_ARG_ENABLE([cross-guesses], | 967 | AC_ARG_ENABLE([cross-guesses], |
| 571 | [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], | 968 | [AS_HELP_STRING([[--enable-cross-guesses={conservative|risky}]], |
| 572 | [specify policy for cross-compilation guesses])], | 969 | [specify policy for cross-compilation guesses])], |
| 573 | [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then | 970 | [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then |
| 574 | AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) | 971 | AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) |
| @@ -928,7 +1325,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS], | |||
| 928 | AC_REQUIRE([AC_PROG_CC]) | 1325 | AC_REQUIRE([AC_PROG_CC]) |
| 929 | AC_CACHE_CHECK([for C compiler option to allow warnings], | 1326 | AC_CACHE_CHECK([for C compiler option to allow warnings], |
| 930 | [gl_cv_cc_wallow], | 1327 | [gl_cv_cc_wallow], |
| 931 | [rm -f conftest* | 1328 | [rm -fr conftest* |
| 932 | echo 'int dummy;' > conftest.c | 1329 | echo 'int dummy;' > conftest.c |
| 933 | AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null | 1330 | AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null |
| 934 | AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null | 1331 | AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null |
| @@ -941,7 +1338,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS], | |||
| 941 | else | 1338 | else |
| 942 | gl_cv_cc_wallow=none | 1339 | gl_cv_cc_wallow=none |
| 943 | fi | 1340 | fi |
| 944 | rm -f conftest* | 1341 | rm -fr conftest* |
| 945 | ]) | 1342 | ]) |
| 946 | case "$gl_cv_cc_wallow" in | 1343 | case "$gl_cv_cc_wallow" in |
| 947 | none) GL_CFLAG_ALLOW_WARNINGS='' ;; | 1344 | none) GL_CFLAG_ALLOW_WARNINGS='' ;; |
| @@ -959,7 +1356,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS], | |||
| 959 | if test -n "$CXX" && test "$CXX" != no; then | 1356 | if test -n "$CXX" && test "$CXX" != no; then |
| 960 | AC_CACHE_CHECK([for C++ compiler option to allow warnings], | 1357 | AC_CACHE_CHECK([for C++ compiler option to allow warnings], |
| 961 | [gl_cv_cxx_wallow], | 1358 | [gl_cv_cxx_wallow], |
| 962 | [rm -f conftest* | 1359 | [rm -fr conftest* |
| 963 | echo 'int dummy;' > conftest.cc | 1360 | echo 'int dummy;' > conftest.cc |
| 964 | AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null | 1361 | AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null |
| 965 | AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null | 1362 | AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null |
| @@ -972,7 +1369,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS], | |||
| 972 | else | 1369 | else |
| 973 | gl_cv_cxx_wallow=none | 1370 | gl_cv_cxx_wallow=none |
| 974 | fi | 1371 | fi |
| 975 | rm -f conftest* | 1372 | rm -fr conftest* |
| 976 | ]) | 1373 | ]) |
| 977 | case "$gl_cv_cxx_wallow" in | 1374 | case "$gl_cv_cxx_wallow" in |
| 978 | none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; | 1375 | none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; |
| @@ -1005,14 +1402,16 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], | |||
| 1005 | dnl -Wno-pedantic >= 4.8 >= 3.9 | 1402 | dnl -Wno-pedantic >= 4.8 >= 3.9 |
| 1006 | dnl -Wno-sign-compare >= 3 >= 3.9 | 1403 | dnl -Wno-sign-compare >= 3 >= 3.9 |
| 1007 | dnl -Wno-sign-conversion >= 4.3 >= 3.9 | 1404 | dnl -Wno-sign-conversion >= 4.3 >= 3.9 |
| 1405 | dnl -Wno-tautological-out-of-range-compare - >= 3.9 | ||
| 1008 | dnl -Wno-type-limits >= 4.3 >= 3.9 | 1406 | dnl -Wno-type-limits >= 4.3 >= 3.9 |
| 1009 | dnl -Wno-undef >= 3 >= 3.9 | 1407 | dnl -Wno-undef >= 3 >= 3.9 |
| 1010 | dnl -Wno-unsuffixed-float-constants >= 4.5 | 1408 | dnl -Wno-unsuffixed-float-constants >= 4.5 |
| 1409 | dnl -Wno-unused-const-variable >= 4.4 >= 3.9 | ||
| 1011 | dnl -Wno-unused-function >= 3 >= 3.9 | 1410 | dnl -Wno-unused-function >= 3 >= 3.9 |
| 1012 | dnl -Wno-unused-parameter >= 3 >= 3.9 | 1411 | dnl -Wno-unused-parameter >= 3 >= 3.9 |
| 1013 | dnl | 1412 | dnl |
| 1014 | cat > conftest.c <<\EOF | 1413 | cat > conftest.c <<\EOF |
| 1015 | #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1414 | #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
| 1016 | -Wno-cast-qual | 1415 | -Wno-cast-qual |
| 1017 | -Wno-conversion | 1416 | -Wno-conversion |
| 1018 | -Wno-float-equal | 1417 | -Wno-float-equal |
| @@ -1021,20 +1420,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], | |||
| 1021 | -Wno-unused-function | 1420 | -Wno-unused-function |
| 1022 | -Wno-unused-parameter | 1421 | -Wno-unused-parameter |
| 1023 | #endif | 1422 | #endif |
| 1024 | #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1423 | #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
| 1025 | -Wno-float-conversion | 1424 | -Wno-float-conversion |
| 1026 | #endif | 1425 | #endif |
| 1027 | #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1426 | #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
| 1028 | -Wimplicit-fallthrough | 1427 | -Wimplicit-fallthrough |
| 1029 | #endif | 1428 | #endif |
| 1030 | #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1429 | #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
| 1031 | -Wno-pedantic | 1430 | -Wno-pedantic |
| 1032 | #endif | 1431 | #endif |
| 1033 | #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | 1432 | #if 3 < __clang_major__ + (9 <= __clang_minor__) |
| 1433 | -Wno-tautological-constant-out-of-range-compare | ||
| 1434 | #endif | ||
| 1435 | #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) | ||
| 1034 | -Wno-sign-conversion | 1436 | -Wno-sign-conversion |
| 1035 | -Wno-type-limits | 1437 | -Wno-type-limits |
| 1036 | #endif | 1438 | #endif |
| 1037 | #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 | 1439 | #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) |
| 1440 | -Wno-unused-const-variable | ||
| 1441 | #endif | ||
| 1442 | #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__) | ||
| 1038 | -Wno-unsuffixed-float-constants | 1443 | -Wno-unsuffixed-float-constants |
| 1039 | #endif | 1444 | #endif |
| 1040 | EOF | 1445 | EOF |
| @@ -1080,6 +1485,250 @@ AC_DEFUN([gl_CONDITIONAL_HEADER], | |||
| 1080 | m4_popdef([gl_header_name]) | 1485 | m4_popdef([gl_header_name]) |
| 1081 | ]) | 1486 | ]) |
| 1082 | 1487 | ||
| 1488 | dnl Preparations for gl_CHECK_FUNCS_MACOS. | ||
| 1489 | AC_DEFUN([gl_PREPARE_CHECK_FUNCS_MACOS], | ||
| 1490 | [ | ||
| 1491 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 1492 | AC_REQUIRE([gl_COMPILER_CLANG]) | ||
| 1493 | AC_CACHE_CHECK([for compiler option needed when checking for future declarations], | ||
| 1494 | [gl_cv_compiler_check_future_option], | ||
| 1495 | [case "$host_os" in | ||
| 1496 | dnl This is only needed on macOS. | ||
| 1497 | darwin*) | ||
| 1498 | if test $gl_cv_compiler_clang = yes; then | ||
| 1499 | dnl Test whether the compiler supports the option | ||
| 1500 | dnl '-Werror=unguarded-availability-new'. | ||
| 1501 | saved_ac_compile="$ac_compile" | ||
| 1502 | ac_compile="$ac_compile -Werror=unguarded-availability-new" | ||
| 1503 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], | ||
| 1504 | [gl_cv_compiler_check_future_option='-Werror=unguarded-availability-new'], | ||
| 1505 | [gl_cv_compiler_check_future_option=none]) | ||
| 1506 | ac_compile="$saved_ac_compile" | ||
| 1507 | else | ||
| 1508 | gl_cv_compiler_check_future_option=none | ||
| 1509 | fi | ||
| 1510 | ;; | ||
| 1511 | *) gl_cv_compiler_check_future_option=none ;; | ||
| 1512 | esac | ||
| 1513 | ]) | ||
| 1514 | ]) | ||
| 1515 | |||
| 1516 | dnl Pieces of the expansion of | ||
| 1517 | dnl gl_CHECK_FUNCS_ANDROID | ||
| 1518 | dnl gl_CHECK_FUNCS_MACOS | ||
| 1519 | dnl gl_CHECK_FUNCS_ANDROID_MACOS | ||
| 1520 | |||
| 1521 | AC_DEFUN([gl_CHECK_FUNCS_DEFAULT_CASE], | ||
| 1522 | [ | ||
| 1523 | *) | ||
| 1524 | AC_CHECK_FUNC([$1]) | ||
| 1525 | [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1] | ||
| 1526 | ;; | ||
| 1527 | ]) | ||
| 1528 | |||
| 1529 | AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_ANDROID], | ||
| 1530 | [ | ||
| 1531 | linux*-android*) | ||
| 1532 | AC_CHECK_DECL([$1], , , [$2]) | ||
| 1533 | if test $[ac_cv_have_decl_][$1] = yes; then | ||
| 1534 | AC_CHECK_FUNC([[$1]]) | ||
| 1535 | if test $[ac_cv_func_][$1] = yes; then | ||
| 1536 | [gl_cv_onwards_func_][$1]=yes | ||
| 1537 | else | ||
| 1538 | dnl The function is declared but does not exist. This should not | ||
| 1539 | dnl happen normally. But anyway, we know that a future version | ||
| 1540 | dnl of Android will have the function. | ||
| 1541 | [gl_cv_onwards_func_][$1]='future OS version' | ||
| 1542 | fi | ||
| 1543 | else | ||
| 1544 | [gl_cv_onwards_func_][$1]='future OS version' | ||
| 1545 | fi | ||
| 1546 | ;; | ||
| 1547 | ]) | ||
| 1548 | |||
| 1549 | AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS], | ||
| 1550 | [ | ||
| 1551 | darwin*) | ||
| 1552 | if test "x$gl_cv_compiler_check_future_option" != "xnone"; then | ||
| 1553 | dnl Use a compile test, not a link test. | ||
| 1554 | saved_ac_compile="$ac_compile" | ||
| 1555 | ac_compile="$ac_compile $gl_cv_compiler_check_future_option" | ||
| 1556 | saved_ac_compile_for_check_decl="$ac_compile_for_check_decl" | ||
| 1557 | ac_compile_for_check_decl="$ac_compile_for_check_decl $gl_cv_compiler_check_future_option" | ||
| 1558 | unset [ac_cv_have_decl_][$1] | ||
| 1559 | AC_CHECK_DECL([$1], , , [$2]) | ||
| 1560 | ac_compile="$saved_ac_compile" | ||
| 1561 | ac_compile_for_check_decl="$saved_ac_compile_for_check_decl" | ||
| 1562 | [ac_cv_func_][$1]="$[ac_cv_have_decl_][$1]" | ||
| 1563 | if test $[ac_cv_func_][$1] = yes; then | ||
| 1564 | [gl_cv_onwards_func_][$1]=yes | ||
| 1565 | else | ||
| 1566 | dnl This is a bit complicated, because here we need the behaviour | ||
| 1567 | dnl of AC_CHECK_DECL before the | ||
| 1568 | dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26). | ||
| 1569 | [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]" | ||
| 1570 | unset [ac_cv_have_decl_][$1] | ||
| 1571 | ac_c_future_darwin_options_saved="$ac_c_future_darwin_options" | ||
| 1572 | ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options" | ||
| 1573 | ac_c_future_darwin_options= | ||
| 1574 | ac_cxx_future_darwin_options= | ||
| 1575 | AC_CHECK_DECL([$1], , , [$2]) | ||
| 1576 | ac_c_future_darwin_options="$ac_c_future_darwin_options_saved" | ||
| 1577 | ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved" | ||
| 1578 | if test $[ac_cv_have_decl_][$1] = yes; then | ||
| 1579 | [gl_cv_onwards_func_][$1]='future OS version' | ||
| 1580 | else | ||
| 1581 | [gl_cv_onwards_func_][$1]=no | ||
| 1582 | fi | ||
| 1583 | [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]" | ||
| 1584 | unset [ac_cv_have_decl_][$1][_saved] | ||
| 1585 | fi | ||
| 1586 | else | ||
| 1587 | AC_CHECK_FUNC([$1]) | ||
| 1588 | [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1] | ||
| 1589 | fi | ||
| 1590 | ;; | ||
| 1591 | ]) | ||
| 1592 | |||
| 1593 | AC_DEFUN([gl_CHECK_FUNCS_SET_RESULTS], | ||
| 1594 | [ | ||
| 1595 | case "$[gl_cv_onwards_func_][$1]" in | ||
| 1596 | future*) [ac_cv_func_][$1]=no ;; | ||
| 1597 | *) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;; | ||
| 1598 | esac | ||
| 1599 | if test $[ac_cv_func_][$1] = yes; then | ||
| 1600 | AC_DEFINE([HAVE_]m4_translit([[$1]], | ||
| 1601 | [abcdefghijklmnopqrstuvwxyz], | ||
| 1602 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ]), | ||
| 1603 | [1], [Define to 1 if you have the `$1' function.]) | ||
| 1604 | fi | ||
| 1605 | ]) | ||
| 1606 | |||
| 1607 | dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) | ||
| 1608 | dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem | ||
| 1609 | dnl on Android. | ||
| 1610 | dnl | ||
| 1611 | dnl When code is compiled on Android, it is in the context of a certain | ||
| 1612 | dnl "Android API level", which indicates the minimum version of Android on | ||
| 1613 | dnl which the app can be installed. In other words, you don't compile for a | ||
| 1614 | dnl specific version of Android. You compile for all versions of Android, | ||
| 1615 | dnl onwards from the given API level. | ||
| 1616 | dnl Thus, the question "does the OS have the function func" has three possible | ||
| 1617 | dnl answers: | ||
| 1618 | dnl - yes, in all versions starting from the given API level, | ||
| 1619 | dnl - no, in no version, | ||
| 1620 | dnl - not in the given API level, but in a later version of Android. | ||
| 1621 | dnl | ||
| 1622 | dnl In detail, this works as follows: | ||
| 1623 | dnl If func was added to Android API level, say, 28, then the libc.so has the | ||
| 1624 | dnl symbol func always, whereas the header file <foo.h> declares func | ||
| 1625 | dnl conditionally: | ||
| 1626 | dnl #if __ANDROID_API__ >= 28 | ||
| 1627 | dnl ... func (...) __INTRODUCED_IN(28); | ||
| 1628 | dnl #endif | ||
| 1629 | dnl Thus, when compiling with "clang -target armv7a-unknown-linux-android28", | ||
| 1630 | dnl the function func is declared and exists in libc. | ||
| 1631 | dnl Whereas when compiling with "clang -target armv7a-unknown-linux-android27", | ||
| 1632 | dnl the function func is not declared but exists in libc. | ||
| 1633 | dnl | ||
| 1634 | dnl This macro sets two variables: | ||
| 1635 | dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" | ||
| 1636 | dnl - ac_cv_func_<func> to yes / no / no | ||
| 1637 | dnl The first variable allows distinguishing all three cases. | ||
| 1638 | dnl The second variable is set, so that an invocation | ||
| 1639 | dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) | ||
| 1640 | dnl can be used as a drop-in replacement for | ||
| 1641 | dnl AC_CHECK_FUNCS([func]). | ||
| 1642 | AC_DEFUN([gl_CHECK_FUNCS_ANDROID], | ||
| 1643 | [ | ||
| 1644 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 1645 | AC_CACHE_CHECK([for [$1]], | ||
| 1646 | [[gl_cv_onwards_func_][$1]], | ||
| 1647 | [gl_SILENT([ | ||
| 1648 | case "$host_os" in | ||
| 1649 | gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2]) | ||
| 1650 | gl_CHECK_FUNCS_DEFAULT_CASE([$1]) | ||
| 1651 | esac | ||
| 1652 | ]) | ||
| 1653 | ]) | ||
| 1654 | gl_CHECK_FUNCS_SET_RESULTS([$1]) | ||
| 1655 | ]) | ||
| 1656 | |||
| 1657 | dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) | ||
| 1658 | dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem | ||
| 1659 | dnl on macOS. | ||
| 1660 | dnl | ||
| 1661 | dnl When code is compiled on macOS, it is in the context of a certain minimum | ||
| 1662 | dnl macOS version, that can be set through the option '-mmacosx-version-min='. | ||
| 1663 | dnl In other words, you don't compile for a specific version of macOS. You | ||
| 1664 | dnl compile for all versions of macOS, onwards from the given version. | ||
| 1665 | dnl Thus, the question "does the OS have the function func" has three possible | ||
| 1666 | dnl answers: | ||
| 1667 | dnl - yes, in all versions starting from the given version, | ||
| 1668 | dnl - no, in no version, | ||
| 1669 | dnl - not in the given version, but in a later version of macOS. | ||
| 1670 | dnl | ||
| 1671 | dnl In detail, this works as follows: | ||
| 1672 | dnl If func was added to, say, macOS version 13, then the libc has the | ||
| 1673 | dnl symbol func always, whereas the header file <foo.h> declares func | ||
| 1674 | dnl conditionally with a special availability attribute: | ||
| 1675 | dnl ... func (...) __attribute__((availability(macos,introduced=13.0))); | ||
| 1676 | dnl Thus, when compiling with "clang mmacosx-version-min=13", there is no | ||
| 1677 | dnl warning about the use of func, and the resulting binary | ||
| 1678 | dnl - runs fine on macOS 13, | ||
| 1679 | dnl - aborts with a dyld "Symbol not found" message on macOS 12. | ||
| 1680 | dnl Whereas, when compiling with "clang mmacosx-version-min=12", there is a | ||
| 1681 | dnl warning: 'func' is only available on macOS 13.0 or newer | ||
| 1682 | dnl [-Wunguarded-availability-new], | ||
| 1683 | dnl and the resulting binary | ||
| 1684 | dnl - runs fine on macOS 13, | ||
| 1685 | dnl - crashes with a SIGSEGV (signal 11) on macOS 12. | ||
| 1686 | dnl | ||
| 1687 | dnl This macro sets two variables: | ||
| 1688 | dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" | ||
| 1689 | dnl - ac_cv_func_<func> to yes / no / no | ||
| 1690 | dnl The first variable allows distinguishing all three cases. | ||
| 1691 | dnl The second variable is set, so that an invocation | ||
| 1692 | dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) | ||
| 1693 | dnl can be used as a drop-in replacement for | ||
| 1694 | dnl AC_CHECK_FUNCS([func]). | ||
| 1695 | AC_DEFUN([gl_CHECK_FUNCS_MACOS], | ||
| 1696 | [ | ||
| 1697 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 1698 | AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS]) | ||
| 1699 | AC_CACHE_CHECK([for [$1]], | ||
| 1700 | [[gl_cv_onwards_func_][$1]], | ||
| 1701 | [gl_SILENT([ | ||
| 1702 | case "$host_os" in | ||
| 1703 | gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2]) | ||
| 1704 | gl_CHECK_FUNCS_DEFAULT_CASE([$1]) | ||
| 1705 | esac | ||
| 1706 | ]) | ||
| 1707 | ]) | ||
| 1708 | gl_CHECK_FUNCS_SET_RESULTS([$1]) | ||
| 1709 | ]) | ||
| 1710 | |||
| 1711 | dnl gl_CHECK_FUNCS_ANDROID_MACOS([func], [[#include <foo.h>]]) | ||
| 1712 | dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem | ||
| 1713 | dnl on Android and on macOS. | ||
| 1714 | dnl It is the combination of gl_CHECK_FUNCS_ANDROID and gl_CHECK_FUNCS_MACOS. | ||
| 1715 | AC_DEFUN([gl_CHECK_FUNCS_ANDROID_MACOS], | ||
| 1716 | [ | ||
| 1717 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 1718 | AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS]) | ||
| 1719 | AC_CACHE_CHECK([for [$1]], | ||
| 1720 | [[gl_cv_onwards_func_][$1]], | ||
| 1721 | [gl_SILENT([ | ||
| 1722 | case "$host_os" in | ||
| 1723 | gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2]) | ||
| 1724 | gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2]) | ||
| 1725 | gl_CHECK_FUNCS_DEFAULT_CASE([$1]) | ||
| 1726 | esac | ||
| 1727 | ]) | ||
| 1728 | ]) | ||
| 1729 | gl_CHECK_FUNCS_SET_RESULTS([$1]) | ||
| 1730 | ]) | ||
| 1731 | |||
| 1083 | dnl Expands to some code for use in .c programs that, on native Windows, defines | 1732 | dnl Expands to some code for use in .c programs that, on native Windows, defines |
| 1084 | dnl the Microsoft deprecated alias function names to the underscore-prefixed | 1733 | dnl the Microsoft deprecated alias function names to the underscore-prefixed |
| 1085 | dnl actual function names. With this macro, these function names are available | 1734 | dnl actual function names. With this macro, these function names are available |
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 4764622e..50e98454 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # DO NOT EDIT! GENERATED AUTOMATICALLY! | 1 | # DO NOT EDIT! GENERATED AUTOMATICALLY! |
| 2 | # Copyright (C) 2002-2023 Free Software Foundation, Inc. | 2 | # Copyright (C) 2002-2025 Free Software Foundation, Inc. |
| 3 | # | 3 | # |
| 4 | # This file is free software; you can redistribute it and/or modify | 4 | # This file is free software; you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
| @@ -43,15 +43,32 @@ AC_DEFUN([gl_EARLY], | |||
| 43 | AC_REQUIRE([gl_PROG_AR_RANLIB]) | 43 | AC_REQUIRE([gl_PROG_AR_RANLIB]) |
| 44 | 44 | ||
| 45 | # Code from module absolute-header: | 45 | # Code from module absolute-header: |
| 46 | # Code from module alignasof: | ||
| 46 | # Code from module alloca-opt: | 47 | # Code from module alloca-opt: |
| 47 | # Code from module arpa_inet: | 48 | # Code from module arpa_inet-h: |
| 48 | # Code from module assert-h: | 49 | # Code from module assert-h: |
| 49 | # Code from module attribute: | 50 | # Code from module attribute: |
| 50 | # Code from module base64: | 51 | # Code from module base64: |
| 51 | # Code from module basename-lgpl: | 52 | # Code from module basename-lgpl: |
| 53 | # Code from module bool: | ||
| 52 | # Code from module btowc: | 54 | # Code from module btowc: |
| 53 | # Code from module builtin-expect: | 55 | # Code from module builtin-expect: |
| 54 | # Code from module byteswap: | 56 | # Code from module byteswap: |
| 57 | # Code from module c-ctype: | ||
| 58 | # Code from module c32isalnum: | ||
| 59 | # Code from module c32isalpha: | ||
| 60 | # Code from module c32isblank: | ||
| 61 | # Code from module c32iscntrl: | ||
| 62 | # Code from module c32isdigit: | ||
| 63 | # Code from module c32isgraph: | ||
| 64 | # Code from module c32islower: | ||
| 65 | # Code from module c32isprint: | ||
| 66 | # Code from module c32ispunct: | ||
| 67 | # Code from module c32isspace: | ||
| 68 | # Code from module c32isupper: | ||
| 69 | # Code from module c32isxdigit: | ||
| 70 | # Code from module c32tolower: | ||
| 71 | # Code from module c32width: | ||
| 55 | # Code from module c99: | 72 | # Code from module c99: |
| 56 | # Code from module calloc-gnu: | 73 | # Code from module calloc-gnu: |
| 57 | # Code from module calloc-posix: | 74 | # Code from module calloc-posix: |
| @@ -65,10 +82,15 @@ AC_DEFUN([gl_EARLY], | |||
| 65 | # Code from module double-slash-root: | 82 | # Code from module double-slash-root: |
| 66 | # Code from module dup2: | 83 | # Code from module dup2: |
| 67 | # Code from module environ: | 84 | # Code from module environ: |
| 68 | # Code from module errno: | 85 | # Code from module errno-h: |
| 69 | # Code from module error: | 86 | # Code from module error: |
| 87 | # Code from module error-h: | ||
| 70 | # Code from module exitfail: | 88 | # Code from module exitfail: |
| 71 | # Code from module extensions: | 89 | # Code from module extensions: |
| 90 | # This is actually already done in the pre-early phase. | ||
| 91 | # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 92 | # Code from module extensions-aix: | ||
| 93 | AC_REQUIRE([gl_USE_AIX_EXTENSIONS]) | ||
| 72 | # Code from module extern-inline: | 94 | # Code from module extern-inline: |
| 73 | # Code from module fcntl: | 95 | # Code from module fcntl: |
| 74 | # Code from module fcntl-h: | 96 | # Code from module fcntl-h: |
| @@ -76,7 +98,7 @@ AC_DEFUN([gl_EARLY], | |||
| 76 | # Code from module fflush: | 98 | # Code from module fflush: |
| 77 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) | 99 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) |
| 78 | # Code from module filename: | 100 | # Code from module filename: |
| 79 | # Code from module float: | 101 | # Code from module float-h: |
| 80 | # Code from module floorf: | 102 | # Code from module floorf: |
| 81 | # Code from module fopen: | 103 | # Code from module fopen: |
| 82 | # Code from module fopen-gnu: | 104 | # Code from module fopen-gnu: |
| @@ -86,6 +108,7 @@ AC_DEFUN([gl_EARLY], | |||
| 86 | # Code from module fseek: | 108 | # Code from module fseek: |
| 87 | # Code from module fseeko: | 109 | # Code from module fseeko: |
| 88 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) | 110 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) |
| 111 | # Code from module fseterr: | ||
| 89 | # Code from module fstat: | 112 | # Code from module fstat: |
| 90 | # Code from module fsusage: | 113 | # Code from module fsusage: |
| 91 | # Code from module ftell: | 114 | # Code from module ftell: |
| @@ -103,6 +126,7 @@ AC_DEFUN([gl_EARLY], | |||
| 103 | # Code from module getprogname: | 126 | # Code from module getprogname: |
| 104 | # Code from module gettext-h: | 127 | # Code from module gettext-h: |
| 105 | # Code from module glibc-internal/dynarray: | 128 | # Code from module glibc-internal/dynarray: |
| 129 | # Code from module gnulib-i18n: | ||
| 106 | # Code from module hard-locale: | 130 | # Code from module hard-locale: |
| 107 | # Code from module hostent: | 131 | # Code from module hostent: |
| 108 | # Code from module ialloc: | 132 | # Code from module ialloc: |
| @@ -110,24 +134,36 @@ AC_DEFUN([gl_EARLY], | |||
| 110 | # Code from module idx: | 134 | # Code from module idx: |
| 111 | # Code from module include_next: | 135 | # Code from module include_next: |
| 112 | # Code from module inet_ntop: | 136 | # Code from module inet_ntop: |
| 137 | # Code from module inet_pton: | ||
| 113 | # Code from module intprops: | 138 | # Code from module intprops: |
| 114 | # Code from module inttypes-incomplete: | 139 | # Code from module inttypes-h-incomplete: |
| 115 | # Code from module langinfo: | 140 | # Code from module iswblank: |
| 141 | # Code from module iswctype: | ||
| 142 | # Code from module iswdigit: | ||
| 143 | # Code from module iswpunct: | ||
| 144 | # Code from module iswxdigit: | ||
| 145 | # Code from module langinfo-h: | ||
| 116 | # Code from module largefile: | 146 | # Code from module largefile: |
| 117 | AC_REQUIRE([AC_SYS_LARGEFILE]) | 147 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
| 118 | # Code from module libc-config: | 148 | # Code from module libc-config: |
| 119 | # Code from module limits-h: | 149 | # Code from module limits-h: |
| 120 | # Code from module localcharset: | 150 | # Code from module localcharset: |
| 121 | # Code from module locale: | 151 | # Code from module locale-h: |
| 122 | # Code from module localeconv: | 152 | # Code from module localeconv: |
| 123 | # Code from module lock: | 153 | # Code from module lock: |
| 124 | # Code from module lseek: | 154 | # Code from module lseek: |
| 155 | # Code from module lstat: | ||
| 125 | # Code from module malloc-gnu: | 156 | # Code from module malloc-gnu: |
| 126 | # Code from module malloc-posix: | 157 | # Code from module malloc-posix: |
| 127 | # Code from module malloca: | 158 | # Code from module malloca: |
| 128 | # Code from module math: | 159 | # Code from module math-h: |
| 160 | # Code from module mbchar: | ||
| 161 | # Code from module mbiterf: | ||
| 162 | # Code from module mbrtoc32: | ||
| 129 | # Code from module mbrtowc: | 163 | # Code from module mbrtowc: |
| 130 | # Code from module mbsinit: | 164 | # Code from module mbsinit: |
| 165 | # Code from module mbsnlen: | ||
| 166 | # Code from module mbszero: | ||
| 131 | # Code from module mbtowc: | 167 | # Code from module mbtowc: |
| 132 | # Code from module memchr: | 168 | # Code from module memchr: |
| 133 | # Code from module minmax: | 169 | # Code from module minmax: |
| @@ -137,19 +173,24 @@ AC_DEFUN([gl_EARLY], | |||
| 137 | # Code from module msvc-inval: | 173 | # Code from module msvc-inval: |
| 138 | # Code from module msvc-nothrow: | 174 | # Code from module msvc-nothrow: |
| 139 | # Code from module multiarch: | 175 | # Code from module multiarch: |
| 140 | # Code from module netdb: | 176 | # Code from module netdb-h: |
| 141 | # Code from module netinet_in: | 177 | # Code from module netinet_in-h: |
| 142 | # Code from module nl_langinfo: | 178 | # Code from module nl_langinfo: |
| 143 | # Code from module nocrash: | 179 | # Code from module nocrash: |
| 180 | # Code from module once: | ||
| 144 | # Code from module open: | 181 | # Code from module open: |
| 145 | # Code from module pathmax: | 182 | # Code from module pathmax: |
| 146 | # Code from module realloc-gnu: | 183 | # Code from module pthread-h: |
| 184 | gl_ANYTHREADLIB_EARLY | ||
| 185 | # Code from module pthread-once: | ||
| 147 | # Code from module realloc-posix: | 186 | # Code from module realloc-posix: |
| 148 | # Code from module reallocarray: | 187 | # Code from module reallocarray: |
| 149 | # Code from module regex: | 188 | # Code from module regex: |
| 189 | # Code from module sched-h: | ||
| 150 | # Code from module servent: | 190 | # Code from module servent: |
| 151 | # Code from module setenv: | 191 | # Code from module setenv: |
| 152 | # Code from module setlocale-null: | 192 | # Code from module setlocale-null: |
| 193 | # Code from module setlocale-null-unlocked: | ||
| 153 | # Code from module size_max: | 194 | # Code from module size_max: |
| 154 | # Code from module snippet/_Noreturn: | 195 | # Code from module snippet/_Noreturn: |
| 155 | # Code from module snippet/arg-nonnull: | 196 | # Code from module snippet/arg-nonnull: |
| @@ -163,33 +204,56 @@ AC_DEFUN([gl_EARLY], | |||
| 163 | # Code from module stat: | 204 | # Code from module stat: |
| 164 | # Code from module stat-time: | 205 | # Code from module stat-time: |
| 165 | # Code from module std-gnu11: | 206 | # Code from module std-gnu11: |
| 166 | # Code from module stdalign: | 207 | # Code from module stdckdint-h: |
| 167 | # Code from module stdbool: | 208 | # Code from module stddef-h: |
| 168 | # Code from module stdckdint: | 209 | # Code from module stdint-h: |
| 169 | # Code from module stddef: | 210 | # Code from module stdio-h: |
| 170 | # Code from module stdint: | 211 | gl_STDIO_H_EARLY |
| 171 | # Code from module stdio: | 212 | # Code from module stdlib-h: |
| 172 | # Code from module stdlib: | ||
| 173 | # Code from module strcase: | 213 | # Code from module strcase: |
| 214 | # Code from module strcasecmp: | ||
| 174 | # Code from module strcasestr: | 215 | # Code from module strcasestr: |
| 175 | # Code from module strcasestr-simple: | 216 | # Code from module strcasestr-simple: |
| 176 | # Code from module streq: | 217 | # Code from module streq: |
| 177 | # Code from module strerror: | 218 | # Code from module strerror: |
| 178 | # Code from module strerror-override: | 219 | # Code from module strerror-override: |
| 179 | # Code from module string: | 220 | # Code from module string-h: |
| 180 | # Code from module strings: | 221 | # Code from module strings-h: |
| 222 | # Code from module strncasecmp: | ||
| 223 | # Code from module strncpy: | ||
| 181 | # Code from module strsep: | 224 | # Code from module strsep: |
| 182 | # Code from module strstr-simple: | 225 | # Code from module strstr-simple: |
| 183 | # Code from module sys_socket: | 226 | # Code from module sys_socket-h: |
| 184 | # Code from module sys_stat: | 227 | # Code from module sys_stat-h: |
| 185 | # Code from module sys_types: | 228 | # Code from module sys_types-h: |
| 186 | # Code from module sys_uio: | 229 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
| 230 | # Code from module sys_uio-h: | ||
| 187 | # Code from module threadlib: | 231 | # Code from module threadlib: |
| 188 | gl_THREADLIB_EARLY | 232 | gl_THREADLIB_EARLY |
| 189 | # Code from module time: | 233 | # Code from module time-h: |
| 190 | # Code from module time_r: | 234 | # Code from module time_r: |
| 191 | # Code from module timegm: | 235 | # Code from module timegm: |
| 192 | # Code from module unistd: | 236 | # Code from module uchar-h: |
| 237 | # Code from module unicase/base: | ||
| 238 | # Code from module unicase/tolower: | ||
| 239 | # Code from module unictype/base: | ||
| 240 | # Code from module unictype/ctype-alnum: | ||
| 241 | # Code from module unictype/ctype-alpha: | ||
| 242 | # Code from module unictype/ctype-blank: | ||
| 243 | # Code from module unictype/ctype-cntrl: | ||
| 244 | # Code from module unictype/ctype-digit: | ||
| 245 | # Code from module unictype/ctype-graph: | ||
| 246 | # Code from module unictype/ctype-lower: | ||
| 247 | # Code from module unictype/ctype-print: | ||
| 248 | # Code from module unictype/ctype-punct: | ||
| 249 | # Code from module unictype/ctype-space: | ||
| 250 | # Code from module unictype/ctype-upper: | ||
| 251 | # Code from module unictype/ctype-xdigit: | ||
| 252 | # Code from module uninorm/base: | ||
| 253 | # Code from module unistd-h: | ||
| 254 | # Code from module unitypes-h: | ||
| 255 | # Code from module uniwidth/base: | ||
| 256 | # Code from module uniwidth/width: | ||
| 193 | # Code from module unlocked-io-internal: | 257 | # Code from module unlocked-io-internal: |
| 194 | # Code from module unsetenv: | 258 | # Code from module unsetenv: |
| 195 | # Code from module vararrays: | 259 | # Code from module vararrays: |
| @@ -197,9 +261,12 @@ AC_DEFUN([gl_EARLY], | |||
| 197 | # Code from module vasprintf: | 261 | # Code from module vasprintf: |
| 198 | # Code from module verify: | 262 | # Code from module verify: |
| 199 | # Code from module vsnprintf: | 263 | # Code from module vsnprintf: |
| 200 | # Code from module wchar: | 264 | # Code from module vsnzprintf: |
| 265 | # Code from module wchar-h: | ||
| 201 | # Code from module wcrtomb: | 266 | # Code from module wcrtomb: |
| 267 | # Code from module wctype: | ||
| 202 | # Code from module wctype-h: | 268 | # Code from module wctype-h: |
| 269 | # Code from module wcwidth: | ||
| 203 | # Code from module windows-mutex: | 270 | # Code from module windows-mutex: |
| 204 | # Code from module windows-once: | 271 | # Code from module windows-once: |
| 205 | # Code from module windows-recmutex: | 272 | # Code from module windows-recmutex: |
| @@ -229,6 +296,7 @@ AC_DEFUN([gl_INIT], | |||
| 229 | gl_COMMON | 296 | gl_COMMON |
| 230 | gl_source_base='gl' | 297 | gl_source_base='gl' |
| 231 | gl_source_base_prefix= | 298 | gl_source_base_prefix= |
| 299 | gl_ALIGNASOF | ||
| 232 | gl_FUNC_ALLOCA | 300 | gl_FUNC_ALLOCA |
| 233 | gl_CONDITIONAL_HEADER([alloca.h]) | 301 | gl_CONDITIONAL_HEADER([alloca.h]) |
| 234 | AC_PROG_MKDIR_P | 302 | AC_PROG_MKDIR_P |
| @@ -239,6 +307,7 @@ AC_DEFUN([gl_INIT], | |||
| 239 | gl_CONDITIONAL_HEADER([assert.h]) | 307 | gl_CONDITIONAL_HEADER([assert.h]) |
| 240 | AC_PROG_MKDIR_P | 308 | AC_PROG_MKDIR_P |
| 241 | gl_FUNC_BASE64 | 309 | gl_FUNC_BASE64 |
| 310 | gl_C_BOOL | ||
| 242 | gl_FUNC_BTOWC | 311 | gl_FUNC_BTOWC |
| 243 | gl_CONDITIONAL([GL_COND_OBJ_BTOWC], | 312 | gl_CONDITIONAL([GL_COND_OBJ_BTOWC], |
| 244 | [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) | 313 | [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) |
| @@ -250,6 +319,104 @@ AC_DEFUN([gl_INIT], | |||
| 250 | gl_BYTESWAP | 319 | gl_BYTESWAP |
| 251 | gl_CONDITIONAL_HEADER([byteswap.h]) | 320 | gl_CONDITIONAL_HEADER([byteswap.h]) |
| 252 | AC_PROG_MKDIR_P | 321 | AC_PROG_MKDIR_P |
| 322 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 323 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 324 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 325 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 326 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 327 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 328 | gl_UCHAR_MODULE_INDICATOR([c32isalnum]) | ||
| 329 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 330 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 331 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 332 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 333 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 334 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 335 | gl_UCHAR_MODULE_INDICATOR([c32isalpha]) | ||
| 336 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 337 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 338 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 339 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 340 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 341 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 342 | gl_UCHAR_MODULE_INDICATOR([c32isblank]) | ||
| 343 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 344 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 345 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 346 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 347 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 348 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 349 | gl_UCHAR_MODULE_INDICATOR([c32iscntrl]) | ||
| 350 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 351 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 352 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 353 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 354 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 355 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 356 | gl_UCHAR_MODULE_INDICATOR([c32isdigit]) | ||
| 357 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 358 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 359 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 360 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 361 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 362 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 363 | gl_UCHAR_MODULE_INDICATOR([c32isgraph]) | ||
| 364 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 365 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 366 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 367 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 368 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 369 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 370 | gl_UCHAR_MODULE_INDICATOR([c32islower]) | ||
| 371 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 372 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 373 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 374 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 375 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 376 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 377 | gl_UCHAR_MODULE_INDICATOR([c32isprint]) | ||
| 378 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 379 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 380 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 381 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 382 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 383 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 384 | gl_UCHAR_MODULE_INDICATOR([c32ispunct]) | ||
| 385 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 386 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 387 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 388 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 389 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 390 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 391 | gl_UCHAR_MODULE_INDICATOR([c32isspace]) | ||
| 392 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 393 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 394 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 395 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 396 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 397 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 398 | gl_UCHAR_MODULE_INDICATOR([c32isupper]) | ||
| 399 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 400 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 401 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 402 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 403 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 404 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 405 | gl_UCHAR_MODULE_INDICATOR([c32isxdigit]) | ||
| 406 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 407 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 408 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 409 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 410 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 411 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 412 | gl_UCHAR_MODULE_INDICATOR([c32tolower]) | ||
| 413 | AC_REQUIRE([gl_UCHAR_H]) | ||
| 414 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 415 | dnl determined. It describes how mbrtoc32 is implemented. | ||
| 416 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 417 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 418 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 419 | gl_UCHAR_MODULE_INDICATOR([c32width]) | ||
| 253 | gl_FUNC_CALLOC_GNU | 420 | gl_FUNC_CALLOC_GNU |
| 254 | if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then | 421 | if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then |
| 255 | AC_LIBOBJ([calloc]) | 422 | AC_LIBOBJ([calloc]) |
| @@ -264,6 +431,7 @@ AC_DEFUN([gl_INIT], | |||
| 264 | gl_FUNC_CLOSE | 431 | gl_FUNC_CLOSE |
| 265 | gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) | 432 | gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) |
| 266 | gl_UNISTD_MODULE_INDICATOR([close]) | 433 | gl_UNISTD_MODULE_INDICATOR([close]) |
| 434 | gl_MODULE_INDICATOR([close]) | ||
| 267 | gl_AF_ALG | 435 | gl_AF_ALG |
| 268 | AC_REQUIRE([AC_C_RESTRICT]) | 436 | AC_REQUIRE([AC_C_RESTRICT]) |
| 269 | gl_SHA256 | 437 | gl_SHA256 |
| @@ -280,14 +448,17 @@ AC_DEFUN([gl_INIT], | |||
| 280 | gl_HEADER_ERRNO_H | 448 | gl_HEADER_ERRNO_H |
| 281 | gl_CONDITIONAL_HEADER([errno.h]) | 449 | gl_CONDITIONAL_HEADER([errno.h]) |
| 282 | AC_PROG_MKDIR_P | 450 | AC_PROG_MKDIR_P |
| 451 | AC_REQUIRE([gl_ERROR_H]) | ||
| 283 | gl_ERROR | 452 | gl_ERROR |
| 284 | gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test "$ac_cv_lib_error_at_line" = no]) | 453 | gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test $COMPILE_ERROR_C = 1]) |
| 285 | AM_COND_IF([GL_COND_OBJ_ERROR], [ | 454 | AM_COND_IF([GL_COND_OBJ_ERROR], [ |
| 286 | gl_PREREQ_ERROR | 455 | gl_PREREQ_ERROR |
| 287 | ]) | 456 | ]) |
| 288 | m4_ifdef([AM_XGETTEXT_OPTION], | 457 | m4_ifdef([AM_XGETTEXT_OPTION], |
| 289 | [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) | 458 | [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) |
| 290 | AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) | 459 | AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) |
| 460 | gl_ERROR_H | ||
| 461 | AC_PROG_MKDIR_P | ||
| 291 | AC_REQUIRE([gl_EXTERN_INLINE]) | 462 | AC_REQUIRE([gl_EXTERN_INLINE]) |
| 292 | gl_FUNC_FCNTL | 463 | gl_FUNC_FCNTL |
| 293 | gl_CONDITIONAL([GL_COND_OBJ_FCNTL], | 464 | gl_CONDITIONAL([GL_COND_OBJ_FCNTL], |
| @@ -306,8 +477,11 @@ AC_DEFUN([gl_INIT], | |||
| 306 | gl_FLOAT_H | 477 | gl_FLOAT_H |
| 307 | gl_CONDITIONAL_HEADER([float.h]) | 478 | gl_CONDITIONAL_HEADER([float.h]) |
| 308 | AC_PROG_MKDIR_P | 479 | AC_PROG_MKDIR_P |
| 309 | gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) | 480 | gl_CONDITIONAL([GL_COND_OBJ_FLOAT], |
| 481 | [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1]) | ||
| 310 | gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) | 482 | gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) |
| 483 | dnl Prerequisites of lib/float.c. | ||
| 484 | AC_REQUIRE([gl_BIGENDIAN]) | ||
| 311 | gl_FUNC_FLOORF | 485 | gl_FUNC_FLOORF |
| 312 | gl_CONDITIONAL([GL_COND_OBJ_FLOORF], | 486 | gl_CONDITIONAL([GL_COND_OBJ_FLOORF], |
| 313 | [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) | 487 | [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) |
| @@ -346,17 +520,20 @@ AC_DEFUN([gl_INIT], | |||
| 346 | gl_PREREQ_FSEEKO | 520 | gl_PREREQ_FSEEKO |
| 347 | ]) | 521 | ]) |
| 348 | gl_STDIO_MODULE_INDICATOR([fseeko]) | 522 | gl_STDIO_MODULE_INDICATOR([fseeko]) |
| 523 | gl_FUNC_FSETERR | ||
| 524 | gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no]) | ||
| 349 | gl_FUNC_FSTAT | 525 | gl_FUNC_FSTAT |
| 350 | gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) | 526 | gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) |
| 351 | AM_COND_IF([GL_COND_OBJ_FSTAT], [ | 527 | AM_COND_IF([GL_COND_OBJ_FSTAT], [ |
| 352 | case "$host_os" in | 528 | case "$host_os" in |
| 353 | mingw*) | 529 | mingw* | windows*) |
| 354 | AC_LIBOBJ([stat-w32]) | 530 | AC_LIBOBJ([stat-w32]) |
| 355 | ;; | 531 | ;; |
| 356 | esac | 532 | esac |
| 357 | gl_PREREQ_FSTAT | 533 | gl_PREREQ_FSTAT |
| 358 | ]) | 534 | ]) |
| 359 | gl_SYS_STAT_MODULE_INDICATOR([fstat]) | 535 | gl_SYS_STAT_MODULE_INDICATOR([fstat]) |
| 536 | gl_MODULE_INDICATOR([fstat]) | ||
| 360 | gl_FSUSAGE | 537 | gl_FSUSAGE |
| 361 | gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) | 538 | gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) |
| 362 | AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ | 539 | AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ |
| @@ -398,6 +575,7 @@ AC_DEFUN([gl_INIT], | |||
| 398 | gl_PREREQ_GETHOSTNAME | 575 | gl_PREREQ_GETHOSTNAME |
| 399 | ]) | 576 | ]) |
| 400 | gl_UNISTD_MODULE_INDICATOR([gethostname]) | 577 | gl_UNISTD_MODULE_INDICATOR([gethostname]) |
| 578 | gl_MODULE_INDICATOR([gethostname]) | ||
| 401 | gl_FUNC_GETLINE | 579 | gl_FUNC_GETLINE |
| 402 | gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) | 580 | gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) |
| 403 | AM_COND_IF([GL_COND_OBJ_GETLINE], [ | 581 | AM_COND_IF([GL_COND_OBJ_GETLINE], [ |
| @@ -406,7 +584,8 @@ AC_DEFUN([gl_INIT], | |||
| 406 | gl_STDIO_MODULE_INDICATOR([getline]) | 584 | gl_STDIO_MODULE_INDICATOR([getline]) |
| 407 | AC_REQUIRE([AC_CANONICAL_HOST]) | 585 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 408 | gl_GETLOADAVG | 586 | gl_GETLOADAVG |
| 409 | gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0]) | 587 | gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], |
| 588 | [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1]) | ||
| 410 | AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [ | 589 | AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [ |
| 411 | gl_PREREQ_GETLOADAVG | 590 | gl_PREREQ_GETLOADAVG |
| 412 | ]) | 591 | ]) |
| @@ -426,12 +605,24 @@ AC_DEFUN([gl_INIT], | |||
| 426 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) | 605 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) |
| 427 | ]) | 606 | ]) |
| 428 | gl_UNISTD_MODULE_INDICATOR([getopt-posix]) | 607 | gl_UNISTD_MODULE_INDICATOR([getopt-posix]) |
| 608 | gl_MUSL_LIBC | ||
| 609 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 429 | gl_FUNC_GETPROGNAME | 610 | gl_FUNC_GETPROGNAME |
| 611 | gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], | ||
| 612 | [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) | ||
| 613 | AM_COND_IF([GL_COND_OBJ_GETPROGNAME], [ | ||
| 614 | gl_PREREQ_GETPROGNAME | ||
| 615 | ]) | ||
| 616 | gl_STDLIB_MODULE_INDICATOR([getprogname]) | ||
| 430 | AC_SUBST([LIBINTL]) | 617 | AC_SUBST([LIBINTL]) |
| 431 | AC_SUBST([LTLIBINTL]) | 618 | AC_SUBST([LTLIBINTL]) |
| 432 | AC_PROG_MKDIR_P | 619 | AC_PROG_MKDIR_P |
| 620 | GNULIB_I18N | ||
| 433 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) | 621 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) |
| 434 | LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" | 622 | HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" |
| 623 | AC_SUBST([HARD_LOCALE_LIB]) | ||
| 624 | dnl For backward compatibility. | ||
| 625 | LIB_HARD_LOCALE="$HARD_LOCALE_LIB" | ||
| 435 | AC_SUBST([LIB_HARD_LOCALE]) | 626 | AC_SUBST([LIB_HARD_LOCALE]) |
| 436 | gl_HOSTENT | 627 | gl_HOSTENT |
| 437 | gl_IDPRIV | 628 | gl_IDPRIV |
| @@ -442,9 +633,36 @@ AC_DEFUN([gl_INIT], | |||
| 442 | gl_PREREQ_INET_NTOP | 633 | gl_PREREQ_INET_NTOP |
| 443 | ]) | 634 | ]) |
| 444 | gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) | 635 | gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) |
| 636 | gl_FUNC_INET_PTON | ||
| 637 | gl_CONDITIONAL([GL_COND_OBJ_INET_PTON], | ||
| 638 | [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1]) | ||
| 639 | AM_COND_IF([GL_COND_OBJ_INET_PTON], [ | ||
| 640 | gl_PREREQ_INET_PTON | ||
| 641 | ]) | ||
| 642 | gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) | ||
| 445 | gl_INTTYPES_INCOMPLETE | 643 | gl_INTTYPES_INCOMPLETE |
| 446 | gl_INTTYPES_H_REQUIRE_DEFAULTS | 644 | gl_INTTYPES_H_REQUIRE_DEFAULTS |
| 447 | AC_PROG_MKDIR_P | 645 | AC_PROG_MKDIR_P |
| 646 | gl_FUNC_ISWBLANK | ||
| 647 | gl_CONDITIONAL([GL_COND_OBJ_ISWBLANK], | ||
| 648 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && { test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; }]) | ||
| 649 | gl_WCTYPE_MODULE_INDICATOR([iswblank]) | ||
| 650 | gl_FUNC_ISWCTYPE | ||
| 651 | gl_CONDITIONAL([GL_COND_OBJ_ISWCTYPE], | ||
| 652 | [test $HAVE_WCTYPE_T = 0 || test $GNULIBHEADERS_OVERRIDE_WINT_T = 1 || test $REPLACE_WCTYPE = 1]) | ||
| 653 | gl_WCTYPE_MODULE_INDICATOR([iswctype]) | ||
| 654 | gl_FUNC_ISWDIGIT | ||
| 655 | gl_CONDITIONAL([GL_COND_OBJ_ISWDIGIT], | ||
| 656 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWDIGIT = 1]) | ||
| 657 | gl_WCTYPE_MODULE_INDICATOR([iswdigit]) | ||
| 658 | gl_FUNC_ISWPUNCT | ||
| 659 | gl_CONDITIONAL([GL_COND_OBJ_ISWPUNCT], | ||
| 660 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWPUNCT = 1]) | ||
| 661 | gl_WCTYPE_MODULE_INDICATOR([iswpunct]) | ||
| 662 | gl_FUNC_ISWXDIGIT | ||
| 663 | gl_CONDITIONAL([GL_COND_OBJ_ISWXDIGIT], | ||
| 664 | [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWXDIGIT = 1]) | ||
| 665 | gl_WCTYPE_MODULE_INDICATOR([iswxdigit]) | ||
| 448 | gl_LANGINFO_H | 666 | gl_LANGINFO_H |
| 449 | gl_LANGINFO_H_REQUIRE_DEFAULTS | 667 | gl_LANGINFO_H_REQUIRE_DEFAULTS |
| 450 | AC_PROG_MKDIR_P | 668 | AC_PROG_MKDIR_P |
| @@ -466,11 +684,19 @@ AC_DEFUN([gl_INIT], | |||
| 466 | gl_PREREQ_LOCALECONV | 684 | gl_PREREQ_LOCALECONV |
| 467 | ]) | 685 | ]) |
| 468 | gl_LOCALE_MODULE_INDICATOR([localeconv]) | 686 | gl_LOCALE_MODULE_INDICATOR([localeconv]) |
| 687 | gl_MODULE_INDICATOR([localeconv]) | ||
| 469 | gl_LOCK | 688 | gl_LOCK |
| 470 | gl_MODULE_INDICATOR([lock]) | 689 | gl_MODULE_INDICATOR([lock]) |
| 471 | gl_FUNC_LSEEK | 690 | gl_FUNC_LSEEK |
| 472 | gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) | 691 | gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) |
| 473 | gl_UNISTD_MODULE_INDICATOR([lseek]) | 692 | gl_UNISTD_MODULE_INDICATOR([lseek]) |
| 693 | gl_FUNC_LSTAT | ||
| 694 | gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1]) | ||
| 695 | AM_COND_IF([GL_COND_OBJ_LSTAT], [ | ||
| 696 | gl_PREREQ_LSTAT | ||
| 697 | ]) | ||
| 698 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) | ||
| 699 | gl_MODULE_INDICATOR([lstat]) | ||
| 474 | gl_FUNC_MALLOC_GNU | 700 | gl_FUNC_MALLOC_GNU |
| 475 | if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then | 701 | if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then |
| 476 | AC_LIBOBJ([malloc]) | 702 | AC_LIBOBJ([malloc]) |
| @@ -485,6 +711,20 @@ AC_DEFUN([gl_INIT], | |||
| 485 | gl_MATH_H | 711 | gl_MATH_H |
| 486 | gl_MATH_H_REQUIRE_DEFAULTS | 712 | gl_MATH_H_REQUIRE_DEFAULTS |
| 487 | AC_PROG_MKDIR_P | 713 | AC_PROG_MKDIR_P |
| 714 | gl_MBCHAR | ||
| 715 | gl_MBITER | ||
| 716 | gl_FUNC_MBRTOC32 | ||
| 717 | gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32], | ||
| 718 | [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]) | ||
| 719 | AM_COND_IF([GL_COND_OBJ_MBRTOC32], [ | ||
| 720 | if test $REPLACE_MBSTATE_T = 1; then | ||
| 721 | AC_LIBOBJ([lc-charset-dispatch]) | ||
| 722 | AC_LIBOBJ([mbtowc-lock]) | ||
| 723 | gl_PREREQ_MBTOWC_LOCK | ||
| 724 | fi | ||
| 725 | gl_PREREQ_MBRTOC32 | ||
| 726 | ]) | ||
| 727 | gl_UCHAR_MODULE_INDICATOR([mbrtoc32]) | ||
| 488 | gl_FUNC_MBRTOWC | 728 | gl_FUNC_MBRTOWC |
| 489 | gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], | 729 | gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], |
| 490 | [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) | 730 | [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) |
| @@ -504,6 +744,11 @@ AC_DEFUN([gl_INIT], | |||
| 504 | gl_PREREQ_MBSINIT | 744 | gl_PREREQ_MBSINIT |
| 505 | ]) | 745 | ]) |
| 506 | gl_WCHAR_MODULE_INDICATOR([mbsinit]) | 746 | gl_WCHAR_MODULE_INDICATOR([mbsinit]) |
| 747 | gl_STRING_MODULE_INDICATOR([mbsnlen]) | ||
| 748 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | ||
| 749 | gl_MBSTATE_T_BROKEN | ||
| 750 | gl_MUSL_LIBC | ||
| 751 | gl_WCHAR_MODULE_INDICATOR([mbszero]) | ||
| 507 | gl_FUNC_MBTOWC | 752 | gl_FUNC_MBTOWC |
| 508 | gl_CONDITIONAL([GL_COND_OBJ_MBTOWC], | 753 | gl_CONDITIONAL([GL_COND_OBJ_MBTOWC], |
| 509 | [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]) | 754 | [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]) |
| @@ -530,10 +775,7 @@ AC_DEFUN([gl_INIT], | |||
| 530 | gl_PREREQ_MKTIME | 775 | gl_PREREQ_MKTIME |
| 531 | fi | 776 | fi |
| 532 | gl_MOUNTLIST | 777 | gl_MOUNTLIST |
| 533 | gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) | 778 | gl_PREREQ_MOUNTLIST_EXTRA |
| 534 | AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [ | ||
| 535 | gl_PREREQ_MOUNTLIST_EXTRA | ||
| 536 | ]) | ||
| 537 | AC_REQUIRE([gl_MSVC_INVAL]) | 779 | AC_REQUIRE([gl_MSVC_INVAL]) |
| 538 | gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], | 780 | gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], |
| 539 | [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) | 781 | [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) |
| @@ -557,6 +799,7 @@ AC_DEFUN([gl_INIT], | |||
| 557 | gl_PREREQ_NL_LANGINFO_LOCK | 799 | gl_PREREQ_NL_LANGINFO_LOCK |
| 558 | fi | 800 | fi |
| 559 | gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) | 801 | gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) |
| 802 | gl_ONCE | ||
| 560 | gl_FUNC_OPEN | 803 | gl_FUNC_OPEN |
| 561 | gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) | 804 | gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) |
| 562 | AM_COND_IF([GL_COND_OBJ_OPEN], [ | 805 | AM_COND_IF([GL_COND_OBJ_OPEN], [ |
| @@ -564,15 +807,17 @@ AC_DEFUN([gl_INIT], | |||
| 564 | ]) | 807 | ]) |
| 565 | gl_FCNTL_MODULE_INDICATOR([open]) | 808 | gl_FCNTL_MODULE_INDICATOR([open]) |
| 566 | gl_PATHMAX | 809 | gl_PATHMAX |
| 567 | gl_FUNC_REALLOC_GNU | 810 | gl_PTHREAD_H |
| 568 | if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then | 811 | gl_PTHREAD_H_REQUIRE_DEFAULTS |
| 569 | AC_LIBOBJ([realloc]) | 812 | AC_PROG_MKDIR_P |
| 570 | fi | 813 | gl_PTHREAD_ONCE |
| 571 | gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) | 814 | gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE], |
| 815 | [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1]) | ||
| 816 | gl_PTHREAD_MODULE_INDICATOR([pthread-once]) | ||
| 572 | gl_FUNC_REALLOC_POSIX | 817 | gl_FUNC_REALLOC_POSIX |
| 573 | if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then | 818 | gl_FUNC_REALLOC_0_NONNULL |
| 574 | AC_LIBOBJ([realloc]) | 819 | gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX], |
| 575 | fi | 820 | [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0]) |
| 576 | gl_STDLIB_MODULE_INDICATOR([realloc-posix]) | 821 | gl_STDLIB_MODULE_INDICATOR([realloc-posix]) |
| 577 | gl_FUNC_REALLOCARRAY | 822 | gl_FUNC_REALLOCARRAY |
| 578 | gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], | 823 | gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], |
| @@ -587,6 +832,9 @@ AC_DEFUN([gl_INIT], | |||
| 587 | AM_COND_IF([GL_COND_OBJ_REGEX], [ | 832 | AM_COND_IF([GL_COND_OBJ_REGEX], [ |
| 588 | gl_PREREQ_REGEX | 833 | gl_PREREQ_REGEX |
| 589 | ]) | 834 | ]) |
| 835 | gl_SCHED_H | ||
| 836 | gl_SCHED_H_REQUIRE_DEFAULTS | ||
| 837 | AC_PROG_MKDIR_P | ||
| 590 | gl_SERVENT | 838 | gl_SERVENT |
| 591 | gl_FUNC_SETENV | 839 | gl_FUNC_SETENV |
| 592 | gl_CONDITIONAL([GL_COND_OBJ_SETENV], | 840 | gl_CONDITIONAL([GL_COND_OBJ_SETENV], |
| @@ -611,25 +859,17 @@ AC_DEFUN([gl_INIT], | |||
| 611 | gl_CONDITIONAL([GL_COND_OBJ_STAT], [test $REPLACE_STAT = 1]) | 859 | gl_CONDITIONAL([GL_COND_OBJ_STAT], [test $REPLACE_STAT = 1]) |
| 612 | AM_COND_IF([GL_COND_OBJ_STAT], [ | 860 | AM_COND_IF([GL_COND_OBJ_STAT], [ |
| 613 | case "$host_os" in | 861 | case "$host_os" in |
| 614 | mingw*) | 862 | mingw* | windows*) |
| 615 | AC_LIBOBJ([stat-w32]) | 863 | AC_LIBOBJ([stat-w32]) |
| 616 | ;; | 864 | ;; |
| 617 | esac | 865 | esac |
| 618 | gl_PREREQ_STAT | 866 | gl_PREREQ_STAT |
| 619 | ]) | 867 | ]) |
| 620 | gl_SYS_STAT_MODULE_INDICATOR([stat]) | 868 | gl_SYS_STAT_MODULE_INDICATOR([stat]) |
| 869 | gl_MODULE_INDICATOR([stat]) | ||
| 621 | gl_STAT_TIME | 870 | gl_STAT_TIME |
| 622 | gl_STAT_BIRTHTIME | 871 | gl_STAT_BIRTHTIME |
| 623 | gl_STDALIGN_H | 872 | gl_STDCKDINT_H |
| 624 | gl_CONDITIONAL_HEADER([stdalign.h]) | ||
| 625 | AC_PROG_MKDIR_P | ||
| 626 | gl_C_BOOL | ||
| 627 | AC_CHECK_HEADERS_ONCE([stdckdint.h]) | ||
| 628 | if test $ac_cv_header_stdckdint_h = yes; then | ||
| 629 | GL_GENERATE_STDCKDINT_H=false | ||
| 630 | else | ||
| 631 | GL_GENERATE_STDCKDINT_H=true | ||
| 632 | fi | ||
| 633 | gl_CONDITIONAL_HEADER([stdckdint.h]) | 873 | gl_CONDITIONAL_HEADER([stdckdint.h]) |
| 634 | AC_PROG_MKDIR_P | 874 | AC_PROG_MKDIR_P |
| 635 | gl_STDDEF_H | 875 | gl_STDDEF_H |
| @@ -644,6 +884,19 @@ AC_DEFUN([gl_INIT], | |||
| 644 | gl_STDIO_H | 884 | gl_STDIO_H |
| 645 | gl_STDIO_H_REQUIRE_DEFAULTS | 885 | gl_STDIO_H_REQUIRE_DEFAULTS |
| 646 | AC_PROG_MKDIR_P | 886 | AC_PROG_MKDIR_P |
| 887 | USES_MSVCRT=0 | ||
| 888 | case "$host_os" in | ||
| 889 | mingw* | windows*) | ||
| 890 | AC_EGREP_CPP([Special], [ | ||
| 891 | #ifndef _UCRT | ||
| 892 | Special | ||
| 893 | #endif | ||
| 894 | ], | ||
| 895 | [USES_MSVCRT=1]) | ||
| 896 | ;; | ||
| 897 | esac | ||
| 898 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) | ||
| 899 | AC_CHECK_FUNCS([vasprintf]) | ||
| 647 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) | 900 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) |
| 648 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) | 901 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) |
| 649 | dnl No need to create extra modules for these functions. Everyone who uses | 902 | dnl No need to create extra modules for these functions. Everyone who uses |
| @@ -672,15 +925,13 @@ AC_DEFUN([gl_INIT], | |||
| 672 | gl_STDLIB_H | 925 | gl_STDLIB_H |
| 673 | gl_STDLIB_H_REQUIRE_DEFAULTS | 926 | gl_STDLIB_H_REQUIRE_DEFAULTS |
| 674 | AC_PROG_MKDIR_P | 927 | AC_PROG_MKDIR_P |
| 675 | gl_STRCASE | 928 | gl_FUNC_STRCASECMP |
| 676 | gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) | 929 | gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], |
| 930 | [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1]) | ||
| 677 | AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ | 931 | AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ |
| 678 | gl_PREREQ_STRCASECMP | 932 | gl_PREREQ_STRCASECMP |
| 679 | ]) | 933 | ]) |
| 680 | gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) | 934 | gl_STRINGS_MODULE_INDICATOR([strcasecmp]) |
| 681 | AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ | ||
| 682 | gl_PREREQ_STRNCASECMP | ||
| 683 | ]) | ||
| 684 | gl_FUNC_STRCASESTR | 935 | gl_FUNC_STRCASESTR |
| 685 | if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then | 936 | if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then |
| 686 | AC_LIBOBJ([strcasestr]) | 937 | AC_LIBOBJ([strcasestr]) |
| @@ -709,6 +960,19 @@ AC_DEFUN([gl_INIT], | |||
| 709 | gl_STRINGS_H | 960 | gl_STRINGS_H |
| 710 | gl_STRINGS_H_REQUIRE_DEFAULTS | 961 | gl_STRINGS_H_REQUIRE_DEFAULTS |
| 711 | AC_PROG_MKDIR_P | 962 | AC_PROG_MKDIR_P |
| 963 | gl_FUNC_STRNCASECMP | ||
| 964 | gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], | ||
| 965 | [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1]) | ||
| 966 | AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ | ||
| 967 | gl_PREREQ_STRNCASECMP | ||
| 968 | ]) | ||
| 969 | gl_STRINGS_MODULE_INDICATOR([strncasecmp]) | ||
| 970 | gl_FUNC_STRNCPY | ||
| 971 | gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1]) | ||
| 972 | AM_COND_IF([GL_COND_OBJ_STRNCPY], [ | ||
| 973 | gl_PREREQ_STRNCPY | ||
| 974 | ]) | ||
| 975 | gl_STRING_MODULE_INDICATOR([strncpy]) | ||
| 712 | gl_FUNC_STRSEP | 976 | gl_FUNC_STRSEP |
| 713 | gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) | 977 | gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) |
| 714 | AM_COND_IF([GL_COND_OBJ_STRSEP], [ | 978 | AM_COND_IF([GL_COND_OBJ_STRSEP], [ |
| @@ -750,9 +1014,55 @@ AC_DEFUN([gl_INIT], | |||
| 750 | gl_PREREQ_TIMEGM | 1014 | gl_PREREQ_TIMEGM |
| 751 | ]) | 1015 | ]) |
| 752 | gl_TIME_MODULE_INDICATOR([timegm]) | 1016 | gl_TIME_MODULE_INDICATOR([timegm]) |
| 1017 | gl_UCHAR_H | ||
| 1018 | gl_UCHAR_H_REQUIRE_DEFAULTS | ||
| 1019 | AC_PROG_MKDIR_P | ||
| 1020 | gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h]) | ||
| 1021 | gl_UNICASE_H | ||
| 1022 | gl_UNICASE_H_REQUIRE_DEFAULTS | ||
| 1023 | AC_PROG_MKDIR_P | ||
| 1024 | gl_LIBUNISTRING_MODULE([1.3], [unicase/tolower]) | ||
| 1025 | gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h]) | ||
| 1026 | gl_UNICTYPE_H | ||
| 1027 | gl_UNICTYPE_H_REQUIRE_DEFAULTS | ||
| 1028 | AC_PROG_MKDIR_P | ||
| 1029 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1030 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alnum]) | ||
| 1031 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1032 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alpha]) | ||
| 1033 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1034 | gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-blank]) | ||
| 1035 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1036 | gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-cntrl]) | ||
| 1037 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1038 | gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-digit]) | ||
| 1039 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1040 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-graph]) | ||
| 1041 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1042 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-lower]) | ||
| 1043 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1044 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-print]) | ||
| 1045 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1046 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-punct]) | ||
| 1047 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1048 | gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-space]) | ||
| 1049 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1050 | gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-upper]) | ||
| 1051 | AC_REQUIRE([AC_C_INLINE]) | ||
| 1052 | gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-xdigit]) | ||
| 1053 | gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h]) | ||
| 1054 | gl_UNINORM_H | ||
| 1055 | gl_UNINORM_H_REQUIRE_DEFAULTS | ||
| 1056 | AC_PROG_MKDIR_P | ||
| 753 | gl_UNISTD_H | 1057 | gl_UNISTD_H |
| 754 | gl_UNISTD_H_REQUIRE_DEFAULTS | 1058 | gl_UNISTD_H_REQUIRE_DEFAULTS |
| 755 | AC_PROG_MKDIR_P | 1059 | AC_PROG_MKDIR_P |
| 1060 | gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h]) | ||
| 1061 | AC_PROG_MKDIR_P | ||
| 1062 | gl_UNITYPES_H | ||
| 1063 | gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h]) | ||
| 1064 | AC_PROG_MKDIR_P | ||
| 1065 | gl_LIBUNISTRING_MODULE([1.3], [uniwidth/width]) | ||
| 756 | gl_FUNC_GLIBC_UNLOCKED_IO | 1066 | gl_FUNC_GLIBC_UNLOCKED_IO |
| 757 | gl_FUNC_UNSETENV | 1067 | gl_FUNC_UNSETENV |
| 758 | gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], | 1068 | gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], |
| @@ -771,6 +1081,7 @@ AC_DEFUN([gl_INIT], | |||
| 771 | AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) | 1081 | AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) |
| 772 | gl_FUNC_VSNPRINTF | 1082 | gl_FUNC_VSNPRINTF |
| 773 | gl_STDIO_MODULE_INDICATOR([vsnprintf]) | 1083 | gl_STDIO_MODULE_INDICATOR([vsnprintf]) |
| 1084 | gl_STDIO_MODULE_INDICATOR([vsnzprintf]) | ||
| 774 | gl_WCHAR_H | 1085 | gl_WCHAR_H |
| 775 | gl_WCHAR_H_REQUIRE_DEFAULTS | 1086 | gl_WCHAR_H_REQUIRE_DEFAULTS |
| 776 | AC_PROG_MKDIR_P | 1087 | AC_PROG_MKDIR_P |
| @@ -781,21 +1092,31 @@ AC_DEFUN([gl_INIT], | |||
| 781 | gl_PREREQ_WCRTOMB | 1092 | gl_PREREQ_WCRTOMB |
| 782 | ]) | 1093 | ]) |
| 783 | gl_WCHAR_MODULE_INDICATOR([wcrtomb]) | 1094 | gl_WCHAR_MODULE_INDICATOR([wcrtomb]) |
| 1095 | gl_FUNC_WCTYPE | ||
| 1096 | gl_CONDITIONAL([GL_COND_OBJ_WCTYPE], [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]) | ||
| 1097 | gl_WCTYPE_MODULE_INDICATOR([wctype]) | ||
| 784 | gl_WCTYPE_H | 1098 | gl_WCTYPE_H |
| 785 | gl_WCTYPE_H_REQUIRE_DEFAULTS | 1099 | gl_WCTYPE_H_REQUIRE_DEFAULTS |
| 786 | AC_PROG_MKDIR_P | 1100 | AC_PROG_MKDIR_P |
| 1101 | gl_FUNC_WCWIDTH | ||
| 1102 | gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH], | ||
| 1103 | [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1]) | ||
| 1104 | AM_COND_IF([GL_COND_OBJ_WCWIDTH], [ | ||
| 1105 | gl_PREREQ_WCWIDTH | ||
| 1106 | ]) | ||
| 1107 | gl_WCHAR_MODULE_INDICATOR([wcwidth]) | ||
| 787 | AC_REQUIRE([AC_CANONICAL_HOST]) | 1108 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 788 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], | 1109 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], |
| 789 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 1110 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
| 790 | AC_REQUIRE([AC_CANONICAL_HOST]) | 1111 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 791 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_ONCE], | 1112 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_ONCE], |
| 792 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 1113 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
| 793 | AC_REQUIRE([AC_CANONICAL_HOST]) | 1114 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 794 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RECMUTEX], | 1115 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RECMUTEX], |
| 795 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 1116 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
| 796 | AC_REQUIRE([AC_CANONICAL_HOST]) | 1117 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 797 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RWLOCK], | 1118 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RWLOCK], |
| 798 | [case "$host_os" in mingw*) true;; *) false;; esac]) | 1119 | [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) |
| 799 | gl_XALLOC | 1120 | gl_XALLOC |
| 800 | gl_MODULE_INDICATOR([xalloc]) | 1121 | gl_MODULE_INDICATOR([xalloc]) |
| 801 | gl_MODULE_INDICATOR([xalloc-die]) | 1122 | gl_MODULE_INDICATOR([xalloc-die]) |
| @@ -823,27 +1144,35 @@ AC_DEFUN([gl_INIT], | |||
| 823 | gl_libobjs= | 1144 | gl_libobjs= |
| 824 | gl_ltlibobjs= | 1145 | gl_ltlibobjs= |
| 825 | gl_libobjdeps= | 1146 | gl_libobjdeps= |
| 1147 | gl_libgnu_libobjs= | ||
| 1148 | gl_libgnu_ltlibobjs= | ||
| 1149 | gl_libgnu_libobjdeps= | ||
| 826 | if test -n "$gl_LIBOBJS"; then | 1150 | if test -n "$gl_LIBOBJS"; then |
| 827 | # Remove the extension. | 1151 | # Remove the extension. |
| 828 | changequote(,)dnl | 1152 | changequote(,)dnl |
| 829 | sed_drop_objext='s/\.o$//;s/\.obj$//' | 1153 | sed_drop_objext='s/\.o$//;s/\.obj$//' |
| 830 | sed_dirname1='s,//*,/,g' | 1154 | sed_dirname1='s,//*,/,g' |
| 831 | sed_dirname2='s,\(.\)/$,\1,' | 1155 | sed_dirname2='s,\(.\)/$,\1,' |
| 832 | sed_dirname3='s,^[^/]*$,.,' | 1156 | sed_dirname3='s,[^/]*$,,' |
| 833 | sed_dirname4='s,\(.\)/[^/]*$,\1,' | ||
| 834 | sed_basename1='s,.*/,,' | 1157 | sed_basename1='s,.*/,,' |
| 835 | changequote([, ])dnl | 1158 | changequote([, ])dnl |
| 836 | for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do | 1159 | for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do |
| 837 | gl_libobjs="$gl_libobjs $i.$ac_objext" | 1160 | gl_libobjs="$gl_libobjs $i.$ac_objext" |
| 838 | gl_ltlibobjs="$gl_ltlibobjs $i.lo" | 1161 | gl_ltlibobjs="$gl_ltlibobjs $i.lo" |
| 839 | i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` | 1162 | i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"` |
| 840 | i_base=`echo "$i" | sed -e "$sed_basename1"` | 1163 | i_base=`echo "$i" | sed -e "$sed_basename1"` |
| 841 | gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" | 1164 | gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext" |
| 1165 | gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo" | ||
| 1166 | gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po" | ||
| 1167 | gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po" | ||
| 842 | done | 1168 | done |
| 843 | fi | 1169 | fi |
| 844 | AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) | 1170 | AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) |
| 845 | AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) | 1171 | AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) |
| 846 | AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) | 1172 | AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) |
| 1173 | AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs]) | ||
| 1174 | AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs]) | ||
| 1175 | AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps]) | ||
| 847 | ]) | 1176 | ]) |
| 848 | gltests_libdeps= | 1177 | gltests_libdeps= |
| 849 | gltests_ltlibdeps= | 1178 | gltests_ltlibdeps= |
| @@ -886,27 +1215,35 @@ changequote([, ])dnl | |||
| 886 | gltests_libobjs= | 1215 | gltests_libobjs= |
| 887 | gltests_ltlibobjs= | 1216 | gltests_ltlibobjs= |
| 888 | gltests_libobjdeps= | 1217 | gltests_libobjdeps= |
| 1218 | gltests_libgnu_libobjs= | ||
| 1219 | gltests_libgnu_ltlibobjs= | ||
| 1220 | gltests_libgnu_libobjdeps= | ||
| 889 | if test -n "$gltests_LIBOBJS"; then | 1221 | if test -n "$gltests_LIBOBJS"; then |
| 890 | # Remove the extension. | 1222 | # Remove the extension. |
| 891 | changequote(,)dnl | 1223 | changequote(,)dnl |
| 892 | sed_drop_objext='s/\.o$//;s/\.obj$//' | 1224 | sed_drop_objext='s/\.o$//;s/\.obj$//' |
| 893 | sed_dirname1='s,//*,/,g' | 1225 | sed_dirname1='s,//*,/,g' |
| 894 | sed_dirname2='s,\(.\)/$,\1,' | 1226 | sed_dirname2='s,\(.\)/$,\1,' |
| 895 | sed_dirname3='s,^[^/]*$,.,' | 1227 | sed_dirname3='s,[^/]*$,,' |
| 896 | sed_dirname4='s,\(.\)/[^/]*$,\1,' | ||
| 897 | sed_basename1='s,.*/,,' | 1228 | sed_basename1='s,.*/,,' |
| 898 | changequote([, ])dnl | 1229 | changequote([, ])dnl |
| 899 | for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do | 1230 | for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do |
| 900 | gltests_libobjs="$gltests_libobjs $i.$ac_objext" | 1231 | gltests_libobjs="$gltests_libobjs $i.$ac_objext" |
| 901 | gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" | 1232 | gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" |
| 902 | i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` | 1233 | i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"` |
| 903 | i_base=`echo "$i" | sed -e "$sed_basename1"` | 1234 | i_base=`echo "$i" | sed -e "$sed_basename1"` |
| 904 | gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" | 1235 | gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext" |
| 1236 | gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo" | ||
| 1237 | gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po" | ||
| 1238 | gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po" | ||
| 905 | done | 1239 | done |
| 906 | fi | 1240 | fi |
| 907 | AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) | 1241 | AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) |
| 908 | AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) | 1242 | AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) |
| 909 | AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) | 1243 | AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) |
| 1244 | AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs]) | ||
| 1245 | AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs]) | ||
| 1246 | AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps]) | ||
| 910 | ]) | 1247 | ]) |
| 911 | AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) | 1248 | AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) |
| 912 | LIBGNU_LIBDEPS="$gl_libdeps" | 1249 | LIBGNU_LIBDEPS="$gl_libdeps" |
| @@ -977,6 +1314,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 977 | lib/af_alg.h | 1314 | lib/af_alg.h |
| 978 | lib/alloca.in.h | 1315 | lib/alloca.in.h |
| 979 | lib/arg-nonnull.h | 1316 | lib/arg-nonnull.h |
| 1317 | lib/arpa_inet.c | ||
| 980 | lib/arpa_inet.in.h | 1318 | lib/arpa_inet.in.h |
| 981 | lib/asnprintf.c | 1319 | lib/asnprintf.c |
| 982 | lib/asprintf.c | 1320 | lib/asprintf.c |
| @@ -988,8 +1326,27 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 988 | lib/basename-lgpl.h | 1326 | lib/basename-lgpl.h |
| 989 | lib/basename.c | 1327 | lib/basename.c |
| 990 | lib/btowc.c | 1328 | lib/btowc.c |
| 1329 | lib/byteswap.c | ||
| 991 | lib/byteswap.in.h | 1330 | lib/byteswap.in.h |
| 992 | lib/c++defs.h | 1331 | lib/c++defs.h |
| 1332 | lib/c-ctype.c | ||
| 1333 | lib/c-ctype.h | ||
| 1334 | lib/c32is-impl.h | ||
| 1335 | lib/c32isalnum.c | ||
| 1336 | lib/c32isalpha.c | ||
| 1337 | lib/c32isblank.c | ||
| 1338 | lib/c32iscntrl.c | ||
| 1339 | lib/c32isdigit.c | ||
| 1340 | lib/c32isgraph.c | ||
| 1341 | lib/c32islower.c | ||
| 1342 | lib/c32isprint.c | ||
| 1343 | lib/c32ispunct.c | ||
| 1344 | lib/c32isspace.c | ||
| 1345 | lib/c32isupper.c | ||
| 1346 | lib/c32isxdigit.c | ||
| 1347 | lib/c32to-impl.h | ||
| 1348 | lib/c32tolower.c | ||
| 1349 | lib/c32width.c | ||
| 993 | lib/calloc.c | 1350 | lib/calloc.c |
| 994 | lib/cdefs.h | 1351 | lib/cdefs.h |
| 995 | lib/cloexec.c | 1352 | lib/cloexec.c |
| @@ -1002,7 +1359,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1002 | lib/dynarray.h | 1359 | lib/dynarray.h |
| 1003 | lib/errno.in.h | 1360 | lib/errno.in.h |
| 1004 | lib/error.c | 1361 | lib/error.c |
| 1005 | lib/error.h | 1362 | lib/error.in.h |
| 1006 | lib/exitfail.c | 1363 | lib/exitfail.c |
| 1007 | lib/exitfail.h | 1364 | lib/exitfail.h |
| 1008 | lib/fcntl.c | 1365 | lib/fcntl.c |
| @@ -1023,6 +1380,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1023 | lib/free.c | 1380 | lib/free.c |
| 1024 | lib/fseek.c | 1381 | lib/fseek.c |
| 1025 | lib/fseeko.c | 1382 | lib/fseeko.c |
| 1383 | lib/fseterr.c | ||
| 1384 | lib/fseterr.h | ||
| 1026 | lib/fstat.c | 1385 | lib/fstat.c |
| 1027 | lib/fsusage.c | 1386 | lib/fsusage.c |
| 1028 | lib/fsusage.h | 1387 | lib/fsusage.h |
| @@ -1050,6 +1409,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1050 | lib/gl_openssl.h | 1409 | lib/gl_openssl.h |
| 1051 | lib/glthread/lock.c | 1410 | lib/glthread/lock.c |
| 1052 | lib/glthread/lock.h | 1411 | lib/glthread/lock.h |
| 1412 | lib/glthread/once.c | ||
| 1413 | lib/glthread/once.h | ||
| 1053 | lib/glthread/threadlib.c | 1414 | lib/glthread/threadlib.c |
| 1054 | lib/hard-locale.c | 1415 | lib/hard-locale.c |
| 1055 | lib/hard-locale.h | 1416 | lib/hard-locale.h |
| @@ -1059,9 +1420,16 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1059 | lib/idpriv.h | 1420 | lib/idpriv.h |
| 1060 | lib/idx.h | 1421 | lib/idx.h |
| 1061 | lib/inet_ntop.c | 1422 | lib/inet_ntop.c |
| 1423 | lib/inet_pton.c | ||
| 1062 | lib/intprops-internal.h | 1424 | lib/intprops-internal.h |
| 1063 | lib/intprops.h | 1425 | lib/intprops.h |
| 1064 | lib/inttypes.in.h | 1426 | lib/inttypes.in.h |
| 1427 | lib/iswblank.c | ||
| 1428 | lib/iswctype-impl.h | ||
| 1429 | lib/iswctype.c | ||
| 1430 | lib/iswdigit.c | ||
| 1431 | lib/iswpunct.c | ||
| 1432 | lib/iswxdigit.c | ||
| 1065 | lib/itold.c | 1433 | lib/itold.c |
| 1066 | lib/langinfo.in.h | 1434 | lib/langinfo.in.h |
| 1067 | lib/lc-charset-dispatch.c | 1435 | lib/lc-charset-dispatch.c |
| @@ -1073,6 +1441,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1073 | lib/locale.in.h | 1441 | lib/locale.in.h |
| 1074 | lib/localeconv.c | 1442 | lib/localeconv.c |
| 1075 | lib/lseek.c | 1443 | lib/lseek.c |
| 1444 | lib/lstat.c | ||
| 1076 | lib/malloc.c | 1445 | lib/malloc.c |
| 1077 | lib/malloc/dynarray-skeleton.c | 1446 | lib/malloc/dynarray-skeleton.c |
| 1078 | lib/malloc/dynarray.h | 1447 | lib/malloc/dynarray.h |
| @@ -1085,10 +1454,17 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1085 | lib/malloca.h | 1454 | lib/malloca.h |
| 1086 | lib/math.c | 1455 | lib/math.c |
| 1087 | lib/math.in.h | 1456 | lib/math.in.h |
| 1457 | lib/mbchar.c | ||
| 1458 | lib/mbchar.h | ||
| 1459 | lib/mbiterf.c | ||
| 1460 | lib/mbiterf.h | ||
| 1461 | lib/mbrtoc32.c | ||
| 1088 | lib/mbrtowc-impl-utf8.h | 1462 | lib/mbrtowc-impl-utf8.h |
| 1089 | lib/mbrtowc-impl.h | 1463 | lib/mbrtowc-impl.h |
| 1090 | lib/mbrtowc.c | 1464 | lib/mbrtowc.c |
| 1091 | lib/mbsinit.c | 1465 | lib/mbsinit.c |
| 1466 | lib/mbsnlen.c | ||
| 1467 | lib/mbszero.c | ||
| 1092 | lib/mbtowc-impl.h | 1468 | lib/mbtowc-impl.h |
| 1093 | lib/mbtowc-lock.c | 1469 | lib/mbtowc-lock.c |
| 1094 | lib/mbtowc-lock.h | 1470 | lib/mbtowc-lock.h |
| @@ -1114,6 +1490,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1114 | lib/printf-args.h | 1490 | lib/printf-args.h |
| 1115 | lib/printf-parse.c | 1491 | lib/printf-parse.c |
| 1116 | lib/printf-parse.h | 1492 | lib/printf-parse.h |
| 1493 | lib/pthread-once.c | ||
| 1494 | lib/pthread.in.h | ||
| 1117 | lib/realloc.c | 1495 | lib/realloc.c |
| 1118 | lib/reallocarray.c | 1496 | lib/reallocarray.c |
| 1119 | lib/regcomp.c | 1497 | lib/regcomp.c |
| @@ -1122,8 +1500,10 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1122 | lib/regex_internal.c | 1500 | lib/regex_internal.c |
| 1123 | lib/regex_internal.h | 1501 | lib/regex_internal.h |
| 1124 | lib/regexec.c | 1502 | lib/regexec.c |
| 1503 | lib/sched.in.h | ||
| 1125 | lib/setenv.c | 1504 | lib/setenv.c |
| 1126 | lib/setlocale-lock.c | 1505 | lib/setlocale-lock.c |
| 1506 | lib/setlocale_null-unlocked.c | ||
| 1127 | lib/setlocale_null.c | 1507 | lib/setlocale_null.c |
| 1128 | lib/setlocale_null.h | 1508 | lib/setlocale_null.h |
| 1129 | lib/sha256-stream.c | 1509 | lib/sha256-stream.c |
| @@ -1138,14 +1518,15 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1138 | lib/stat-w32.c | 1518 | lib/stat-w32.c |
| 1139 | lib/stat-w32.h | 1519 | lib/stat-w32.h |
| 1140 | lib/stat.c | 1520 | lib/stat.c |
| 1141 | lib/stdalign.in.h | ||
| 1142 | lib/stdckdint.in.h | 1521 | lib/stdckdint.in.h |
| 1143 | lib/stddef.in.h | 1522 | lib/stddef.in.h |
| 1144 | lib/stdint.in.h | 1523 | lib/stdint.in.h |
| 1524 | lib/stdio-consolesafe.c | ||
| 1145 | lib/stdio-impl.h | 1525 | lib/stdio-impl.h |
| 1146 | lib/stdio-read.c | 1526 | lib/stdio-read.c |
| 1147 | lib/stdio-write.c | 1527 | lib/stdio-write.c |
| 1148 | lib/stdio.in.h | 1528 | lib/stdio.in.h |
| 1529 | lib/stdlib.c | ||
| 1149 | lib/stdlib.in.h | 1530 | lib/stdlib.in.h |
| 1150 | lib/str-two-way.h | 1531 | lib/str-two-way.h |
| 1151 | lib/strcasecmp.c | 1532 | lib/strcasecmp.c |
| @@ -1158,6 +1539,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1158 | lib/strings.in.h | 1539 | lib/strings.in.h |
| 1159 | lib/stripslash.c | 1540 | lib/stripslash.c |
| 1160 | lib/strncasecmp.c | 1541 | lib/strncasecmp.c |
| 1542 | lib/strncpy.c | ||
| 1161 | lib/strsep.c | 1543 | lib/strsep.c |
| 1162 | lib/strstr.c | 1544 | lib/strstr.c |
| 1163 | lib/sys-limits.h | 1545 | lib/sys-limits.h |
| @@ -1169,8 +1551,46 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1169 | lib/time.in.h | 1551 | lib/time.in.h |
| 1170 | lib/time_r.c | 1552 | lib/time_r.c |
| 1171 | lib/timegm.c | 1553 | lib/timegm.c |
| 1554 | lib/uchar.in.h | ||
| 1555 | lib/unicase.in.h | ||
| 1556 | lib/unicase/simple-mapping.h | ||
| 1557 | lib/unicase/tolower.c | ||
| 1558 | lib/unicase/tolower.h | ||
| 1559 | lib/unictype.in.h | ||
| 1560 | lib/unictype/bitmap.h | ||
| 1561 | lib/unictype/ctype_alnum.c | ||
| 1562 | lib/unictype/ctype_alnum.h | ||
| 1563 | lib/unictype/ctype_alpha.c | ||
| 1564 | lib/unictype/ctype_alpha.h | ||
| 1565 | lib/unictype/ctype_blank.c | ||
| 1566 | lib/unictype/ctype_blank.h | ||
| 1567 | lib/unictype/ctype_cntrl.c | ||
| 1568 | lib/unictype/ctype_cntrl.h | ||
| 1569 | lib/unictype/ctype_digit.c | ||
| 1570 | lib/unictype/ctype_digit.h | ||
| 1571 | lib/unictype/ctype_graph.c | ||
| 1572 | lib/unictype/ctype_graph.h | ||
| 1573 | lib/unictype/ctype_lower.c | ||
| 1574 | lib/unictype/ctype_lower.h | ||
| 1575 | lib/unictype/ctype_print.c | ||
| 1576 | lib/unictype/ctype_print.h | ||
| 1577 | lib/unictype/ctype_punct.c | ||
| 1578 | lib/unictype/ctype_punct.h | ||
| 1579 | lib/unictype/ctype_space.c | ||
| 1580 | lib/unictype/ctype_space.h | ||
| 1581 | lib/unictype/ctype_upper.c | ||
| 1582 | lib/unictype/ctype_upper.h | ||
| 1583 | lib/unictype/ctype_xdigit.c | ||
| 1584 | lib/unictype/ctype_xdigit.h | ||
| 1585 | lib/uninorm.in.h | ||
| 1172 | lib/unistd.c | 1586 | lib/unistd.c |
| 1173 | lib/unistd.in.h | 1587 | lib/unistd.in.h |
| 1588 | lib/unitypes.in.h | ||
| 1589 | lib/uniwidth.in.h | ||
| 1590 | lib/uniwidth/cjk.h | ||
| 1591 | lib/uniwidth/width.c | ||
| 1592 | lib/uniwidth/width0.h | ||
| 1593 | lib/uniwidth/width2.h | ||
| 1174 | lib/unlocked-io.h | 1594 | lib/unlocked-io.h |
| 1175 | lib/unsetenv.c | 1595 | lib/unsetenv.c |
| 1176 | lib/vasnprintf.c | 1596 | lib/vasnprintf.c |
| @@ -1178,12 +1598,16 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1178 | lib/vasprintf.c | 1598 | lib/vasprintf.c |
| 1179 | lib/verify.h | 1599 | lib/verify.h |
| 1180 | lib/vsnprintf.c | 1600 | lib/vsnprintf.c |
| 1601 | lib/vsnzprintf.c | ||
| 1181 | lib/w32sock.h | 1602 | lib/w32sock.h |
| 1182 | lib/warn-on-use.h | 1603 | lib/warn-on-use.h |
| 1183 | lib/wchar.in.h | 1604 | lib/wchar.in.h |
| 1184 | lib/wcrtomb.c | 1605 | lib/wcrtomb.c |
| 1185 | lib/wctype-h.c | 1606 | lib/wctype-h.c |
| 1607 | lib/wctype-impl.h | ||
| 1608 | lib/wctype.c | ||
| 1186 | lib/wctype.in.h | 1609 | lib/wctype.in.h |
| 1610 | lib/wcwidth.c | ||
| 1187 | lib/windows-initguard.h | 1611 | lib/windows-initguard.h |
| 1188 | lib/windows-mutex.c | 1612 | lib/windows-mutex.c |
| 1189 | lib/windows-mutex.h | 1613 | lib/windows-mutex.h |
| @@ -1208,21 +1632,25 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1208 | m4/assert_h.m4 | 1632 | m4/assert_h.m4 |
| 1209 | m4/base64.m4 | 1633 | m4/base64.m4 |
| 1210 | m4/btowc.m4 | 1634 | m4/btowc.m4 |
| 1635 | m4/build-to-host.m4 | ||
| 1211 | m4/builtin-expect.m4 | 1636 | m4/builtin-expect.m4 |
| 1212 | m4/byteswap.m4 | 1637 | m4/byteswap.m4 |
| 1213 | m4/c-bool.m4 | 1638 | m4/c-bool.m4 |
| 1639 | m4/c32rtomb.m4 | ||
| 1214 | m4/calloc.m4 | 1640 | m4/calloc.m4 |
| 1215 | m4/close.m4 | 1641 | m4/close.m4 |
| 1216 | m4/codeset.m4 | 1642 | m4/codeset.m4 |
| 1217 | m4/double-slash-root.m4 | 1643 | m4/double-slash-root.m4 |
| 1218 | m4/dup2.m4 | 1644 | m4/dup2.m4 |
| 1219 | m4/eealloc.m4 | ||
| 1220 | m4/environ.m4 | 1645 | m4/environ.m4 |
| 1221 | m4/errno_h.m4 | 1646 | m4/errno_h.m4 |
| 1222 | m4/error.m4 | 1647 | m4/error.m4 |
| 1648 | m4/error_h.m4 | ||
| 1223 | m4/exponentd.m4 | 1649 | m4/exponentd.m4 |
| 1650 | m4/extensions-aix.m4 | ||
| 1224 | m4/extensions.m4 | 1651 | m4/extensions.m4 |
| 1225 | m4/extern-inline.m4 | 1652 | m4/extern-inline.m4 |
| 1653 | m4/fclose.m4 | ||
| 1226 | m4/fcntl-o.m4 | 1654 | m4/fcntl-o.m4 |
| 1227 | m4/fcntl.m4 | 1655 | m4/fcntl.m4 |
| 1228 | m4/fcntl_h.m4 | 1656 | m4/fcntl_h.m4 |
| @@ -1235,6 +1663,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1235 | m4/free.m4 | 1663 | m4/free.m4 |
| 1236 | m4/fseek.m4 | 1664 | m4/fseek.m4 |
| 1237 | m4/fseeko.m4 | 1665 | m4/fseeko.m4 |
| 1666 | m4/fseterr.m4 | ||
| 1238 | m4/fstat.m4 | 1667 | m4/fstat.m4 |
| 1239 | m4/fstypename.m4 | 1668 | m4/fstypename.m4 |
| 1240 | m4/fsusage.m4 | 1669 | m4/fsusage.m4 |
| @@ -1250,17 +1679,26 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1250 | m4/getprogname.m4 | 1679 | m4/getprogname.m4 |
| 1251 | m4/gl-openssl.m4 | 1680 | m4/gl-openssl.m4 |
| 1252 | m4/gnulib-common.m4 | 1681 | m4/gnulib-common.m4 |
| 1682 | m4/gnulib-i18n.m4 | ||
| 1253 | m4/hostent.m4 | 1683 | m4/hostent.m4 |
| 1254 | m4/idpriv.m4 | 1684 | m4/idpriv.m4 |
| 1255 | m4/include_next.m4 | 1685 | m4/include_next.m4 |
| 1256 | m4/inet_ntop.m4 | 1686 | m4/inet_ntop.m4 |
| 1687 | m4/inet_pton.m4 | ||
| 1257 | m4/intmax_t.m4 | 1688 | m4/intmax_t.m4 |
| 1258 | m4/inttypes.m4 | 1689 | m4/inttypes.m4 |
| 1259 | m4/inttypes_h.m4 | 1690 | m4/inttypes_h.m4 |
| 1691 | m4/iswblank.m4 | ||
| 1692 | m4/iswctype.m4 | ||
| 1693 | m4/iswdigit.m4 | ||
| 1694 | m4/iswpunct.m4 | ||
| 1695 | m4/iswxdigit.m4 | ||
| 1260 | m4/langinfo_h.m4 | 1696 | m4/langinfo_h.m4 |
| 1261 | m4/largefile.m4 | 1697 | m4/largefile.m4 |
| 1698 | m4/libunistring-base.m4 | ||
| 1262 | m4/limits-h.m4 | 1699 | m4/limits-h.m4 |
| 1263 | m4/localcharset.m4 | 1700 | m4/localcharset.m4 |
| 1701 | m4/locale-en.m4 | ||
| 1264 | m4/locale-fr.m4 | 1702 | m4/locale-fr.m4 |
| 1265 | m4/locale-ja.m4 | 1703 | m4/locale-ja.m4 |
| 1266 | m4/locale-zh.m4 | 1704 | m4/locale-zh.m4 |
| @@ -1268,9 +1706,13 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1268 | m4/localeconv.m4 | 1706 | m4/localeconv.m4 |
| 1269 | m4/lock.m4 | 1707 | m4/lock.m4 |
| 1270 | m4/lseek.m4 | 1708 | m4/lseek.m4 |
| 1709 | m4/lstat.m4 | ||
| 1271 | m4/malloc.m4 | 1710 | m4/malloc.m4 |
| 1272 | m4/malloca.m4 | 1711 | m4/malloca.m4 |
| 1273 | m4/math_h.m4 | 1712 | m4/math_h.m4 |
| 1713 | m4/mbchar.m4 | ||
| 1714 | m4/mbiter.m4 | ||
| 1715 | m4/mbrtoc32.m4 | ||
| 1274 | m4/mbrtowc.m4 | 1716 | m4/mbrtowc.m4 |
| 1275 | m4/mbsinit.m4 | 1717 | m4/mbsinit.m4 |
| 1276 | m4/mbstate_t.m4 | 1718 | m4/mbstate_t.m4 |
| @@ -1284,21 +1726,28 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1284 | m4/msvc-inval.m4 | 1726 | m4/msvc-inval.m4 |
| 1285 | m4/msvc-nothrow.m4 | 1727 | m4/msvc-nothrow.m4 |
| 1286 | m4/multiarch.m4 | 1728 | m4/multiarch.m4 |
| 1729 | m4/musl.m4 | ||
| 1287 | m4/netdb_h.m4 | 1730 | m4/netdb_h.m4 |
| 1288 | m4/netinet_in_h.m4 | 1731 | m4/netinet_in_h.m4 |
| 1289 | m4/nl_langinfo.m4 | 1732 | m4/nl_langinfo.m4 |
| 1290 | m4/nocrash.m4 | 1733 | m4/nocrash.m4 |
| 1734 | m4/off64_t.m4 | ||
| 1291 | m4/off_t.m4 | 1735 | m4/off_t.m4 |
| 1736 | m4/once.m4 | ||
| 1292 | m4/open-cloexec.m4 | 1737 | m4/open-cloexec.m4 |
| 1293 | m4/open-slash.m4 | 1738 | m4/open-slash.m4 |
| 1294 | m4/open.m4 | 1739 | m4/open.m4 |
| 1295 | m4/pathmax.m4 | 1740 | m4/pathmax.m4 |
| 1296 | m4/pid_t.m4 | 1741 | m4/pid_t.m4 |
| 1297 | m4/printf.m4 | 1742 | m4/printf.m4 |
| 1743 | m4/pthread-once.m4 | ||
| 1744 | m4/pthread-spin.m4 | ||
| 1745 | m4/pthread_h.m4 | ||
| 1298 | m4/pthread_rwlock_rdlock.m4 | 1746 | m4/pthread_rwlock_rdlock.m4 |
| 1299 | m4/realloc.m4 | 1747 | m4/realloc.m4 |
| 1300 | m4/reallocarray.m4 | 1748 | m4/reallocarray.m4 |
| 1301 | m4/regex.m4 | 1749 | m4/regex.m4 |
| 1750 | m4/sched_h.m4 | ||
| 1302 | m4/servent.m4 | 1751 | m4/servent.m4 |
| 1303 | m4/setenv.m4 | 1752 | m4/setenv.m4 |
| 1304 | m4/setlocale_null.m4 | 1753 | m4/setlocale_null.m4 |
| @@ -1314,18 +1763,22 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1314 | m4/stat.m4 | 1763 | m4/stat.m4 |
| 1315 | m4/std-gnu11.m4 | 1764 | m4/std-gnu11.m4 |
| 1316 | m4/stdalign.m4 | 1765 | m4/stdalign.m4 |
| 1766 | m4/stdckdint_h.m4 | ||
| 1317 | m4/stddef_h.m4 | 1767 | m4/stddef_h.m4 |
| 1318 | m4/stdint.m4 | 1768 | m4/stdint.m4 |
| 1319 | m4/stdint_h.m4 | 1769 | m4/stdint_h.m4 |
| 1320 | m4/stdio_h.m4 | 1770 | m4/stdio_h.m4 |
| 1321 | m4/stdlib_h.m4 | 1771 | m4/stdlib_h.m4 |
| 1322 | m4/strcase.m4 | 1772 | m4/strcasecmp.m4 |
| 1323 | m4/strcasestr.m4 | 1773 | m4/strcasestr.m4 |
| 1324 | m4/strerror.m4 | 1774 | m4/strerror.m4 |
| 1325 | m4/string_h.m4 | 1775 | m4/string_h.m4 |
| 1326 | m4/strings_h.m4 | 1776 | m4/strings_h.m4 |
| 1777 | m4/strncasecmp.m4 | ||
| 1778 | m4/strncpy.m4 | ||
| 1327 | m4/strsep.m4 | 1779 | m4/strsep.m4 |
| 1328 | m4/strstr.m4 | 1780 | m4/strstr.m4 |
| 1781 | m4/sys_cdefs_h.m4 | ||
| 1329 | m4/sys_socket_h.m4 | 1782 | m4/sys_socket_h.m4 |
| 1330 | m4/sys_stat_h.m4 | 1783 | m4/sys_stat_h.m4 |
| 1331 | m4/sys_types_h.m4 | 1784 | m4/sys_types_h.m4 |
| @@ -1334,8 +1787,13 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1334 | m4/time_h.m4 | 1787 | m4/time_h.m4 |
| 1335 | m4/time_r.m4 | 1788 | m4/time_r.m4 |
| 1336 | m4/timegm.m4 | 1789 | m4/timegm.m4 |
| 1790 | m4/uchar_h.m4 | ||
| 1337 | m4/ungetc.m4 | 1791 | m4/ungetc.m4 |
| 1792 | m4/unicase_h.m4 | ||
| 1793 | m4/unictype_h.m4 | ||
| 1794 | m4/uninorm_h.m4 | ||
| 1338 | m4/unistd_h.m4 | 1795 | m4/unistd_h.m4 |
| 1796 | m4/unitypes_h.m4 | ||
| 1339 | m4/unlocked-io.m4 | 1797 | m4/unlocked-io.m4 |
| 1340 | m4/vararrays.m4 | 1798 | m4/vararrays.m4 |
| 1341 | m4/vasnprintf.m4 | 1799 | m4/vasnprintf.m4 |
| @@ -1344,9 +1802,10 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1344 | m4/vsnprintf.m4 | 1802 | m4/vsnprintf.m4 |
| 1345 | m4/warn-on-use.m4 | 1803 | m4/warn-on-use.m4 |
| 1346 | m4/wchar_h.m4 | 1804 | m4/wchar_h.m4 |
| 1347 | m4/wchar_t.m4 | ||
| 1348 | m4/wcrtomb.m4 | 1805 | m4/wcrtomb.m4 |
| 1806 | m4/wctype.m4 | ||
| 1349 | m4/wctype_h.m4 | 1807 | m4/wctype_h.m4 |
| 1808 | m4/wcwidth.m4 | ||
| 1350 | m4/wint_t.m4 | 1809 | m4/wint_t.m4 |
| 1351 | m4/xalloc.m4 | 1810 | m4/xalloc.m4 |
| 1352 | m4/xsize.m4 | 1811 | m4/xsize.m4 |
diff --git a/gl/m4/gnulib-i18n.m4 b/gl/m4/gnulib-i18n.m4 new file mode 100644 index 00000000..868043e7 --- /dev/null +++ b/gl/m4/gnulib-i18n.m4 | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | # gnulib-i18n.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2005-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 | dnl From Bruno Haible. | ||
| 10 | |||
| 11 | dnl Support for internationalization of Gnulib code. | ||
| 12 | |||
| 13 | dnl GNULIB_I18N | ||
| 14 | dnl Sets GNULIB_LOCALEDIR to indicate where to find the gnulib.mo files. | ||
| 15 | dnl Also it defines GNULIB_LOCALEDIR as macro in config.h, that expands to | ||
| 16 | dnl the corresponding C string. | ||
| 17 | AC_DEFUN([GNULIB_I18N], | ||
| 18 | [ | ||
| 19 | dnl It is best to not test "$USE_NLS" here, because: It would be empty | ||
| 20 | dnl in case the package is internationalized but this macro is used before | ||
| 21 | dnl AM_GNU_GETTEXT. We would need to warn about this situation. But since | ||
| 22 | dnl this module is used as a dependency of many packages, such a warning is | ||
| 23 | dnl not welcome. | ||
| 24 | |||
| 25 | dnl Determine gnulib's localedir. | ||
| 26 | dnl Generally, accept an option --with-gnulib-prefix=PREFIX to indicate | ||
| 27 | dnl where to find gnulib's runtime data. | ||
| 28 | dnl Usually ${prefix}/share/locale, but can be influenced by the configure | ||
| 29 | dnl options --datarootdir and --localedir. | ||
| 30 | GNULIB_LOCALEDIR="${localedir}" | ||
| 31 | AC_ARG_WITH([gnulib-prefix], | ||
| 32 | [[ --with-gnulib-prefix=DIR search for gnulib's runtime data in DIR/share]], | ||
| 33 | [if test "X$withval" != "X" && test "X$withval" != "Xno"; then | ||
| 34 | GNULIB_LOCALEDIR="$withval/share/locale" | ||
| 35 | fi | ||
| 36 | ]) | ||
| 37 | AC_SUBST([GNULIB_LOCALEDIR]) | ||
| 38 | |||
| 39 | dnl Define GNULIB_LOCALEDIR_c and GNULIB_LOCALEDIR_c_make. | ||
| 40 | dnl Find the final value of GNULIB_LOCALEDIR. | ||
| 41 | gl_saved_prefix="${prefix}" | ||
| 42 | gl_saved_datarootdir="${datarootdir}" | ||
| 43 | gl_saved_localedir="${localedir}" | ||
| 44 | gl_saved_gnuliblocaledir="${GNULIB_LOCALEDIR}" | ||
| 45 | dnl Unfortunately, prefix gets only finally determined at the end of | ||
| 46 | dnl configure. | ||
| 47 | if test "X$prefix" = "XNONE"; then | ||
| 48 | prefix="$ac_default_prefix" | ||
| 49 | fi | ||
| 50 | eval datarootdir="$datarootdir" | ||
| 51 | eval localedir="$localedir" | ||
| 52 | eval GNULIB_LOCALEDIR="$GNULIB_LOCALEDIR" | ||
| 53 | gl_BUILD_TO_HOST([GNULIB_LOCALEDIR]) | ||
| 54 | GNULIB_LOCALEDIR="${gl_saved_gnuliblocaledir}" | ||
| 55 | localedir="${gl_saved_localedir}" | ||
| 56 | datarootdir="${gl_saved_datarootdir}" | ||
| 57 | prefix="${gl_saved_prefix}" | ||
| 58 | |||
| 59 | AC_DEFINE_UNQUOTED([GNULIB_LOCALEDIR], [${GNULIB_LOCALEDIR_c}], | ||
| 60 | [Define to the directory where to find the localizations of the translation domain 'gnulib', as a C string.]) | ||
| 61 | ]) | ||
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index a9dd569b..8634a6e9 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # gnulib-tool.m4 serial 4 | 1 | # gnulib-tool.m4 |
| 2 | dnl Copyright (C) 2004-2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2004-2005, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl The following macros need not be invoked explicitly. | 9 | dnl The following macros need not be invoked explicitly. |
| 8 | dnl Invoking them does nothing except to declare default arguments | 10 | dnl Invoking them does nothing except to declare default arguments |
| @@ -41,6 +43,9 @@ AC_DEFUN([gl_LIB], []) | |||
| 41 | dnl Usage: gl_LGPL or gl_LGPL([VERSION]) | 43 | dnl Usage: gl_LGPL or gl_LGPL([VERSION]) |
| 42 | AC_DEFUN([gl_LGPL], []) | 44 | AC_DEFUN([gl_LGPL], []) |
| 43 | 45 | ||
| 46 | dnl Usage: gl_GPL([VERSION]) | ||
| 47 | AC_DEFUN([gl_GPL], []) | ||
| 48 | |||
| 44 | dnl Usage: gl_MAKEFILE_NAME([FILENAME]) | 49 | dnl Usage: gl_MAKEFILE_NAME([FILENAME]) |
| 45 | AC_DEFUN([gl_MAKEFILE_NAME], []) | 50 | AC_DEFUN([gl_MAKEFILE_NAME], []) |
| 46 | 51 | ||
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 3b2cc2b2..9278285c 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # hostent.m4 serial 4 | 1 | # hostent.m4 |
| 2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_HOSTENT], | 9 | AC_DEFUN([gl_HOSTENT], |
| 8 | [ | 10 | [ |
| @@ -26,7 +28,7 @@ AC_DEFUN([gl_HOSTENT], | |||
| 26 | AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32], | 28 | AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32], |
| 27 | [gl_cv_w32_gethostbyname], | 29 | [gl_cv_w32_gethostbyname], |
| 28 | [gl_cv_w32_gethostbyname=no | 30 | [gl_cv_w32_gethostbyname=no |
| 29 | gl_save_LIBS="$LIBS" | 31 | gl_saved_LIBS="$LIBS" |
| 30 | LIBS="$LIBS -lws2_32" | 32 | LIBS="$LIBS -lws2_32" |
| 31 | AC_LINK_IFELSE( | 33 | AC_LINK_IFELSE( |
| 32 | [AC_LANG_PROGRAM( | 34 | [AC_LANG_PROGRAM( |
| @@ -38,7 +40,7 @@ AC_DEFUN([gl_HOSTENT], | |||
| 38 | ]], | 40 | ]], |
| 39 | [[gethostbyname(NULL);]])], | 41 | [[gethostbyname(NULL);]])], |
| 40 | [gl_cv_w32_gethostbyname=yes]) | 42 | [gl_cv_w32_gethostbyname=yes]) |
| 41 | LIBS="$gl_save_LIBS" | 43 | LIBS="$gl_saved_LIBS" |
| 42 | ]) | 44 | ]) |
| 43 | if test "$gl_cv_w32_gethostbyname" = "yes"; then | 45 | if test "$gl_cv_w32_gethostbyname" = "yes"; then |
| 44 | HOSTENT_LIB="-lws2_32" | 46 | HOSTENT_LIB="-lws2_32" |
diff --git a/gl/m4/idpriv.m4 b/gl/m4/idpriv.m4 index fc3dd17d..6e855e9a 100644 --- a/gl/m4/idpriv.m4 +++ b/gl/m4/idpriv.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # idpriv.m4 serial 1 | 1 | # idpriv.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_IDPRIV], | 9 | AC_DEFUN([gl_IDPRIV], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index 9f19215e..80de991e 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # include_next.m4 serial 26 | 1 | # include_next.m4 |
| 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 27 |
| 3 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Paul Eggert and Derek Price. | 9 | dnl From Paul Eggert and Derek Price. |
| 8 | 10 | ||
| @@ -74,17 +76,17 @@ EOF | |||
| 74 | #endif | 76 | #endif |
| 75 | #define DEFINED_IN_CONFTESTD2 | 77 | #define DEFINED_IN_CONFTESTD2 |
| 76 | EOF | 78 | EOF |
| 77 | gl_save_CPPFLAGS="$CPPFLAGS" | 79 | gl_saved_CPPFLAGS="$CPPFLAGS" |
| 78 | CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" | 80 | CPPFLAGS="$gl_saved_CPPFLAGS -Iconftestd1b -Iconftestd2" |
| 79 | dnl We intentionally avoid using AC_LANG_SOURCE here. | 81 | dnl We intentionally avoid using AC_LANG_SOURCE here. |
| 80 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], | 82 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], |
| 81 | [gl_cv_have_include_next=yes], | 83 | [gl_cv_have_include_next=yes], |
| 82 | [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" | 84 | [CPPFLAGS="$gl_saved_CPPFLAGS -Iconftestd1a -Iconftestd2" |
| 83 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], | 85 | AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], |
| 84 | [gl_cv_have_include_next=buggy], | 86 | [gl_cv_have_include_next=buggy], |
| 85 | [gl_cv_have_include_next=no]) | 87 | [gl_cv_have_include_next=no]) |
| 86 | ]) | 88 | ]) |
| 87 | CPPFLAGS="$gl_save_CPPFLAGS" | 89 | CPPFLAGS="$gl_saved_CPPFLAGS" |
| 88 | rm -rf conftestd1a conftestd1b conftestd2 | 90 | rm -rf conftestd1a conftestd1b conftestd2 |
| 89 | ]) | 91 | ]) |
| 90 | PRAGMA_SYSTEM_HEADER= | 92 | PRAGMA_SYSTEM_HEADER= |
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 48822d69..693bd51b 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # inet_ntop.m4 serial 21 | 1 | # inet_ntop.m4 |
| 2 | dnl Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 22 |
| 3 | dnl Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_INET_NTOP], | 9 | AC_DEFUN([gl_FUNC_INET_NTOP], |
| 8 | [ | 10 | [ |
| @@ -36,14 +38,14 @@ AC_DEFUN([gl_FUNC_INET_NTOP], | |||
| 36 | HAVE_DECL_INET_NTOP=0 | 38 | HAVE_DECL_INET_NTOP=0 |
| 37 | fi | 39 | fi |
| 38 | else | 40 | else |
| 39 | gl_save_LIBS=$LIBS | 41 | gl_saved_LIBS=$LIBS |
| 40 | AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], | 42 | AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], |
| 41 | [AC_CHECK_FUNCS([inet_ntop]) | 43 | [AC_CHECK_FUNCS([inet_ntop]) |
| 42 | if test $ac_cv_func_inet_ntop = no; then | 44 | if test $ac_cv_func_inet_ntop = no; then |
| 43 | HAVE_INET_NTOP=0 | 45 | HAVE_INET_NTOP=0 |
| 44 | fi | 46 | fi |
| 45 | ]) | 47 | ]) |
| 46 | LIBS=$gl_save_LIBS | 48 | LIBS=$gl_saved_LIBS |
| 47 | 49 | ||
| 48 | if test "$ac_cv_search_inet_ntop" != "no" \ | 50 | if test "$ac_cv_search_inet_ntop" != "no" \ |
| 49 | && test "$ac_cv_search_inet_ntop" != "none required"; then | 51 | && test "$ac_cv_search_inet_ntop" != "none required"; then |
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4 new file mode 100644 index 00000000..b6e59a25 --- /dev/null +++ b/gl/m4/inet_pton.m4 | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # inet_pton.m4 | ||
| 2 | # serial 20 | ||
| 3 | dnl Copyright (C) 2006, 2008-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_INET_PTON], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) | ||
| 12 | |||
| 13 | dnl Persuade Solaris <arpa/inet.h> to declare inet_pton. | ||
| 14 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 15 | |||
| 16 | AC_REQUIRE([AC_C_RESTRICT]) | ||
| 17 | |||
| 18 | dnl Most platforms that provide inet_pton define it in libc. | ||
| 19 | dnl Solaris 8..10 provide inet_pton in libnsl instead. | ||
| 20 | dnl Solaris 2.6..7 provide inet_pton in libresolv instead. | ||
| 21 | dnl Haiku provides it in -lnetwork. | ||
| 22 | dnl Native Windows provides it in -lws2_32 instead, with a declaration in | ||
| 23 | dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl | ||
| 24 | dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). | ||
| 25 | HAVE_INET_PTON=1 | ||
| 26 | INET_PTON_LIB= | ||
| 27 | gl_PREREQ_SYS_H_WINSOCK2 | ||
| 28 | if test $HAVE_WINSOCK2_H = 1; then | ||
| 29 | dnl It needs to be overridden, because the stdcall calling convention | ||
| 30 | dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid | ||
| 31 | dnl a name conflict at the linker level, even though the header file | ||
| 32 | dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600. | ||
| 33 | REPLACE_INET_PTON=1 | ||
| 34 | AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]]) | ||
| 35 | if test $ac_cv_have_decl_inet_pton = yes; then | ||
| 36 | INET_PTON_LIB="-lws2_32" | ||
| 37 | else | ||
| 38 | HAVE_DECL_INET_PTON=0 | ||
| 39 | fi | ||
| 40 | else | ||
| 41 | gl_saved_LIBS=$LIBS | ||
| 42 | AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [], | ||
| 43 | [AC_CHECK_FUNCS([inet_pton]) | ||
| 44 | if test $ac_cv_func_inet_pton = no; then | ||
| 45 | HAVE_INET_PTON=0 | ||
| 46 | fi | ||
| 47 | ]) | ||
| 48 | LIBS=$gl_saved_LIBS | ||
| 49 | |||
| 50 | if test "$ac_cv_search_inet_pton" != "no" \ | ||
| 51 | && test "$ac_cv_search_inet_pton" != "none required"; then | ||
| 52 | INET_PTON_LIB="$ac_cv_search_inet_pton" | ||
| 53 | fi | ||
| 54 | |||
| 55 | AC_CHECK_HEADERS_ONCE([netdb.h]) | ||
| 56 | AC_CHECK_DECLS([inet_pton],,, | ||
| 57 | [[#include <arpa/inet.h> | ||
| 58 | #if HAVE_NETDB_H | ||
| 59 | # include <netdb.h> | ||
| 60 | #endif | ||
| 61 | ]]) | ||
| 62 | if test $ac_cv_have_decl_inet_pton = no; then | ||
| 63 | HAVE_DECL_INET_PTON=0 | ||
| 64 | fi | ||
| 65 | fi | ||
| 66 | AC_SUBST([INET_PTON_LIB]) | ||
| 67 | ]) | ||
| 68 | |||
| 69 | # Prerequisites of lib/inet_pton.c. | ||
| 70 | AC_DEFUN([gl_PREREQ_INET_PTON], [ | ||
| 71 | AC_REQUIRE([gl_SOCKET_FAMILIES]) | ||
| 72 | ]) | ||
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index ef32e1b9..c1df7b27 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # intmax_t.m4 serial 9 | 1 | # intmax_t.m4 |
| 2 | dnl Copyright (C) 1997-2004, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 9 |
| 3 | dnl Copyright (C) 1997-2004, 2006-2007, 2009-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | dnl From Paul Eggert. | 10 | dnl From Paul Eggert. |
| 9 | 11 | ||
diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4 index bf2eab2b..63c82c61 100644 --- a/gl/m4/inttypes.m4 +++ b/gl/m4/inttypes.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # inttypes.m4 serial 36 | 1 | # inttypes.m4 |
| 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 37 |
| 3 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Derek Price, Bruno Haible. | 9 | dnl From Derek Price, Bruno Haible. |
| 8 | dnl Test whether <inttypes.h> is supported or must be substituted. | 10 | dnl Test whether <inttypes.h> is supported or must be substituted. |
| @@ -170,6 +172,10 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS], | |||
| 170 | HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) | 172 | HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) |
| 171 | HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) | 173 | HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) |
| 172 | HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) | 174 | HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) |
| 175 | HAVE_IMAXABS=1; AC_SUBST([HAVE_IMAXABS]) | ||
| 176 | HAVE_IMAXDIV=1; AC_SUBST([HAVE_IMAXDIV]) | ||
| 177 | REPLACE_IMAXABS=0; AC_SUBST([REPLACE_IMAXABS]) | ||
| 178 | REPLACE_IMAXDIV=0; AC_SUBST([REPLACE_IMAXDIV]) | ||
| 173 | REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) | 179 | REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) |
| 174 | REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) | 180 | REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) |
| 175 | INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) | 181 | INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) |
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 68c60e9d..ad939a53 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # inttypes_h.m4 serial 10 | 1 | # inttypes_h.m4 |
| 2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
| 3 | dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Paul Eggert. | 9 | dnl From Paul Eggert. |
| 8 | 10 | ||
diff --git a/gl/m4/iswblank.m4 b/gl/m4/iswblank.m4 new file mode 100644 index 00000000..d06b16a2 --- /dev/null +++ b/gl/m4/iswblank.m4 | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # iswblank.m4 | ||
| 2 | # serial 7 | ||
| 3 | dnl Copyright (C) 2011-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_ISWBLANK], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_WCTYPE_H]) | ||
| 13 | dnl Persuade glibc <wctype.h> to declare iswblank(). | ||
| 14 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 15 | gl_CHECK_FUNCS_ANDROID([iswblank], [[#include <wctype.h>]]) | ||
| 16 | AC_CHECK_DECLS([iswblank], , , [[ | ||
| 17 | #include <wchar.h> | ||
| 18 | #include <wctype.h> | ||
| 19 | ]]) | ||
| 20 | if test $ac_cv_func_iswblank = no; then | ||
| 21 | HAVE_ISWBLANK=0 | ||
| 22 | if test $ac_cv_have_decl_iswblank = yes \ | ||
| 23 | || case "$gl_cv_onwards_func_iswblank" in \ | ||
| 24 | future*) true ;; \ | ||
| 25 | *) false ;; \ | ||
| 26 | esac; then | ||
| 27 | REPLACE_ISWBLANK=1 | ||
| 28 | fi | ||
| 29 | fi | ||
| 30 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
| 31 | dnl Redefine all of iswcntrl, ..., towupper in <wctype.h>. | ||
| 32 | : | ||
| 33 | else | ||
| 34 | if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then | ||
| 35 | dnl Redefine only iswblank. | ||
| 36 | : | ||
| 37 | fi | ||
| 38 | fi | ||
| 39 | |||
| 40 | ]) | ||
diff --git a/gl/m4/iswctype.m4 b/gl/m4/iswctype.m4 new file mode 100644 index 00000000..f5a3b760 --- /dev/null +++ b/gl/m4/iswctype.m4 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # iswctype.m4 | ||
| 2 | # serial 3 | ||
| 3 | dnl Copyright (C) 2011-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_ISWCTYPE], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_WCTYPE_H]) | ||
| 13 | dnl Determine REPLACE_WCTYPE. | ||
| 14 | AC_REQUIRE([gl_FUNC_WCTYPE]) | ||
| 15 | ]) | ||
diff --git a/gl/m4/iswdigit.m4 b/gl/m4/iswdigit.m4 new file mode 100644 index 00000000..4582f598 --- /dev/null +++ b/gl/m4/iswdigit.m4 | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | # iswdigit.m4 | ||
| 2 | # serial 9 | ||
| 3 | dnl Copyright (C) 2020-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_ISWDIGIT], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_WCTYPE_H]) | ||
| 13 | AC_REQUIRE([gt_LOCALE_FR]) | ||
| 14 | AC_REQUIRE([gt_LOCALE_JA]) | ||
| 15 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) | ||
| 16 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
| 17 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 18 | |||
| 19 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
| 20 | dnl <wctype.h> redefines iswdigit already. | ||
| 21 | REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" | ||
| 22 | else | ||
| 23 | AC_CACHE_CHECK([whether iswdigit is ISO C compliant], | ||
| 24 | [gl_cv_func_iswdigit_works], | ||
| 25 | [ | ||
| 26 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
| 27 | dnl is present. | ||
| 28 | changequote(,)dnl | ||
| 29 | case "$host_os" in | ||
| 30 | # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android. | ||
| 31 | freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*) | ||
| 32 | gl_cv_func_iswdigit_works="guessing no" ;; | ||
| 33 | # Guess yes otherwise. | ||
| 34 | *) gl_cv_func_iswdigit_works="guessing yes" ;; | ||
| 35 | esac | ||
| 36 | changequote([,])dnl | ||
| 37 | if test $LOCALE_FR != none || test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then | ||
| 38 | AC_RUN_IFELSE( | ||
| 39 | [AC_LANG_SOURCE([[ | ||
| 40 | #include <locale.h> | ||
| 41 | #include <stdlib.h> | ||
| 42 | #include <string.h> | ||
| 43 | #include <wchar.h> | ||
| 44 | #include <wctype.h> | ||
| 45 | |||
| 46 | /* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ | ||
| 47 | static int | ||
| 48 | for_character (const char *s, size_t n) | ||
| 49 | { | ||
| 50 | mbstate_t state; | ||
| 51 | wchar_t wc; | ||
| 52 | size_t ret; | ||
| 53 | |||
| 54 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 55 | wc = (wchar_t) 0xBADFACE; | ||
| 56 | ret = mbrtowc (&wc, s, n, &state); | ||
| 57 | if (ret != n) | ||
| 58 | abort (); | ||
| 59 | |||
| 60 | return iswdigit (wc); | ||
| 61 | } | ||
| 62 | |||
| 63 | int | ||
| 64 | main (int argc, char *argv[]) | ||
| 65 | { | ||
| 66 | int is; | ||
| 67 | int result = 0; | ||
| 68 | |||
| 69 | if (strcmp ("$LOCALE_FR", "none") != 0 | ||
| 70 | && setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
| 71 | { | ||
| 72 | /* This fails on mingw, MSVC 14. */ | ||
| 73 | /* U+00B2 SUPERSCRIPT TWO */ | ||
| 74 | is = for_character ("\262", 1); | ||
| 75 | if (!(is == 0)) | ||
| 76 | result |= 1; | ||
| 77 | } | ||
| 78 | if (strcmp ("$LOCALE_JA", "none") != 0 | ||
| 79 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
| 80 | { | ||
| 81 | /* This fails on NetBSD 10.0. */ | ||
| 82 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
| 83 | is = for_character ("\243\261", 2); | ||
| 84 | if (!(is == 0)) | ||
| 85 | result |= 2; | ||
| 86 | } | ||
| 87 | if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 | ||
| 88 | && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) | ||
| 89 | { | ||
| 90 | /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ | ||
| 91 | /* U+0663 ARABIC-INDIC DIGIT THREE */ | ||
| 92 | is = for_character ("\331\243", 2); | ||
| 93 | if (!(is == 0)) | ||
| 94 | result |= 4; | ||
| 95 | /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ | ||
| 96 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
| 97 | is = for_character ("\357\274\221", 3); | ||
| 98 | if (!(is == 0)) | ||
| 99 | result |= 8; | ||
| 100 | } | ||
| 101 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 | ||
| 102 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
| 103 | { | ||
| 104 | /* This fails on NetBSD 10.0, Solaris 10, Solaris 11.4. */ | ||
| 105 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
| 106 | is = for_character ("\243\261", 2); | ||
| 107 | if (!(is == 0)) | ||
| 108 | result |= 16; | ||
| 109 | } | ||
| 110 | return result; | ||
| 111 | }]])], | ||
| 112 | [gl_cv_func_iswdigit_works=yes], | ||
| 113 | [gl_cv_func_iswdigit_works=no], | ||
| 114 | [:]) | ||
| 115 | fi | ||
| 116 | ]) | ||
| 117 | case "$gl_cv_func_iswdigit_works" in | ||
| 118 | *yes) ;; | ||
| 119 | *) REPLACE_ISWDIGIT=1 ;; | ||
| 120 | esac | ||
| 121 | fi | ||
| 122 | ]) | ||
diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4 new file mode 100644 index 00000000..d8e8d712 --- /dev/null +++ b/gl/m4/iswpunct.m4 | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | # iswpunct.m4 | ||
| 2 | # serial 2 | ||
| 3 | dnl Copyright (C) 2023-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_ISWPUNCT], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_WCTYPE_H]) | ||
| 13 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 14 | |||
| 15 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
| 16 | dnl <wctype.h> redefines iswpunct already. | ||
| 17 | REPLACE_ISWPUNCT="$REPLACE_ISWCNTRL" | ||
| 18 | else | ||
| 19 | AC_CACHE_CHECK([whether iswpunct is consistent with ispunct], | ||
| 20 | [gl_cv_func_iswpunct_works], | ||
| 21 | [AC_RUN_IFELSE( | ||
| 22 | [AC_LANG_SOURCE([[ | ||
| 23 | #include <ctype.h> | ||
| 24 | #include <wchar.h> | ||
| 25 | #include <wctype.h> | ||
| 26 | int | ||
| 27 | main (int argc, char *argv[]) | ||
| 28 | { | ||
| 29 | int result = 0; | ||
| 30 | /* This fails on Android 11. */ | ||
| 31 | if ((! iswpunct ('\`')) != (! ispunct ('\`'))) | ||
| 32 | result |= 1; | ||
| 33 | return result; | ||
| 34 | }]])], | ||
| 35 | [gl_cv_func_iswpunct_works=yes], | ||
| 36 | [gl_cv_func_iswpunct_works=no], | ||
| 37 | [case "$host_os" in | ||
| 38 | # Guess no on Android. | ||
| 39 | android*) gl_cv_func_iswpunct_works="guessing no" ;; | ||
| 40 | # Guess yes otherwise. | ||
| 41 | *) gl_cv_func_iswpunct_works="guessing yes" ;; | ||
| 42 | esac | ||
| 43 | ]) | ||
| 44 | ]) | ||
| 45 | case "$gl_cv_func_iswpunct_works" in | ||
| 46 | *yes) ;; | ||
| 47 | *) REPLACE_ISWPUNCT=1 ;; | ||
| 48 | esac | ||
| 49 | fi | ||
| 50 | ]) | ||
diff --git a/gl/m4/iswxdigit.m4 b/gl/m4/iswxdigit.m4 new file mode 100644 index 00000000..95226fc4 --- /dev/null +++ b/gl/m4/iswxdigit.m4 | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | # iswxdigit.m4 | ||
| 2 | # serial 9 | ||
| 3 | dnl Copyright (C) 2020-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_ISWXDIGIT], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_WCTYPE_H]) | ||
| 13 | AC_REQUIRE([gt_LOCALE_JA]) | ||
| 14 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) | ||
| 15 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
| 16 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 17 | |||
| 18 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | ||
| 19 | dnl <wctype.h> redefines iswxdigit already. | ||
| 20 | REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" | ||
| 21 | else | ||
| 22 | AC_CACHE_CHECK([whether iswxdigit is ISO C compliant], | ||
| 23 | [gl_cv_func_iswxdigit_works], | ||
| 24 | [ | ||
| 25 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
| 26 | dnl is present. | ||
| 27 | changequote(,)dnl | ||
| 28 | case "$host_os" in | ||
| 29 | # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android. | ||
| 30 | freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*) | ||
| 31 | gl_cv_func_iswxdigit_works="guessing no" ;; | ||
| 32 | # Guess yes otherwise. | ||
| 33 | *) gl_cv_func_iswxdigit_works="guessing yes" ;; | ||
| 34 | esac | ||
| 35 | changequote([,])dnl | ||
| 36 | if test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then | ||
| 37 | AC_RUN_IFELSE( | ||
| 38 | [AC_LANG_SOURCE([[ | ||
| 39 | #include <locale.h> | ||
| 40 | #include <stdlib.h> | ||
| 41 | #include <string.h> | ||
| 42 | #include <wchar.h> | ||
| 43 | #include <wctype.h> | ||
| 44 | |||
| 45 | /* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ | ||
| 46 | static int | ||
| 47 | for_character (const char *s, size_t n) | ||
| 48 | { | ||
| 49 | mbstate_t state; | ||
| 50 | wchar_t wc; | ||
| 51 | size_t ret; | ||
| 52 | |||
| 53 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 54 | wc = (wchar_t) 0xBADFACE; | ||
| 55 | ret = mbrtowc (&wc, s, n, &state); | ||
| 56 | if (ret != n) | ||
| 57 | abort (); | ||
| 58 | |||
| 59 | return iswxdigit (wc); | ||
| 60 | } | ||
| 61 | |||
| 62 | int | ||
| 63 | main (int argc, char *argv[]) | ||
| 64 | { | ||
| 65 | int is; | ||
| 66 | int result = 0; | ||
| 67 | |||
| 68 | if (strcmp ("$LOCALE_JA", "none") != 0 | ||
| 69 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
| 70 | { | ||
| 71 | /* This fails on NetBSD 10.0. */ | ||
| 72 | /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ | ||
| 73 | is = for_character ("\243\301", 2); | ||
| 74 | if (!(is == 0)) | ||
| 75 | result |= 1; | ||
| 76 | } | ||
| 77 | if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 | ||
| 78 | && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) | ||
| 79 | { | ||
| 80 | /* This fails on FreeBSD 13.0, Haiku, Android. */ | ||
| 81 | /* U+0663 ARABIC-INDIC DIGIT THREE */ | ||
| 82 | is = for_character ("\331\243", 2); | ||
| 83 | if (!(is == 0)) | ||
| 84 | result |= 2; | ||
| 85 | /* This fails on NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ | ||
| 86 | /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ | ||
| 87 | is = for_character ("\357\274\241", 3); | ||
| 88 | if (!(is == 0)) | ||
| 89 | result |= 4; | ||
| 90 | } | ||
| 91 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 | ||
| 92 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
| 93 | { | ||
| 94 | /* This fails on Solaris 10, Solaris 11.4. */ | ||
| 95 | /* U+FF11 FULLWIDTH DIGIT ONE */ | ||
| 96 | is = for_character ("\243\261", 2); | ||
| 97 | if (!(is == 0)) | ||
| 98 | result |= 8; | ||
| 99 | } | ||
| 100 | return result; | ||
| 101 | }]])], | ||
| 102 | [gl_cv_func_iswxdigit_works=yes], | ||
| 103 | [gl_cv_func_iswxdigit_works=no], | ||
| 104 | [:]) | ||
| 105 | fi | ||
| 106 | ]) | ||
| 107 | case "$gl_cv_func_iswxdigit_works" in | ||
| 108 | *yes) ;; | ||
| 109 | *) REPLACE_ISWXDIGIT=1 ;; | ||
| 110 | esac | ||
| 111 | fi | ||
| 112 | ]) | ||
diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4 index b17a526a..69f936f0 100644 --- a/gl/m4/langinfo_h.m4 +++ b/gl/m4/langinfo_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # langinfo_h.m4 serial 12 | 1 | # langinfo_h.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 13 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_LANGINFO_H], | 9 | AC_DEFUN_ONCE([gl_LANGINFO_H], |
| 8 | [ | 10 | [ |
| @@ -18,6 +20,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H], | |||
| 18 | HAVE_LANGINFO_CODESET=0 | 20 | HAVE_LANGINFO_CODESET=0 |
| 19 | HAVE_LANGINFO_T_FMT_AMPM=0 | 21 | HAVE_LANGINFO_T_FMT_AMPM=0 |
| 20 | HAVE_LANGINFO_ALTMON=0 | 22 | HAVE_LANGINFO_ALTMON=0 |
| 23 | HAVE_LANGINFO_ABALTMON=0 | ||
| 21 | HAVE_LANGINFO_ERA=0 | 24 | HAVE_LANGINFO_ERA=0 |
| 22 | HAVE_LANGINFO_YESEXPR=0 | 25 | HAVE_LANGINFO_YESEXPR=0 |
| 23 | AC_CHECK_HEADERS_ONCE([langinfo.h]) | 26 | AC_CHECK_HEADERS_ONCE([langinfo.h]) |
| @@ -28,6 +31,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H], | |||
| 28 | dnl ERA etc. are missing on OpenBSD 6.7. | 31 | dnl ERA etc. are missing on OpenBSD 6.7. |
| 29 | dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. | 32 | dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. |
| 30 | dnl ALTMON_* are missing on glibc 2.26 and many other systems. | 33 | dnl ALTMON_* are missing on glibc 2.26 and many other systems. |
| 34 | dnl ABALTMON_* are missing on glibc 2.41 and many other systems. | ||
| 31 | AC_CACHE_CHECK([whether langinfo.h defines CODESET], | 35 | AC_CACHE_CHECK([whether langinfo.h defines CODESET], |
| 32 | [gl_cv_header_langinfo_codeset], | 36 | [gl_cv_header_langinfo_codeset], |
| 33 | [AC_COMPILE_IFELSE( | 37 | [AC_COMPILE_IFELSE( |
| @@ -64,6 +68,18 @@ int a = ALTMON_1; | |||
| 64 | if test $gl_cv_header_langinfo_altmon = yes; then | 68 | if test $gl_cv_header_langinfo_altmon = yes; then |
| 65 | HAVE_LANGINFO_ALTMON=1 | 69 | HAVE_LANGINFO_ALTMON=1 |
| 66 | fi | 70 | fi |
| 71 | AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1], | ||
| 72 | [gl_cv_header_langinfo_abaltmon], | ||
| 73 | [AC_COMPILE_IFELSE( | ||
| 74 | [AC_LANG_PROGRAM([[#include <langinfo.h> | ||
| 75 | int a = ABALTMON_1; | ||
| 76 | ]])], | ||
| 77 | [gl_cv_header_langinfo_abaltmon=yes], | ||
| 78 | [gl_cv_header_langinfo_abaltmon=no]) | ||
| 79 | ]) | ||
| 80 | if test $gl_cv_header_langinfo_abaltmon = yes; then | ||
| 81 | HAVE_LANGINFO_ABALTMON=1 | ||
| 82 | fi | ||
| 67 | AC_CACHE_CHECK([whether langinfo.h defines ERA], | 83 | AC_CACHE_CHECK([whether langinfo.h defines ERA], |
| 68 | [gl_cv_header_langinfo_era], | 84 | [gl_cv_header_langinfo_era], |
| 69 | [AC_COMPILE_IFELSE( | 85 | [AC_COMPILE_IFELSE( |
| @@ -95,6 +111,7 @@ int a = YESEXPR; | |||
| 95 | AC_SUBST([HAVE_LANGINFO_CODESET]) | 111 | AC_SUBST([HAVE_LANGINFO_CODESET]) |
| 96 | AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) | 112 | AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) |
| 97 | AC_SUBST([HAVE_LANGINFO_ALTMON]) | 113 | AC_SUBST([HAVE_LANGINFO_ALTMON]) |
| 114 | AC_SUBST([HAVE_LANGINFO_ABALTMON]) | ||
| 98 | AC_SUBST([HAVE_LANGINFO_ERA]) | 115 | AC_SUBST([HAVE_LANGINFO_ERA]) |
| 99 | AC_SUBST([HAVE_LANGINFO_YESEXPR]) | 116 | AC_SUBST([HAVE_LANGINFO_YESEXPR]) |
| 100 | 117 | ||
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 7fb81b86..b24f657d 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 | |||
| @@ -1,16 +1,19 @@ | |||
| 1 | # largefile.m4 | ||
| 2 | # serial 2 | ||
| 3 | dnl Copyright 1992-1996, 1998-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 | |||
| 1 | # Enable large files on systems where this is not the default. | 9 | # Enable large files on systems where this is not the default. |
| 2 | # Enable support for files on Linux file systems with 64-bit inode numbers. | 10 | # Enable support for files on Linux file systems with 64-bit inode numbers. |
| 3 | 11 | ||
| 4 | # Copyright 1992-1996, 1998-2023 Free Software Foundation, Inc. | ||
| 5 | # This file is free software; the Free Software Foundation | ||
| 6 | # gives unlimited permission to copy and/or distribute it, | ||
| 7 | # with or without modifications, as long as this notice is preserved. | ||
| 8 | |||
| 9 | # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: | 12 | # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: |
| 10 | # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this | 13 | # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this |
| 11 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko | 14 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko |
| 12 | # and ftello in C++ mode as well. | 15 | # and ftello in C++ mode as well. |
| 13 | # Fixed in Autoconf 2.72, which has AC_SYS_YEAR2038. | 16 | # This problem occurs in Autoconf 2.71 and earlier, which lack AC_SYS_YEAR2038. |
| 14 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | 17 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], |
| 15 | m4_ifndef([AC_SYS_YEAR2038], [[ | 18 | m4_ifndef([AC_SYS_YEAR2038], [[ |
| 16 | AC_REQUIRE([AC_CANONICAL_HOST]) | 19 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| @@ -24,29 +27,20 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | |||
| 24 | ]]) | 27 | ]]) |
| 25 | ) | 28 | ) |
| 26 | 29 | ||
| 27 | # Work around a problem in autoconf <= 2.69: | 30 | dnl Remove AC_SYS_YEAR2038_RECOMMENDED if unpatched Autoconf 2.72 or earlier. |
| 28 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, | 31 | dnl Autoconf 2.72 still uses -n32, which is not a C preprocessor option, |
| 29 | # or configures them incorrectly in some cases. | 32 | dnl and which was useful only on IRIX which is no longer supported. |
| 30 | m4_version_prereq([2.70], [], [ | 33 | dnl This should be fixed in Autoconf 2.73. |
| 31 | 34 | m4_ifdef([AC_SYS_YEAR2038_RECOMMENDED], | |
| 32 | # _AC_SYS_LARGEFILE_TEST_INCLUDES | 35 | [m4_bmatch(m4_ifdef([_AC_SYS_LARGEFILE_OPTIONS], |
| 33 | # ------------------------------- | 36 | [m4_defn([_AC_SYS_LARGEFILE_OPTIONS])], |
| 34 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], | 37 | ["-n32"]), |
| 35 | [#include <sys/types.h> | 38 | ["-n32"], |
| 36 | /* Check that off_t can represent 2**63 - 1 correctly. | 39 | [m4_undefine([AC_SYS_YEAR2038_RECOMMENDED])])]) |
| 37 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||
| 38 | since some C++ compilers masquerading as C compilers | ||
| 39 | incorrectly reject 9223372036854775807. */ | ||
| 40 | #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | ||
| 41 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | ||
| 42 | && LARGE_OFF_T % 2147483647 == 1) | ||
| 43 | ? 1 : -1]];[]dnl | ||
| 44 | ]) | ||
| 45 | ])# m4_version_prereq 2.70 | ||
| 46 | 40 | ||
| 47 | # Support AC_SYS_YEAR2038, even if Autoconf 2.71 or earlier. | 41 | m4_ifndef([AC_SYS_YEAR2038_RECOMMENDED], [ |
| 48 | # This code is taken from Autoconf master. | 42 | # Fix up AC_SYS_YEAR2038_RECOMMENDED and related macros, even if |
| 49 | m4_ifndef([AC_SYS_YEAR2038], [ | 43 | # unpatched Autoconf 2.72 or earlier. This code is taken from Autoconf master. |
| 50 | 44 | ||
| 51 | # _AC_SYS_YEAR2038_TEST_CODE | 45 | # _AC_SYS_YEAR2038_TEST_CODE |
| 52 | # -------------------------- | 46 | # -------------------------- |
| @@ -78,8 +72,8 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | |||
| 78 | dnl 32-bit MinGW (misconfiguration) | 72 | dnl 32-bit MinGW (misconfiguration) |
| 79 | )) | 73 | )) |
| 80 | 74 | ||
| 81 | # _AC_SYS_YEAR2038_PROBE([IF-NOT-DETECTED]) | 75 | # _AC_SYS_YEAR2038_PROBE |
| 82 | # ----------------------------------------- | 76 | # ---------------------- |
| 83 | # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent | 77 | # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent |
| 84 | # time points more than 2**31 - 1 seconds after the epoch (dates after | 78 | # time points more than 2**31 - 1 seconds after the epoch (dates after |
| 85 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts | 79 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts |
| @@ -92,13 +86,10 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | |||
| 92 | # AC_TRY_RUN. Note also that some systems only support large time_t | 86 | # AC_TRY_RUN. Note also that some systems only support large time_t |
| 93 | # together with large off_t. | 87 | # together with large off_t. |
| 94 | # | 88 | # |
| 95 | # If support is not detected, the behavior depends on which of the | ||
| 96 | # top-level AC_SYS_YEAR2038 macros was used (see below). | ||
| 97 | # | ||
| 98 | # If you change this macro you may also need to change | 89 | # If you change this macro you may also need to change |
| 99 | # _AC_SYS_YEAR2038_OPTIONS. | 90 | # _AC_SYS_YEAR2038_OPTIONS. |
| 100 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], | 91 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], |
| 101 | [AC_CACHE_CHECK([for $CC option to enable timestamps after Jan 2038], | 92 | [AC_CACHE_CHECK([for $CC option to support timestamps after 2038], |
| 102 | [ac_cv_sys_year2038_opts], | 93 | [ac_cv_sys_year2038_opts], |
| 103 | [ac_save_CPPFLAGS="$CPPFLAGS" | 94 | [ac_save_CPPFLAGS="$CPPFLAGS" |
| 104 | ac_opt_found=no | 95 | ac_opt_found=no |
| @@ -117,40 +108,20 @@ ac_have_year2038=yes | |||
| 117 | AS_CASE([$ac_cv_sys_year2038_opts], | 108 | AS_CASE([$ac_cv_sys_year2038_opts], |
| 118 | ["none needed"], [], | 109 | ["none needed"], [], |
| 119 | ["support not detected"], | 110 | ["support not detected"], |
| 120 | [ac_have_year2038=no | 111 | [ac_have_year2038=no], |
| 121 | AS_CASE([$enable_year2038], | ||
| 122 | [yes], | ||
| 123 | [# If we're not cross compiling and 'touch' works with a large | ||
| 124 | # timestamp, then we can presume the system supports wider time_t | ||
| 125 | # *somehow* and we just weren't able to detect it. One common | ||
| 126 | # case that we deliberately *don't* probe for is a system that | ||
| 127 | # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers | ||
| 128 | # wide time_t. (It would be inappropriate for us to override an | ||
| 129 | # intentional use of -m32.) Error out, demanding use of | ||
| 130 | # --disable-year2038 if this is intentional. | ||
| 131 | AS_IF([test $cross_compiling = no], | ||
| 132 | [AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], | ||
| 133 | [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], | ||
| 134 | [*'Feb 7 2106'* | *'Feb 7 17:10'*], | ||
| 135 | [AC_MSG_FAILURE(m4_text_wrap( | ||
| 136 | [this system appears to support timestamps after January 2038, | ||
| 137 | but no mechanism for enabling wide 'time_t' was detected. | ||
| 138 | Did you mean to build a 64-bit binary? (e.g. 'CC="${CC} -m64"'.) | ||
| 139 | To proceed with 32-bit time_t, configure with '--disable-year2038'.], | ||
| 140 | [], [], [55]))])])])])], | ||
| 141 | 112 | ||
| 142 | ["-D_TIME_BITS=64"], | 113 | ["-D_TIME_BITS=64"], |
| 143 | [AC_DEFINE([_TIME_BITS], [64], | 114 | [AC_DEFINE([_TIME_BITS], [64], |
| 144 | [Number of bits in time_t, on hosts where this is settable.])], | 115 | [Number of bits in time_t, on hosts where this is settable.])], |
| 145 | 116 | ||
| 146 | ["-D__MINGW_USE_VC2005_COMPAT=1"], | 117 | ["-D__MINGW_USE_VC2005_COMPAT"], |
| 147 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], | 118 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], |
| 148 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], | 119 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], |
| 149 | 120 | ||
| 150 | ["-U_USE_32_BIT_TIME_T"*], | 121 | ["-U_USE_32_BIT_TIME_T"*], |
| 151 | [AC_MSG_FAILURE(m4_text_wrap( | 122 | [AC_MSG_FAILURE(m4_text_wrap( |
| 152 | [the 'time_t' type is currently forced to be 32-bit. | 123 | [the 'time_t' type is currently forced to be 32-bit. |
| 153 | It will stop working after January 2038. | 124 | It will stop working after mid-January 2038. |
| 154 | Remove _USE_32BIT_TIME_T from the compiler flags.], | 125 | Remove _USE_32BIT_TIME_T from the compiler flags.], |
| 155 | [], [], [55]))], | 126 | [], [], [55]))], |
| 156 | 127 | ||
| @@ -160,12 +131,11 @@ AS_CASE([$ac_cv_sys_year2038_opts], | |||
| 160 | 131 | ||
| 161 | # _AC_SYS_YEAR2038_ENABLE | 132 | # _AC_SYS_YEAR2038_ENABLE |
| 162 | # ----------------------- | 133 | # ----------------------- |
| 163 | # Subroutine of AC_SYS_YEAR2038 and _AC_SYS_YEAR2038_OPT_IN. | ||
| 164 | # Depending on which of the YEAR2038 macros was used, add either an | 134 | # Depending on which of the YEAR2038 macros was used, add either an |
| 165 | # --enable-year2038, or a --disable-year2038, or no option at all to | 135 | # --enable-year2038 or a --disable-year2038 to |
| 166 | # the configure script. Note that this is expanded very late and | 136 | # the configure script. This is expanded very late and |
| 167 | # therefore there cannot be any code in the AC_ARG_ENABLE. The | 137 | # therefore there cannot be any code in the AC_ARG_ENABLE. The |
| 168 | # default value for enable_year2038 is emitted unconditionally | 138 | # default value for 'enable_year2038' is emitted unconditionally |
| 169 | # because the generated code always looks at this variable. | 139 | # because the generated code always looks at this variable. |
| 170 | m4_define([_AC_SYS_YEAR2038_ENABLE], | 140 | m4_define([_AC_SYS_YEAR2038_ENABLE], |
| 171 | [m4_divert_text([DEFAULTS], | 141 | [m4_divert_text([DEFAULTS], |
| @@ -175,50 +145,70 @@ m4_define([_AC_SYS_YEAR2038_ENABLE], | |||
| 175 | [AC_ARG_ENABLE([year2038], | 145 | [AC_ARG_ENABLE([year2038], |
| 176 | m4_provide_if([AC_SYS_YEAR2038], | 146 | m4_provide_if([AC_SYS_YEAR2038], |
| 177 | [AS_HELP_STRING([--disable-year2038], | 147 | [AS_HELP_STRING([--disable-year2038], |
| 178 | [do not support timestamps after 2038])], | 148 | [don't support timestamps after 2038])], |
| 179 | [AS_HELP_STRING([--enable-year2038], | 149 | [AS_HELP_STRING([--enable-year2038], |
| 180 | [support timestamps after 2038])]))]) | 150 | [support timestamps after 2038])]))]) |
| 181 | 151 | ||
| 182 | # _AC_SYS_YEAR2038_OPT_IN | ||
| 183 | # ----------------------- | ||
| 184 | # If the --enable-year2038 option is given to configure, attempt to | ||
| 185 | # detect and activate support for large time_t on 32-bit systems. | ||
| 186 | # This macro is automatically invoked by AC_SYS_LARGEFILE when large | ||
| 187 | # *file* support is detected. It does not AC_REQUIRE AC_SYS_LARGEFILE | ||
| 188 | # to avoid a dependency loop, and is therefore unsafe to expose as a | ||
| 189 | # documented macro. | ||
| 190 | AC_DEFUN([_AC_SYS_YEAR2038_OPT_IN], | ||
| 191 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | ||
| 192 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | ||
| 193 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | ||
| 194 | ])]) | ||
| 195 | |||
| 196 | # AC_SYS_YEAR2038 | 152 | # AC_SYS_YEAR2038 |
| 197 | # --------------- | 153 | # --------------- |
| 198 | # Attempt to detect and activate support for large time_t. | 154 | # Attempt to detect and activate support for large time_t. |
| 199 | # On systems where time_t is not always 64 bits, this probe can be | 155 | # On systems where time_t is not always 64 bits, this probe can be |
| 200 | # skipped by passing the --disable-year2038 option to configure. | 156 | # skipped by passing the --disable-year2038 option to configure. |
| 201 | AC_DEFUN([AC_SYS_YEAR2038], | 157 | AC_DEFUN([AC_SYS_YEAR2038], |
| 202 | [AC_REQUIRE([AC_SYS_LARGEFILE])]dnl | 158 | [AC_REQUIRE([AC_SYS_LARGEFILE])dnl |
| 203 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | 159 | AS_IF([test "$enable_year2038,$ac_have_year2038,$cross_compiling" = yes,no,no], |
| 204 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | 160 | [# If we're not cross compiling and 'touch' works with a large |
| 205 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | 161 | # timestamp, then we can presume the system supports wider time_t |
| 206 | ])]) | 162 | # *somehow* and we just weren't able to detect it. One common |
| 163 | # case that we deliberately *don't* probe for is a system that | ||
| 164 | # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers | ||
| 165 | # wide time_t. (It would be inappropriate for us to override an | ||
| 166 | # intentional use of -m32.) Error out, demanding use of | ||
| 167 | # --disable-year2038 if this is intentional. | ||
| 168 | AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], | ||
| 169 | [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], | ||
| 170 | [*'Feb 7 2106'* | *'Feb 7 17:10'*], | ||
| 171 | [AC_MSG_FAILURE(m4_text_wrap( | ||
| 172 | [this system appears to support timestamps after mid-January 2038, | ||
| 173 | but no mechanism for enabling wide 'time_t' was detected. | ||
| 174 | Did you mean to build a 64-bit binary? (E.g., 'CC="${CC} -m64"'.) | ||
| 175 | To proceed with 32-bit time_t, configure with '--disable-year2038'.], | ||
| 176 | [], [], [55]))])])])]) | ||
| 177 | |||
| 178 | # AC_SYS_YEAR2038_RECOMMENDED | ||
| 179 | # --------------------------- | ||
| 180 | # Same as AC_SYS_YEAR2038, but recommend support for large time_t. | ||
| 181 | # If we cannot find any way to make time_t capable of representing | ||
| 182 | # values larger than 2**31 - 1, error out unless --disable-year2038 is given. | ||
| 183 | AC_DEFUN([AC_SYS_YEAR2038_RECOMMENDED], | ||
| 184 | [AC_REQUIRE([AC_SYS_YEAR2038])dnl | ||
| 185 | AS_IF([test "$enable_year2038,$ac_have_year2038" = yes,no], | ||
| 186 | [AC_MSG_FAILURE(m4_text_wrap( | ||
| 187 | [could not enable timestamps after mid-January 2038. | ||
| 188 | This package recommends support for these later timestamps. | ||
| 189 | However, to proceed with signed 32-bit time_t even though it | ||
| 190 | will fail then, configure with '--disable-year2038'.], | ||
| 191 | [], [], [55]))])]) | ||
| 207 | 192 | ||
| 208 | # _AC_SYS_LARGEFILE_TEST_CODE | 193 | # _AC_SYS_LARGEFILE_TEST_CODE |
| 209 | # --------------------------- | 194 | # --------------------------- |
| 210 | # C code used to probe for large file support. | 195 | # C code used to probe for large file support. |
| 211 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | 196 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], |
| 212 | [@%:@include <sys/types.h> | 197 | [@%:@include <sys/types.h> |
| 213 | /* Check that off_t can represent 2**63 - 1 correctly. | 198 | @%:@ifndef FTYPE |
| 214 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | 199 | @%:@ define FTYPE off_t |
| 200 | @%:@endif | ||
| 201 | /* Check that FTYPE can represent 2**63 - 1 correctly. | ||
| 202 | We can't simply define LARGE_FTYPE to be 9223372036854775807, | ||
| 215 | since some C++ compilers masquerading as C compilers | 203 | since some C++ compilers masquerading as C compilers |
| 216 | incorrectly reject 9223372036854775807. */ | 204 | incorrectly reject 9223372036854775807. */ |
| 217 | @%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | 205 | @%:@define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) |
| 218 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | 206 | int FTYPE_is_large[[(LARGE_FTYPE % 2147483629 == 721 |
| 219 | && LARGE_OFF_T % 2147483647 == 1) | 207 | && LARGE_FTYPE % 2147483647 == 1) |
| 220 | ? 1 : -1]];[]dnl | 208 | ? 1 : -1]];[]dnl |
| 221 | ]) | 209 | ]) |
| 210 | # Defined by Autoconf 2.71 and circa 2022 Gnulib unwisely depended on it. | ||
| 211 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], [_AC_SYS_LARGEFILE_TEST_CODE]) | ||
| 222 | 212 | ||
| 223 | # _AC_SYS_LARGEFILE_OPTIONS | 213 | # _AC_SYS_LARGEFILE_OPTIONS |
| 224 | # ------------------------- | 214 | # ------------------------- |
| @@ -228,8 +218,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | |||
| 228 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | 218 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( |
| 229 | ["none needed"] dnl Most current systems | 219 | ["none needed"] dnl Most current systems |
| 230 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec | 220 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec |
| 231 | ["-D_LARGE_FILES=1"] dnl AIX (which versions?) | 221 | ["-D_LARGE_FILES=1"] dnl 32-bit AIX 4.2.1+, 32-bit z/OS |
| 232 | ["-n32"] dnl Irix 6.2 w/ SGI compiler | ||
| 233 | )) | 222 | )) |
| 234 | 223 | ||
| 235 | # _AC_SYS_LARGEFILE_PROBE | 224 | # _AC_SYS_LARGEFILE_PROBE |
| @@ -246,24 +235,43 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | |||
| 246 | # If you change this macro you may also need to change | 235 | # If you change this macro you may also need to change |
| 247 | # _AC_SYS_LARGEFILE_OPTIONS. | 236 | # _AC_SYS_LARGEFILE_OPTIONS. |
| 248 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], | 237 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], |
| 249 | [AC_CACHE_CHECK([for $CC option to enable large file support], | 238 | [AC_CACHE_CHECK([for $CC option to support large files], |
| 250 | [ac_cv_sys_largefile_opts], | 239 | [ac_cv_sys_largefile_opts], |
| 251 | [ac_save_CC="$CC" | 240 | [ac_save_CPPFLAGS=$CPPFLAGS |
| 252 | ac_opt_found=no | 241 | ac_opt_found=no |
| 253 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do | 242 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do |
| 254 | AS_IF([test x"$ac_opt" != x"none needed"], | 243 | AS_IF([test x"$ac_opt" != x"none needed"], |
| 255 | [CC="$ac_save_CC $ac_opt"]) | 244 | [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"]) |
| 256 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], | 245 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], |
| 257 | [ac_cv_sys_largefile_opts="$ac_opt" | 246 | [AS_IF([test x"$ac_opt" = x"none needed"], |
| 247 | [# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. | ||
| 248 | CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t" | ||
| 249 | AC_COMPILE_IFELSE([], [], | ||
| 250 | [CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" | ||
| 251 | AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])]) | ||
| 252 | ac_cv_sys_largefile_opts=$ac_opt | ||
| 258 | ac_opt_found=yes]) | 253 | ac_opt_found=yes]) |
| 259 | test $ac_opt_found = no || break | 254 | test $ac_opt_found = no || break |
| 260 | done | 255 | done |
| 261 | CC="$ac_save_CC" | 256 | CPPFLAGS=$ac_save_CPPFLAGS |
| 257 | dnl Gnulib implements large file support for native Windows, based on the | ||
| 258 | dnl variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE. | ||
| 259 | m4_ifdef([gl_LARGEFILE], [ | ||
| 260 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 261 | if test $ac_opt_found != yes; then | ||
| 262 | AS_CASE([$host_os], | ||
| 263 | [mingw* | windows*], | ||
| 264 | [ac_cv_sys_largefile_opts="supported through gnulib" | ||
| 265 | ac_opt_found=yes] | ||
| 266 | ) | ||
| 267 | fi | ||
| 268 | ]) | ||
| 262 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) | 269 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) |
| 263 | 270 | ||
| 264 | ac_have_largefile=yes | 271 | ac_have_largefile=yes |
| 265 | AS_CASE([$ac_cv_sys_largefile_opts], | 272 | AS_CASE([$ac_cv_sys_largefile_opts], |
| 266 | ["none needed"], [], | 273 | ["none needed"], [], |
| 274 | ["supported through gnulib"], [], | ||
| 267 | ["support not detected"], | 275 | ["support not detected"], |
| 268 | [ac_have_largefile=no], | 276 | [ac_have_largefile=no], |
| 269 | 277 | ||
| @@ -275,45 +283,29 @@ AS_CASE([$ac_cv_sys_largefile_opts], | |||
| 275 | [AC_DEFINE([_LARGE_FILES], [1], | 283 | [AC_DEFINE([_LARGE_FILES], [1], |
| 276 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], | 284 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], |
| 277 | 285 | ||
| 278 | ["-n32"], | ||
| 279 | [CC="$CC -n32"], | ||
| 280 | |||
| 281 | [AC_MSG_ERROR( | 286 | [AC_MSG_ERROR( |
| 282 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) | 287 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) |
| 283 | 288 | ||
| 284 | _AC_SYS_YEAR2038_OPT_IN | 289 | AS_IF([test "$enable_year2038" != no], |
| 285 | ]) | 290 | [_AC_SYS_YEAR2038_PROBE]) |
| 286 | 291 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])]) | |
| 287 | # _AC_SYS_LARGEFILE_ENABLE | ||
| 288 | # ------------------------ | ||
| 289 | # Subroutine of AC_SYS_LARGEFILE. Note that this | ||
| 290 | # is expanded very late and therefore there cannot be any code in the | ||
| 291 | # AC_ARG_ENABLE. The default value for enable_largefile is emitted | ||
| 292 | # unconditionally because the generated shell code always looks at | ||
| 293 | # this variable. | ||
| 294 | m4_define([_AC_SYS_LARGEFILE_ENABLE], | ||
| 295 | [m4_divert_text([DEFAULTS], | ||
| 296 | enable_largefile=yes)]dnl | ||
| 297 | [AC_ARG_ENABLE([largefile], | ||
| 298 | [AS_HELP_STRING([--disable-largefile], [omit support for large files])])]) | ||
| 299 | 292 | ||
| 300 | # AC_SYS_LARGEFILE | 293 | # AC_SYS_LARGEFILE |
| 301 | # ---------------- | 294 | # ---------------- |
| 302 | # By default, many hosts won't let programs access large files; | 295 | # By default, many hosts won't let programs access large files; |
| 303 | # one must use special compiler options to get large-file access to work. | 296 | # one must use special compiler options to get large-file access to work. |
| 304 | # For more details about this brain damage please see: | 297 | # For more details about this brain damage please see: |
| 305 | # http://www.unix.org/version2/whatsnew/lfs20mar.html | 298 | # https://www.unix.org/version2/whatsnew/lfs20mar.html |
| 306 | # Additionally, on Linux file systems with 64-bit inodes a file that happens | 299 | # Additionally, on Linux file systems with 64-bit inodes a file that happens |
| 307 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on | 300 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on |
| 308 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. | 301 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. |
| 309 | # This macro allows configuration to continue if the system doesn't support | ||
| 310 | # large files. | ||
| 311 | AC_DEFUN([AC_SYS_LARGEFILE], | 302 | AC_DEFUN([AC_SYS_LARGEFILE], |
| 312 | [m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl | 303 | [AC_ARG_ENABLE([largefile], |
| 313 | AS_IF([test "$enable_largefile" != no], [_AC_SYS_LARGEFILE_PROBE]) | 304 | [AS_HELP_STRING([--disable-largefile], |
| 314 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE]) | 305 | [omit support for large files])])dnl |
| 315 | ])]) | 306 | AS_IF([test "$enable_largefile,$enable_year2038" != no,no], |
| 316 | ])# m4_ifndef AC_SYS_YEAR2038 | 307 | [_AC_SYS_LARGEFILE_PROBE])]) |
| 308 | ])# m4_ifndef AC_SYS_YEAR2038_RECOMMENDED | ||
| 317 | 309 | ||
| 318 | # Enable large files on systems where this is implemented by Gnulib, not by the | 310 | # Enable large files on systems where this is implemented by Gnulib, not by the |
| 319 | # system headers. | 311 | # system headers. |
| @@ -323,7 +315,7 @@ AC_DEFUN([gl_LARGEFILE], | |||
| 323 | [ | 315 | [ |
| 324 | AC_REQUIRE([AC_CANONICAL_HOST]) | 316 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 325 | case "$host_os" in | 317 | case "$host_os" in |
| 326 | mingw*) | 318 | mingw* | windows*) |
| 327 | dnl Native Windows. | 319 | dnl Native Windows. |
| 328 | dnl mingw64 defines off_t to a 64-bit type already, if | 320 | dnl mingw64 defines off_t to a 64-bit type already, if |
| 329 | dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. | 321 | dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. |
diff --git a/gl/m4/libunistring-base.m4 b/gl/m4/libunistring-base.m4 new file mode 100644 index 00000000..9b5795ed --- /dev/null +++ b/gl/m4/libunistring-base.m4 | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | # libunistring-base.m4 | ||
| 2 | # serial 10 | ||
| 3 | dnl Copyright (C) 2010-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 | dnl From Paolo Bonzini and Bruno Haible. | ||
| 10 | |||
| 11 | dnl gl_LIBUNISTRING_MODULE([VERSION], [Module]) | ||
| 12 | dnl Declares that the source files of Module should be compiled, unless we | ||
| 13 | dnl are linking with libunistring and its version is >= the given VERSION. | ||
| 14 | dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is | ||
| 15 | dnl true if the source files of Module should be compiled. | ||
| 16 | dnl This macro is to be used for public libunistring API, not for | ||
| 17 | dnl undocumented API. | ||
| 18 | dnl | ||
| 19 | dnl You have to bump the VERSION argument to the next projected version | ||
| 20 | dnl number each time you make a change that affects the behaviour of the | ||
| 21 | dnl functions defined in Module (even if the sources of Module itself do not | ||
| 22 | dnl change). | ||
| 23 | dnl | ||
| 24 | dnl This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 25 | |||
| 26 | AC_DEFUN([gl_LIBUNISTRING_MODULE], | ||
| 27 | [ | ||
| 28 | AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) | ||
| 29 | dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from | ||
| 30 | dnl gl_LIBUNISTRING_CORE if that macro has been run. | ||
| 31 | gl_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]), | ||
| 32 | [gl_LIBUNISTRING_VERSION_CMP([$1])]) | ||
| 33 | ]) | ||
| 34 | |||
| 35 | dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module]) | ||
| 36 | dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also | ||
| 37 | dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE. | ||
| 38 | dnl What's the expansion of this autoconf variable? | ||
| 39 | dnl - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE. | ||
| 40 | dnl (This is necessary because this token must be present in the .h files | ||
| 41 | dnl when the .h files get installed.) | ||
| 42 | dnl - When building gnulib or application code it expands to | ||
| 43 | dnl - LIBUNISTRING_DLL_VARIABLE by default, | ||
| 44 | dnl - if the automake conditional LIBUNISTRING_COMPILE_$MODULE evaluates | ||
| 45 | dnl to true: the value of | ||
| 46 | dnl ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME | ||
| 47 | dnl (which usually is empty, unless explicitly set in configure.ac). | ||
| 48 | dnl (This is necessary because when the conditional evaluates to false, | ||
| 49 | dnl the application code expects to use the declared variable from the | ||
| 50 | dnl installed libunistring; it's in this case that the | ||
| 51 | dnl LIBUNISTRING_DLL_VARIABLE macro from the installed | ||
| 52 | dnl <unistring/woe32dll.h> must be used.) | ||
| 53 | dnl | ||
| 54 | dnl This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 55 | |||
| 56 | AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE], | ||
| 57 | [ | ||
| 58 | gl_LIBUNISTRING_MODULE([$1], [$2]) | ||
| 59 | m4_ifndef([gl_IN_LIBUNISTRING], | ||
| 60 | [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then | ||
| 61 | GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=$GL_MODULE_INDICATOR_PREFIX[]_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME | ||
| 62 | fi | ||
| 63 | ]) | ||
| 64 | ]) | ||
| 65 | |||
| 66 | dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile]) | ||
| 67 | dnl Declares that HeaderFile should be created, unless we are linking | ||
| 68 | dnl with libunistring and its version is >= the given VERSION. | ||
| 69 | dnl HeaderFile should be relative to the lib directory and end in '.h'. | ||
| 70 | dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty). | ||
| 71 | dnl | ||
| 72 | dnl When we are linking with the already installed libunistring and its version | ||
| 73 | dnl is < VERSION, we create HeaderFile here, because we may compile functions | ||
| 74 | dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed | ||
| 75 | dnl version. | ||
| 76 | dnl When we are linking with the already installed libunistring and its version | ||
| 77 | dnl is > VERSION, we don't create HeaderFile here: it could cause compilation | ||
| 78 | dnl errors in other libunistring header files if some types are missing. | ||
| 79 | dnl | ||
| 80 | dnl You have to bump the VERSION argument to the next projected version | ||
| 81 | dnl number each time you make a non-comment change to the HeaderFile. | ||
| 82 | |||
| 83 | AC_DEFUN([gl_LIBUNISTRING_LIBHEADER], | ||
| 84 | [ | ||
| 85 | AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) | ||
| 86 | dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from | ||
| 87 | dnl gl_LIBUNISTRING_CORE if that macro has been run. | ||
| 88 | if gl_LIBUNISTRING_VERSION_CMP([$1]); then | ||
| 89 | dnl It is OK to use a .h file in lib/ from within tests/, but not vice | ||
| 90 | dnl versa. | ||
| 91 | if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then | ||
| 92 | LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2" | ||
| 93 | fi | ||
| 94 | else | ||
| 95 | LIBUNISTRING_[]AS_TR_CPP([$2])= | ||
| 96 | fi | ||
| 97 | AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2])) | ||
| 98 | ]) | ||
| 99 | |||
| 100 | dnl Miscellaneous preparations/initializations. | ||
| 101 | |||
| 102 | AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE], | ||
| 103 | [ | ||
| 104 | dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point. | ||
| 105 | m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])]) | ||
| 106 | |||
| 107 | AC_REQUIRE([AC_PROG_AWK]) | ||
| 108 | |||
| 109 | dnl Sed expressions to extract the parts of a version number. | ||
| 110 | changequote(,) | ||
| 111 | gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} | ||
| 112 | i\ | ||
| 113 | 0 | ||
| 114 | q | ||
| 115 | ' | ||
| 116 | gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} | ||
| 117 | i\ | ||
| 118 | 0 | ||
| 119 | q | ||
| 120 | ' | ||
| 121 | gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} | ||
| 122 | i\ | ||
| 123 | 0 | ||
| 124 | q | ||
| 125 | ' | ||
| 126 | changequote([,]) | ||
| 127 | |||
| 128 | if test "$HAVE_LIBUNISTRING" = yes; then | ||
| 129 | LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` | ||
| 130 | LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` | ||
| 131 | LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` | ||
| 132 | fi | ||
| 133 | |||
| 134 | dnl Determine whether <unistring/woe32dll.h> from an installed libunistring | ||
| 135 | dnl is available. | ||
| 136 | m4_ifdef([gl_IN_LIBUNISTRING], | ||
| 137 | [dnl In libunistring, all .h files that declare variables need to | ||
| 138 | dnl #include <unistring/woe32dll.h>. This references the file | ||
| 139 | dnl unistring/woe32dll.h in libunistring. | ||
| 140 | HAVE_UNISTRING_WOE32DLL_H=1 | ||
| 141 | ], | ||
| 142 | [dnl In gnulib or in applications, we need a #include <unistring/woe32dll.h> | ||
| 143 | dnl if and only if an installed libunistring is available. | ||
| 144 | if test "$HAVE_LIBUNISTRING" = yes; then | ||
| 145 | AC_CHECK_HEADERS([unistring/woe32dll.h], | ||
| 146 | [HAVE_UNISTRING_WOE32DLL_H=1], | ||
| 147 | [HAVE_UNISTRING_WOE32DLL_H=0]) | ||
| 148 | else | ||
| 149 | HAVE_UNISTRING_WOE32DLL_H=0 | ||
| 150 | fi | ||
| 151 | ]) | ||
| 152 | AC_SUBST([HAVE_UNISTRING_WOE32DLL_H]) | ||
| 153 | ]) | ||
| 154 | |||
| 155 | dnl gl_LIBUNISTRING_VERSION_CMP([VERSION]) | ||
| 156 | dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION | ||
| 157 | dnl is less than the VERSION argument. | ||
| 158 | AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP], | ||
| 159 | [dnl VERSION = 999.9 means to evaluates to true always, i.e. to ignore | ||
| 160 | dnl the installed libunistring regardless of its version. | ||
| 161 | m4_if([$1], [999.9], | ||
| 162 | [true], | ||
| 163 | [ { test "$HAVE_LIBUNISTRING" != yes \ | ||
| 164 | || { | ||
| 165 | dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least. | ||
| 166 | AS_LITERAL_IF([$1], | ||
| 167 | [dnl This is the optimized variant, that assumes the argument is a literal: | ||
| 168 | m4_pushdef([requested_version_major], | ||
| 169 | [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])]) | ||
| 170 | m4_pushdef([requested_version_minor], | ||
| 171 | [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) | ||
| 172 | m4_pushdef([requested_version_subminor], | ||
| 173 | [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) | ||
| 174 | test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \ | ||
| 175 | || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \ | ||
| 176 | && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \ | ||
| 177 | || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \ | ||
| 178 | && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor | ||
| 179 | } | ||
| 180 | } | ||
| 181 | } | ||
| 182 | m4_popdef([requested_version_subminor]) | ||
| 183 | m4_popdef([requested_version_minor]) | ||
| 184 | m4_popdef([requested_version_major]) | ||
| 185 | ], | ||
| 186 | [dnl This is the unoptimized variant: | ||
| 187 | requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"` | ||
| 188 | requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"` | ||
| 189 | requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"` | ||
| 190 | test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \ | ||
| 191 | || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \ | ||
| 192 | && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \ | ||
| 193 | || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \ | ||
| 194 | && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor | ||
| 195 | } | ||
| 196 | } | ||
| 197 | } | ||
| 198 | ]) | ||
| 199 | } | ||
| 200 | }])]) | ||
| 201 | |||
| 202 | dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the | ||
| 203 | dnl same as ORIG, otherwise to 0. | ||
| 204 | m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])]) | ||
diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4 index 5088fa16..202df492 100644 --- a/gl/m4/limits-h.m4 +++ b/gl/m4/limits-h.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | dnl Check whether limits.h has needed features. | 1 | # limits-h.m4 |
| 2 | 2 | # serial 1 | |
| 3 | dnl Copyright 2016-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2016-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | dnl Check whether limits.h has needed features. | ||
| 7 | 10 | ||
| 8 | dnl From Paul Eggert. | 11 | dnl From Paul Eggert. |
| 9 | 12 | ||
| @@ -23,14 +26,27 @@ AC_DEFUN_ONCE([gl_LIMITS_H], | |||
| 23 | int wb = WORD_BIT; | 26 | int wb = WORD_BIT; |
| 24 | int ullw = ULLONG_WIDTH; | 27 | int ullw = ULLONG_WIDTH; |
| 25 | int bw = BOOL_WIDTH; | 28 | int bw = BOOL_WIDTH; |
| 29 | int bm = BOOL_MAX; | ||
| 30 | int mblm = MB_LEN_MAX; | ||
| 26 | ]])], | 31 | ]])], |
| 27 | [gl_cv_header_limits_width=yes], | 32 | [gl_cv_header_limits_width=yes], |
| 28 | [gl_cv_header_limits_width=no])]) | 33 | [gl_cv_header_limits_width=no])]) |
| 29 | if test "$gl_cv_header_limits_width" = yes; then | 34 | GL_GENERATE_LIMITS_H=true |
| 30 | GL_GENERATE_LIMITS_H=false | 35 | AS_IF([test "$gl_cv_header_limits_width" = yes], |
| 31 | else | 36 | [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX], |
| 32 | GL_GENERATE_LIMITS_H=true | 37 | [gl_cv_header_limits_ssize_max], |
| 33 | fi | 38 | [AC_COMPILE_IFELSE( |
| 39 | [AC_LANG_SOURCE( | ||
| 40 | [[#include <limits.h> | ||
| 41 | #ifndef SSIZE_MAX | ||
| 42 | #error "SSIZE_MAX is not defined" | ||
| 43 | #endif | ||
| 44 | ]])], | ||
| 45 | [gl_cv_header_limits_ssize_max=yes], | ||
| 46 | [gl_cv_header_limits_ssize_max=no])]) | ||
| 47 | if test "$gl_cv_header_limits_ssize_max" = yes; then | ||
| 48 | GL_GENERATE_LIMITS_H=false | ||
| 49 | fi]) | ||
| 34 | ]) | 50 | ]) |
| 35 | 51 | ||
| 36 | dnl Unconditionally enables the replacement of <limits.h>. | 52 | dnl Unconditionally enables the replacement of <limits.h>. |
diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 index 15b6b2a5..374a48f1 100644 --- a/gl/m4/localcharset.m4 +++ b/gl/m4/localcharset.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # localcharset.m4 serial 8 | 1 | # localcharset.m4 |
| 2 | dnl Copyright (C) 2002, 2004, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
| 3 | dnl Copyright (C) 2002, 2004, 2006, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_LOCALCHARSET], | 9 | AC_DEFUN([gl_LOCALCHARSET], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/locale-en.m4 b/gl/m4/locale-en.m4 new file mode 100644 index 00000000..4151428a --- /dev/null +++ b/gl/m4/locale-en.m4 | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | # locale-en.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2003-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 | dnl From Bruno Haible. | ||
| 10 | |||
| 11 | dnl Determine the name of an English (or American English) locale with | ||
| 12 | dnl UTF-8 encoding. | ||
| 13 | AC_DEFUN_ONCE([gt_LOCALE_EN_UTF8], | ||
| 14 | [ | ||
| 15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 16 | AC_REQUIRE([AM_LANGINFO_CODESET]) | ||
| 17 | AC_CACHE_CHECK([for an english Unicode locale], [gt_cv_locale_en_utf8], [ | ||
| 18 | case "$host_os" in | ||
| 19 | *-musl* | midipix*) | ||
| 20 | dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without | ||
| 21 | dnl any locale file on disk. But they are effectively equivalent to the | ||
| 22 | dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) | ||
| 23 | dnl for which localizations (.mo files) have been installed. | ||
| 24 | gt_cv_locale_en_utf8=en_US.UTF-8 | ||
| 25 | ;; | ||
| 26 | *) | ||
| 27 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ | ||
| 28 | #include <locale.h> | ||
| 29 | #include <time.h> | ||
| 30 | #if HAVE_LANGINFO_CODESET | ||
| 31 | # include <langinfo.h> | ||
| 32 | #endif | ||
| 33 | #include <stdlib.h> | ||
| 34 | #include <string.h> | ||
| 35 | struct tm t; | ||
| 36 | char buf[16]; | ||
| 37 | int main () { | ||
| 38 | /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl | ||
| 39 | imitates locale dependent behaviour by looking at the environment | ||
| 40 | variables, and all locales use the UTF-8 encoding. */ | ||
| 41 | #if !(defined __BEOS__ || defined __HAIKU__) | ||
| 42 | /* Check whether the given locale name is recognized by the system. */ | ||
| 43 | # if defined _WIN32 && !defined __CYGWIN__ | ||
| 44 | /* On native Windows, setlocale(category, "") looks at the system settings, | ||
| 45 | not at the environment variables. Also, when an encoding suffix such | ||
| 46 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE | ||
| 47 | category of the locale to "C". */ | ||
| 48 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL | ||
| 49 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) | ||
| 50 | return 1; | ||
| 51 | # else | ||
| 52 | if (setlocale (LC_ALL, "") == NULL) return 1; | ||
| 53 | # endif | ||
| 54 | /* Check whether nl_langinfo(CODESET) is "UTF-8" or equivalent. */ | ||
| 55 | # if HAVE_LANGINFO_CODESET | ||
| 56 | { | ||
| 57 | const char *cs = nl_langinfo (CODESET); | ||
| 58 | if (!(strcmp (cs, "UTF-8") == 0 || strcmp (cs, "UTF8") == 0 | ||
| 59 | || strcmp (cs, "utf-8") == 0 || strcmp (cs, "utf8") == 0)) | ||
| 60 | return 1; | ||
| 61 | } | ||
| 62 | # endif | ||
| 63 | # ifdef __CYGWIN__ | ||
| 64 | /* On Cygwin, avoid locale names without encoding suffix, because the | ||
| 65 | locale_charset() function relies on the encoding suffix. Note that | ||
| 66 | LC_ALL is set on the command line. */ | ||
| 67 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; | ||
| 68 | # endif | ||
| 69 | /* Check the third month name. */ | ||
| 70 | t.tm_year = 1975 - 1900; t.tm_mon = 3 - 1; t.tm_mday = 24; | ||
| 71 | if (strftime (buf, sizeof (buf), "%B", &t) < 5 || strcmp (buf, "March") != 0) | ||
| 72 | return 1; | ||
| 73 | #endif | ||
| 74 | #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ | ||
| 75 | /* Check whether the decimal separator is a dot. */ | ||
| 76 | if (localeconv () ->decimal_point[0] != '.') return 1; | ||
| 77 | #endif | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | ]])]) | ||
| 81 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | ||
| 82 | case "$host_os" in | ||
| 83 | # Handle native Windows specially, because there setlocale() interprets | ||
| 84 | # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", | ||
| 85 | # "en" or "eng" as "English" or "English_United States.1252", | ||
| 86 | # "fr" or "fra" as "French" or "French_France.1252", | ||
| 87 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | ||
| 88 | # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", | ||
| 89 | # and similar. | ||
| 90 | mingw* | windows*) | ||
| 91 | # Test for the hypothetical native Windows locale name. | ||
| 92 | if (LC_ALL='English_United States.65001' LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 93 | gt_cv_locale_en_utf8='English_United States.65001' | ||
| 94 | else | ||
| 95 | # None found. | ||
| 96 | gt_cv_locale_en_utf8=none | ||
| 97 | fi | ||
| 98 | ;; | ||
| 99 | *) | ||
| 100 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because | ||
| 101 | # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the | ||
| 102 | # configure script would override the LC_ALL setting. Likewise for | ||
| 103 | # LC_CTYPE, which is also set at the beginning of the configure script. | ||
| 104 | # Test for the locale name with explicit encoding suffix first | ||
| 105 | # (this is necessary on Haiku). | ||
| 106 | if (LC_ALL=en_US.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 107 | gt_cv_locale_en_utf8=en_US.UTF-8 | ||
| 108 | else | ||
| 109 | # Test for the locale name without encoding suffix. | ||
| 110 | if (LC_ALL=en_US LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 111 | gt_cv_locale_en_utf8=en_US | ||
| 112 | else | ||
| 113 | # Test for the Solaris 10 locale name. | ||
| 114 | if (LC_ALL=en.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 115 | gt_cv_locale_en_utf8=en.UTF-8 | ||
| 116 | else | ||
| 117 | # None found. | ||
| 118 | gt_cv_locale_en_utf8=none | ||
| 119 | fi | ||
| 120 | fi | ||
| 121 | fi | ||
| 122 | ;; | ||
| 123 | esac | ||
| 124 | fi | ||
| 125 | rm -fr conftest* | ||
| 126 | ;; | ||
| 127 | esac | ||
| 128 | ]) | ||
| 129 | LOCALE_EN_UTF8="$gt_cv_locale_en_utf8" | ||
| 130 | case "$LOCALE_EN_UTF8" in #( | ||
| 131 | '' | *[[\"\$\'*@<:@]]*) | ||
| 132 | dnl The empty value occurs when the conftest.c program above could not | ||
| 133 | dnl be compiled. The other values might cause trouble with sh or make. | ||
| 134 | AC_MSG_WARN([invalid locale "$LOCALE_EN_UTF8"; assuming "none"]) | ||
| 135 | LOCALE_EN_UTF8=none;; | ||
| 136 | esac | ||
| 137 | AC_SUBST([LOCALE_EN_UTF8]) | ||
| 138 | ]) | ||
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index 8c41fadf..f504d5b5 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | # locale-fr.m4 serial 20 | 1 | # locale-fr.m4 |
| 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 24 |
| 3 | dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
| 9 | dnl Determine the name of a french locale with traditional encoding. | 11 | dnl Determine the name of a french locale with traditional encoding. |
| 10 | AC_DEFUN([gt_LOCALE_FR], | 12 | AC_DEFUN_ONCE([gt_LOCALE_FR], |
| 11 | [ | 13 | [ |
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 14 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 15 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
| @@ -70,8 +72,9 @@ int main () { | |||
| 70 | if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; | 72 | if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; |
| 71 | # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ | 73 | # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ |
| 72 | /* Check whether the decimal separator is a comma. | 74 | /* Check whether the decimal separator is a comma. |
| 73 | On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point | 75 | On NetBSD 3.0 in the fr_FR.ISO8859-1 locale |
| 74 | are nl_langinfo(RADIXCHAR) are both ".". */ | 76 | and on Haiku in the fr_FR.UTF-8 locale, |
| 77 | localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ | ||
| 75 | if (localeconv () ->decimal_point[0] != ',') return 1; | 78 | if (localeconv () ->decimal_point[0] != ',') return 1; |
| 76 | # endif | 79 | # endif |
| 77 | return 0; | 80 | return 0; |
| @@ -81,12 +84,13 @@ int main () { | |||
| 81 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 84 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
| 82 | case "$host_os" in | 85 | case "$host_os" in |
| 83 | # Handle native Windows specially, because there setlocale() interprets | 86 | # Handle native Windows specially, because there setlocale() interprets |
| 84 | # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", | 87 | # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", |
| 88 | # "en" or "eng" as "English" or "English_United States.1252", | ||
| 85 | # "fr" or "fra" as "French" or "French_France.1252", | 89 | # "fr" or "fra" as "French" or "French_France.1252", |
| 86 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 90 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
| 87 | # "ja" as "Japanese" or "Japanese_Japan.932", | 91 | # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", |
| 88 | # and similar. | 92 | # and similar. |
| 89 | mingw*) | 93 | mingw* | windows*) |
| 90 | # Test for the native Windows locale name. | 94 | # Test for the native Windows locale name. |
| 91 | if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 95 | if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 92 | gt_cv_locale_fr=French_France.1252 | 96 | gt_cv_locale_fr=French_France.1252 |
| @@ -116,7 +120,7 @@ int main () { | |||
| 116 | if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 120 | if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 117 | gt_cv_locale_fr=fr_FR.iso88591 | 121 | gt_cv_locale_fr=fr_FR.iso88591 |
| 118 | else | 122 | else |
| 119 | # Test for the Solaris 7 locale name. | 123 | # Test for the Solaris 10 locale name. |
| 120 | if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 124 | if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 121 | gt_cv_locale_fr=fr | 125 | gt_cv_locale_fr=fr |
| 122 | else | 126 | else |
| @@ -133,15 +137,31 @@ int main () { | |||
| 133 | rm -fr conftest* | 137 | rm -fr conftest* |
| 134 | ]) | 138 | ]) |
| 135 | LOCALE_FR=$gt_cv_locale_fr | 139 | LOCALE_FR=$gt_cv_locale_fr |
| 140 | case $LOCALE_FR in #( | ||
| 141 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
| 142 | dnl This locale name might cause trouble with sh or make. | ||
| 143 | AC_MSG_WARN([invalid locale "$LOCALE_FR"; assuming "none"]) | ||
| 144 | LOCALE_FR=none;; | ||
| 145 | esac | ||
| 136 | AC_SUBST([LOCALE_FR]) | 146 | AC_SUBST([LOCALE_FR]) |
| 137 | ]) | 147 | ]) |
| 138 | 148 | ||
| 139 | dnl Determine the name of a french locale with UTF-8 encoding. | 149 | dnl Determine the name of a french locale with UTF-8 encoding. |
| 140 | AC_DEFUN([gt_LOCALE_FR_UTF8], | 150 | AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8], |
| 141 | [ | 151 | [ |
| 152 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 142 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 153 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
| 143 | AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ | 154 | AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ |
| 144 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ | 155 | case "$host_os" in |
| 156 | *-musl* | midipix*) | ||
| 157 | dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without | ||
| 158 | dnl any locale file on disk. But they are effectively equivalent to the | ||
| 159 | dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) | ||
| 160 | dnl for which localizations (.mo files) have been installed. | ||
| 161 | gt_cv_locale_fr_utf8=fr_FR.UTF-8 | ||
| 162 | ;; | ||
| 163 | *) | ||
| 164 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ | ||
| 145 | #include <locale.h> | 165 | #include <locale.h> |
| 146 | #include <time.h> | 166 | #include <time.h> |
| 147 | #if HAVE_LANGINFO_CODESET | 167 | #if HAVE_LANGINFO_CODESET |
| @@ -197,57 +217,90 @@ int main () { | |||
| 197 | #endif | 217 | #endif |
| 198 | #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ | 218 | #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ |
| 199 | /* Check whether the decimal separator is a comma. | 219 | /* Check whether the decimal separator is a comma. |
| 200 | On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point | 220 | On NetBSD 3.0 in the fr_FR.ISO8859-1 locale |
| 201 | are nl_langinfo(RADIXCHAR) are both ".". */ | 221 | and on Haiku in the fr_FR.UTF-8 locale, |
| 222 | localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ | ||
| 202 | if (localeconv () ->decimal_point[0] != ',') return 1; | 223 | if (localeconv () ->decimal_point[0] != ',') return 1; |
| 203 | #endif | 224 | #endif |
| 204 | return 0; | 225 | return 0; |
| 205 | } | 226 | } |
| 206 | ]])]) | 227 | ]])]) |
| 207 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 228 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
| 208 | case "$host_os" in | 229 | case "$host_os" in |
| 209 | # Handle native Windows specially, because there setlocale() interprets | 230 | # Handle native Windows specially, because there setlocale() interprets |
| 210 | # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", | 231 | # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", |
| 211 | # "fr" or "fra" as "French" or "French_France.1252", | 232 | # "en" or "eng" as "English" or "English_United States.1252", |
| 212 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 233 | # "fr" or "fra" as "French" or "French_France.1252", |
| 213 | # "ja" as "Japanese" or "Japanese_Japan.932", | 234 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
| 214 | # and similar. | 235 | # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", |
| 215 | mingw*) | 236 | # and similar. |
| 216 | # Test for the hypothetical native Windows locale name. | 237 | mingw* | windows*) |
| 217 | if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 238 | # Test for the hypothetical native Windows locale name. |
| 218 | gt_cv_locale_fr_utf8=French_France.65001 | 239 | if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 219 | else | 240 | gt_cv_locale_fr_utf8=French_France.65001 |
| 220 | # None found. | ||
| 221 | gt_cv_locale_fr_utf8=none | ||
| 222 | fi | ||
| 223 | ;; | ||
| 224 | *) | ||
| 225 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because | ||
| 226 | # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the | ||
| 227 | # configure script would override the LC_ALL setting. Likewise for | ||
| 228 | # LC_CTYPE, which is also set at the beginning of the configure script. | ||
| 229 | # Test for the usual locale name. | ||
| 230 | if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 231 | gt_cv_locale_fr_utf8=fr_FR | ||
| 232 | else | ||
| 233 | # Test for the locale name with explicit encoding suffix. | ||
| 234 | if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 235 | gt_cv_locale_fr_utf8=fr_FR.UTF-8 | ||
| 236 | else | ||
| 237 | # Test for the Solaris 7 locale name. | ||
| 238 | if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 239 | gt_cv_locale_fr_utf8=fr.UTF-8 | ||
| 240 | else | 241 | else |
| 241 | # None found. | 242 | # None found. |
| 242 | gt_cv_locale_fr_utf8=none | 243 | gt_cv_locale_fr_utf8=none |
| 243 | fi | 244 | fi |
| 244 | fi | 245 | ;; |
| 245 | fi | 246 | *) |
| 246 | ;; | 247 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because |
| 247 | esac | 248 | # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the |
| 248 | fi | 249 | # configure script would override the LC_ALL setting. Likewise for |
| 249 | rm -fr conftest* | 250 | # LC_CTYPE, which is also set at the beginning of the configure script. |
| 251 | # Test for the usual locale name. | ||
| 252 | if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 253 | gt_cv_locale_fr_utf8=fr_FR | ||
| 254 | else | ||
| 255 | # Test for the locale name with explicit encoding suffix. | ||
| 256 | if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 257 | gt_cv_locale_fr_utf8=fr_FR.UTF-8 | ||
| 258 | else | ||
| 259 | # Test for the Solaris 10 locale name. | ||
| 260 | if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
| 261 | gt_cv_locale_fr_utf8=fr.UTF-8 | ||
| 262 | else | ||
| 263 | # None found. | ||
| 264 | gt_cv_locale_fr_utf8=none | ||
| 265 | fi | ||
| 266 | fi | ||
| 267 | fi | ||
| 268 | ;; | ||
| 269 | esac | ||
| 270 | fi | ||
| 271 | rm -fr conftest* | ||
| 272 | ;; | ||
| 273 | esac | ||
| 250 | ]) | 274 | ]) |
| 251 | LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 | 275 | LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 |
| 276 | case $LOCALE_FR_UTF8 in #( | ||
| 277 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
| 278 | dnl This locale name might cause trouble with sh or make. | ||
| 279 | AC_MSG_WARN([invalid locale "$LOCALE_FR_UTF8"; assuming "none"]) | ||
| 280 | LOCALE_FR_UTF8=none;; | ||
| 281 | esac | ||
| 252 | AC_SUBST([LOCALE_FR_UTF8]) | 282 | AC_SUBST([LOCALE_FR_UTF8]) |
| 283 | |||
| 284 | dnl Users of $LOCALE_FR_UTF8 need to know which of the locale categories they | ||
| 285 | dnl can rely on. | ||
| 286 | case "$host_os" in | ||
| 287 | *-musl* | midipix*) | ||
| 288 | dnl On musl libc, locale categories other than LC_CTYPE and LC_MESSAGES | ||
| 289 | dnl are effectively unimplemented. | ||
| 290 | LC_COLLATE_IMPLEMENTED=false | ||
| 291 | LC_NUMERIC_IMPLEMENTED=false | ||
| 292 | LC_TIME_IMPLEMENTED=false | ||
| 293 | LC_MONETARY_IMPLEMENTED=false | ||
| 294 | ;; | ||
| 295 | *) | ||
| 296 | LC_COLLATE_IMPLEMENTED=true | ||
| 297 | LC_NUMERIC_IMPLEMENTED=true | ||
| 298 | LC_TIME_IMPLEMENTED=true | ||
| 299 | LC_MONETARY_IMPLEMENTED=true | ||
| 300 | ;; | ||
| 301 | esac | ||
| 302 | AC_SUBST([LC_COLLATE_IMPLEMENTED]) | ||
| 303 | AC_SUBST([LC_NUMERIC_IMPLEMENTED]) | ||
| 304 | AC_SUBST([LC_TIME_IMPLEMENTED]) | ||
| 305 | AC_SUBST([LC_MONETARY_IMPLEMENTED]) | ||
| 253 | ]) | 306 | ]) |
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index 25901730..1c813b89 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | # locale-ja.m4 serial 15 | 1 | # locale-ja.m4 |
| 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 19 |
| 3 | dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
| 9 | dnl Determine the name of a japanese locale with EUC-JP encoding. | 11 | dnl Determine the name of a japanese locale with EUC-JP encoding. |
| 10 | AC_DEFUN([gt_LOCALE_JA], | 12 | AC_DEFUN_ONCE([gt_LOCALE_JA], |
| 11 | [ | 13 | [ |
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 14 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 15 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
| @@ -85,12 +87,13 @@ int main () | |||
| 85 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 87 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
| 86 | case "$host_os" in | 88 | case "$host_os" in |
| 87 | # Handle native Windows specially, because there setlocale() interprets | 89 | # Handle native Windows specially, because there setlocale() interprets |
| 88 | # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", | 90 | # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", |
| 91 | # "en" or "eng" as "English" or "English_United States.1252", | ||
| 89 | # "fr" or "fra" as "French" or "French_France.1252", | 92 | # "fr" or "fra" as "French" or "French_France.1252", |
| 90 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 93 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
| 91 | # "ja" as "Japanese" or "Japanese_Japan.932", | 94 | # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", |
| 92 | # and similar. | 95 | # and similar. |
| 93 | mingw*) | 96 | mingw* | windows*) |
| 94 | # Note that on native Windows, the Japanese locale is | 97 | # Note that on native Windows, the Japanese locale is |
| 95 | # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we | 98 | # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we |
| 96 | # cannot use it here. | 99 | # cannot use it here. |
| @@ -117,7 +120,7 @@ int main () | |||
| 117 | if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 120 | if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 118 | gt_cv_locale_ja=ja_JP.EUC | 121 | gt_cv_locale_ja=ja_JP.EUC |
| 119 | else | 122 | else |
| 120 | # Test for the Solaris 7 locale name. | 123 | # Test for the Solaris 10 locale name. |
| 121 | if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 124 | if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 122 | gt_cv_locale_ja=ja | 125 | gt_cv_locale_ja=ja |
| 123 | else | 126 | else |
| @@ -139,5 +142,11 @@ int main () | |||
| 139 | rm -fr conftest* | 142 | rm -fr conftest* |
| 140 | ]) | 143 | ]) |
| 141 | LOCALE_JA=$gt_cv_locale_ja | 144 | LOCALE_JA=$gt_cv_locale_ja |
| 145 | case $LOCALE_JA in #( | ||
| 146 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
| 147 | dnl This locale name might cause trouble with sh or make. | ||
| 148 | AC_MSG_WARN([invalid locale "$LOCALE_JA"; assuming "none"]) | ||
| 149 | LOCALE_JA=none;; | ||
| 150 | esac | ||
| 142 | AC_SUBST([LOCALE_JA]) | 151 | AC_SUBST([LOCALE_JA]) |
| 143 | ]) | 152 | ]) |
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index b9f9eef7..6f9374d2 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | # locale-zh.m4 serial 15 | 1 | # locale-zh.m4 |
| 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 20 |
| 3 | dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
| 9 | dnl Determine the name of a chinese locale with GB18030 encoding. | 11 | dnl Determine the name of a chinese locale with GB18030 encoding. |
| 10 | AC_DEFUN([gt_LOCALE_ZH_CN], | 12 | AC_DEFUN_ONCE([gt_LOCALE_ZH_CN], |
| 11 | [ | 13 | [ |
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 14 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 15 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
| @@ -21,6 +23,7 @@ AC_DEFUN([gt_LOCALE_ZH_CN], | |||
| 21 | #endif | 23 | #endif |
| 22 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| 23 | #include <string.h> | 25 | #include <string.h> |
| 26 | #include <wchar.h> | ||
| 24 | struct tm t; | 27 | struct tm t; |
| 25 | char buf[16]; | 28 | char buf[16]; |
| 26 | int main () | 29 | int main () |
| @@ -79,6 +82,19 @@ int main () | |||
| 79 | single wide character. This excludes the GB2312 and GBK encodings. */ | 82 | single wide character. This excludes the GB2312 and GBK encodings. */ |
| 80 | if (mblen ("\203\062\332\066", 5) != 4) | 83 | if (mblen ("\203\062\332\066", 5) != 4) |
| 81 | return 1; | 84 | return 1; |
| 85 | /* Check whether mbrtowc accept this character one byte at a time. | ||
| 86 | This excludes NetBSD 10.0. */ | ||
| 87 | if (sizeof (wchar_t) > 2) | ||
| 88 | { | ||
| 89 | wchar_t wc; | ||
| 90 | mbstate_t state; | ||
| 91 | memset (&state, 0, sizeof (state)); | ||
| 92 | if (!(mbrtowc (&wc, "\203", 1, &state) == (size_t)(-2) | ||
| 93 | && mbrtowc (&wc, "\062", 1, &state) == (size_t)(-2) | ||
| 94 | && mbrtowc (&wc, "\332", 1, &state) == (size_t)(-2) | ||
| 95 | && mbrtowc (&wc, "\066", 1, &state) == 1)) | ||
| 96 | return 1; | ||
| 97 | } | ||
| 82 | return 0; | 98 | return 0; |
| 83 | #endif | 99 | #endif |
| 84 | } | 100 | } |
| @@ -86,12 +102,13 @@ int main () | |||
| 86 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 102 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
| 87 | case "$host_os" in | 103 | case "$host_os" in |
| 88 | # Handle native Windows specially, because there setlocale() interprets | 104 | # Handle native Windows specially, because there setlocale() interprets |
| 89 | # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", | 105 | # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", |
| 106 | # "en" or "eng" as "English" or "English_United States.1252", | ||
| 90 | # "fr" or "fra" as "French" or "French_France.1252", | 107 | # "fr" or "fra" as "French" or "French_France.1252", |
| 91 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", | 108 | # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", |
| 92 | # "ja" as "Japanese" or "Japanese_Japan.932", | 109 | # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", |
| 93 | # and similar. | 110 | # and similar. |
| 94 | mingw*) | 111 | mingw* | windows*) |
| 95 | # Test for the hypothetical native Windows locale name. | 112 | # Test for the hypothetical native Windows locale name. |
| 96 | if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 113 | if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
| 97 | gt_cv_locale_zh_CN=Chinese_China.54936 | 114 | gt_cv_locale_zh_CN=Chinese_China.54936 |
| @@ -133,5 +150,11 @@ int main () | |||
| 133 | rm -fr conftest* | 150 | rm -fr conftest* |
| 134 | ]) | 151 | ]) |
| 135 | LOCALE_ZH_CN=$gt_cv_locale_zh_CN | 152 | LOCALE_ZH_CN=$gt_cv_locale_zh_CN |
| 153 | case $LOCALE_ZH_CN in #( | ||
| 154 | '' | *[[[:space:]\"\$\'*@<:@]]*) | ||
| 155 | dnl This locale name might cause trouble with sh or make. | ||
| 156 | AC_MSG_WARN([invalid locale "$LOCALE_ZH_CN"; assuming "none"]) | ||
| 157 | LOCALE_ZH_CN=none;; | ||
| 158 | esac | ||
| 136 | AC_SUBST([LOCALE_ZH_CN]) | 159 | AC_SUBST([LOCALE_ZH_CN]) |
| 137 | ]) | 160 | ]) |
diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4 index a33a0a46..e1afbc16 100644 --- a/gl/m4/locale_h.m4 +++ b/gl/m4/locale_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # locale_h.m4 serial 28 | 1 | # locale_h.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 37 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_LOCALE_H], | 9 | AC_DEFUN_ONCE([gl_LOCALE_H], |
| 8 | [ | 10 | [ |
| @@ -18,6 +20,26 @@ AC_DEFUN_ONCE([gl_LOCALE_H], | |||
| 18 | AC_REQUIRE([gl_STDDEF_H]) | 20 | AC_REQUIRE([gl_STDDEF_H]) |
| 19 | 21 | ||
| 20 | AC_REQUIRE([gl_LOCALE_T]) | 22 | AC_REQUIRE([gl_LOCALE_T]) |
| 23 | dnl On native Windows, there is a type '_locale_t' that can be used to | ||
| 24 | dnl define locale_t. | ||
| 25 | AC_CACHE_CHECK([whether locale.h defines _locale_t], | ||
| 26 | [gl_cv_header_locale_has_windows_locale_t], | ||
| 27 | [AC_COMPILE_IFELSE( | ||
| 28 | [AC_LANG_PROGRAM( | ||
| 29 | [[#include <locale.h> | ||
| 30 | _locale_t x;]], | ||
| 31 | [[]])], | ||
| 32 | [gl_cv_header_locale_has_windows_locale_t=yes], | ||
| 33 | [gl_cv_header_locale_has_windows_locale_t=no]) | ||
| 34 | ]) | ||
| 35 | if test $gl_cv_header_locale_has_windows_locale_t = yes; then | ||
| 36 | HAVE_WINDOWS_LOCALE_T=1 | ||
| 37 | AC_DEFINE([HAVE_WINDOWS_LOCALE_T], [1], | ||
| 38 | [Define to 1 if <locale.h> defines the _locale_t type.]) | ||
| 39 | else | ||
| 40 | HAVE_WINDOWS_LOCALE_T=0 | ||
| 41 | fi | ||
| 42 | AC_SUBST([HAVE_WINDOWS_LOCALE_T]) | ||
| 21 | 43 | ||
| 22 | dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' | 44 | dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' |
| 23 | dnl only if _LCONV_C99 is defined. | 45 | dnl only if _LCONV_C99 is defined. |
| @@ -59,7 +81,9 @@ AC_DEFUN_ONCE([gl_LOCALE_H], | |||
| 59 | dnl On native Windows with MSVC, merely define these member names as macros. | 81 | dnl On native Windows with MSVC, merely define these member names as macros. |
| 60 | dnl This avoids trouble in C++ mode. | 82 | dnl This avoids trouble in C++ mode. |
| 61 | case "$host_os" in | 83 | case "$host_os" in |
| 62 | mingw*) | 84 | windows*-msvc*) |
| 85 | ;; | ||
| 86 | mingw* | windows*) | ||
| 63 | AC_EGREP_CPP([Special], [ | 87 | AC_EGREP_CPP([Special], [ |
| 64 | #ifdef _MSC_VER | 88 | #ifdef _MSC_VER |
| 65 | Special | 89 | Special |
| @@ -83,7 +107,7 @@ AC_DEFUN_ONCE([gl_LOCALE_H], | |||
| 83 | # include <xlocale.h> | 107 | # include <xlocale.h> |
| 84 | #endif | 108 | #endif |
| 85 | ]], | 109 | ]], |
| 86 | [setlocale newlocale duplocale freelocale]) | 110 | [setlocale newlocale duplocale freelocale getlocalename_l]) |
| 87 | ]) | 111 | ]) |
| 88 | 112 | ||
| 89 | dnl Checks to determine whether the system has the locale_t type, | 113 | dnl Checks to determine whether the system has the locale_t type, |
| @@ -127,6 +151,7 @@ AC_DEFUN([gl_LOCALE_T], | |||
| 127 | fi | 151 | fi |
| 128 | fi | 152 | fi |
| 129 | AC_SUBST([HAVE_XLOCALE_H]) | 153 | AC_SUBST([HAVE_XLOCALE_H]) |
| 154 | AC_SUBST([HAVE_LOCALE_T]) | ||
| 130 | ]) | 155 | ]) |
| 131 | 156 | ||
| 132 | # gl_LOCALE_MODULE_INDICATOR([modulename]) | 157 | # gl_LOCALE_MODULE_INDICATOR([modulename]) |
| @@ -151,8 +176,12 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], | |||
| 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) | 176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) |
| 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) | 177 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) |
| 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) | 178 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) |
| 179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NEWLOCALE]) | ||
| 154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) | 180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) |
| 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME]) | 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREELOCALE]) |
| 182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L]) | ||
| 183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L_UNSAFE]) | ||
| 184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) | ||
| 156 | ]) | 185 | ]) |
| 157 | m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) | 186 | m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) |
| 158 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | 187 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) |
| @@ -161,14 +190,16 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], | |||
| 161 | AC_DEFUN([gl_LOCALE_H_DEFAULTS], | 190 | AC_DEFUN([gl_LOCALE_H_DEFAULTS], |
| 162 | [ | 191 | [ |
| 163 | dnl Assume proper GNU behavior unless another module says otherwise. | 192 | dnl Assume proper GNU behavior unless another module says otherwise. |
| 164 | HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) | 193 | HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) |
| 165 | HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) | 194 | HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) |
| 166 | HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) | 195 | HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) |
| 167 | REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) | 196 | HAVE_GETLOCALENAME_L=1; AC_SUBST([HAVE_GETLOCALENAME_L]) |
| 168 | REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) | 197 | REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) |
| 169 | REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) | 198 | REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) |
| 170 | REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) | 199 | REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) |
| 171 | REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) | 200 | REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) |
| 172 | REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) | 201 | REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) |
| 202 | REPLACE_GETLOCALENAME_L=0; AC_SUBST([REPLACE_GETLOCALENAME_L]) | ||
| 203 | REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) | ||
| 173 | LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) | 204 | LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) |
| 174 | ]) | 205 | ]) |
diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4 index ae225fed..55a669d0 100644 --- a/gl/m4/localeconv.m4 +++ b/gl/m4/localeconv.m4 | |||
| @@ -1,17 +1,54 @@ | |||
| 1 | # localeconv.m4 serial 1 | 1 | # localeconv.m4 |
| 2 | dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
| 3 | dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_LOCALECONV], | 9 | AC_DEFUN([gl_FUNC_LOCALECONV], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) |
| 10 | AC_REQUIRE([gl_LOCALE_H]) | 12 | AC_REQUIRE([gl_LOCALE_H]) |
| 13 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 11 | 14 | ||
| 12 | if test $REPLACE_STRUCT_LCONV = 1; then | 15 | if test $REPLACE_STRUCT_LCONV = 1; then |
| 13 | REPLACE_LOCALECONV=1 | 16 | REPLACE_LOCALECONV=1 |
| 14 | fi | 17 | fi |
| 18 | if test $REPLACE_LOCALECONV = 0; then | ||
| 19 | dnl Test whether fields of type 'char' are filled correctly. | ||
| 20 | dnl This test fails on mingw 5.0.3. | ||
| 21 | AC_CACHE_CHECK([whether localeconv works], | ||
| 22 | [gl_cv_func_localeconv_works], | ||
| 23 | [AC_RUN_IFELSE( | ||
| 24 | [AC_LANG_SOURCE([[ | ||
| 25 | #include <locale.h> | ||
| 26 | #include <limits.h> | ||
| 27 | int main () | ||
| 28 | { | ||
| 29 | struct lconv *l = localeconv (); | ||
| 30 | return l->frac_digits != CHAR_MAX && l->frac_digits < 0; | ||
| 31 | } | ||
| 32 | ]])], | ||
| 33 | [gl_cv_func_localeconv_works=yes], | ||
| 34 | [gl_cv_func_localeconv_works=no], | ||
| 35 | [case "$host_os" in | ||
| 36 | # Guess yes on glibc systems. | ||
| 37 | *-gnu* | gnu*) gl_cv_func_localeconv_works="guessing yes" ;; | ||
| 38 | # Guess yes on musl systems. | ||
| 39 | *-musl* | midipix*) gl_cv_func_localeconv_works="guessing yes" ;; | ||
| 40 | # Guess no on native Windows. | ||
| 41 | mingw* | windows*) gl_cv_func_localeconv_works="guessing no" ;; | ||
| 42 | # If we don't know, obey --enable-cross-guesses. | ||
| 43 | *) gl_cv_func_localeconv_works="$gl_cross_guess_normal" ;; | ||
| 44 | esac | ||
| 45 | ]) | ||
| 46 | ]) | ||
| 47 | case "$gl_cv_func_localeconv_works" in | ||
| 48 | *yes) ;; | ||
| 49 | *) REPLACE_LOCALECONV=1 ;; | ||
| 50 | esac | ||
| 51 | fi | ||
| 15 | ]) | 52 | ]) |
| 16 | 53 | ||
| 17 | # Prerequisites of lib/localeconv.c. | 54 | # Prerequisites of lib/localeconv.c. |
| @@ -19,4 +56,6 @@ AC_DEFUN([gl_PREREQ_LOCALECONV], | |||
| 19 | [ | 56 | [ |
| 20 | AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], | 57 | AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], |
| 21 | [[#include <locale.h>]]) | 58 | [[#include <locale.h>]]) |
| 59 | AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes], [], [], | ||
| 60 | [[#include <locale.h>]]) | ||
| 22 | ]) | 61 | ]) |
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index 88cf5575..b1d3f435 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # lock.m4 serial 14 | 1 | # lock.m4 |
| 2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
| 3 | dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index fd4f1f27..ddfadd38 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # lseek.m4 serial 12 | 1 | # lseek.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_LSEEK], | 9 | AC_DEFUN([gl_FUNC_LSEEK], |
| 8 | [ | 10 | [ |
| @@ -13,13 +15,15 @@ AC_DEFUN([gl_FUNC_LSEEK], | |||
| 13 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 15 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
| 14 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], | 16 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], |
| 15 | [case "$host_os" in | 17 | [case "$host_os" in |
| 16 | mingw*) | 18 | mingw* | windows*) |
| 17 | dnl Native Windows. | 19 | dnl Native Windows. |
| 18 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or | 20 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or |
| 19 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) | 21 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) |
| 20 | dnl for a pipe depends on the environment: In a Cygwin 1.5 | 22 | dnl for a pipe depends on the environment: |
| 21 | dnl environment it succeeds (wrong); in a Cygwin 1.7 environment | 23 | dnl In a Cygwin 1.5 environment it succeeds (wrong); |
| 22 | dnl it fails with a wrong errno value. | 24 | dnl in a Cygwin 1.7 environment it fails with a wrong errno value; |
| 25 | dnl in a Cygwin 2.9.0 environment it fails correctly; | ||
| 26 | dnl in a Cygwin 3.4.6 environment it succeeds again (wrong). | ||
| 23 | gl_cv_func_lseek_pipe=no | 27 | gl_cv_func_lseek_pipe=no |
| 24 | ;; | 28 | ;; |
| 25 | *) | 29 | *) |
| @@ -70,9 +74,29 @@ AC_DEFUN([gl_FUNC_LSEEK], | |||
| 70 | REPLACE_LSEEK=1 | 74 | REPLACE_LSEEK=1 |
| 71 | fi | 75 | fi |
| 72 | 76 | ||
| 73 | dnl macOS SEEK_DATA is incompatible with other platforms. | 77 | AS_IF([test $REPLACE_LSEEK = 0], |
| 74 | case $host_os in | 78 | [AC_CACHE_CHECK([whether SEEK_DATA works but is incompatible with GNU], |
| 75 | darwin*) | 79 | [gl_cv_func_lseek_works_but_incompatible], |
| 76 | REPLACE_LSEEK=1;; | 80 | [AC_PREPROC_IFELSE( |
| 77 | esac | 81 | [AC_LANG_SOURCE( |
| 82 | dnl Use macOS "9999" to stand for a future fixed macOS version. | ||
| 83 | dnl See ../lib/unistd.in.h and <https://bugs.gnu.org/61386>. | ||
| 84 | [[#include <unistd.h> | ||
| 85 | #if defined __APPLE__ && defined __MACH__ && defined SEEK_DATA | ||
| 86 | # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ | ||
| 87 | # include <AvailabilityMacros.h> | ||
| 88 | # endif | ||
| 89 | # if 99990000 <= MAC_OS_X_VERSION_MIN_REQUIRED | ||
| 90 | # define LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU | ||
| 91 | # endif | ||
| 92 | #endif | ||
| 93 | #ifndef LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU | ||
| 94 | #error "No need to work around the bug" | ||
| 95 | #endif | ||
| 96 | ]])], | ||
| 97 | [gl_cv_func_lseek_works_but_incompatible=yes], | ||
| 98 | [gl_cv_func_lseek_works_but_incompatible=no])]) | ||
| 99 | if test "$gl_cv_func_lseek_works_but_incompatible" = yes; then | ||
| 100 | REPLACE_LSEEK=1 | ||
| 101 | fi]) | ||
| 78 | ]) | 102 | ]) |
diff --git a/gl/m4/lstat.m4 b/gl/m4/lstat.m4 new file mode 100644 index 00000000..efae2485 --- /dev/null +++ b/gl/m4/lstat.m4 | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | # lstat.m4 | ||
| 2 | # serial 36 | ||
| 3 | dnl Copyright (C) 1997-2001, 2003-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 | dnl From Jim Meyering. | ||
| 10 | |||
| 11 | AC_DEFUN([gl_FUNC_LSTAT], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 14 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
| 15 | dnl If lstat does not exist, the replacement <sys/stat.h> does | ||
| 16 | dnl "#define lstat stat", and lstat.c is a no-op. | ||
| 17 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
| 18 | if test $ac_cv_func_lstat = yes; then | ||
| 19 | AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) | ||
| 20 | case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in | ||
| 21 | darwin* | solaris* | *no) | ||
| 22 | REPLACE_LSTAT=1 | ||
| 23 | ;; | ||
| 24 | esac | ||
| 25 | else | ||
| 26 | HAVE_LSTAT=0 | ||
| 27 | fi | ||
| 28 | ]) | ||
| 29 | |||
| 30 | # Prerequisites of lib/lstat.c. | ||
| 31 | AC_DEFUN([gl_PREREQ_LSTAT], [:]) | ||
| 32 | |||
| 33 | AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], | ||
| 34 | [ | ||
| 35 | dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it | ||
| 36 | dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. | ||
| 37 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 38 | AC_CACHE_CHECK([whether lstat correctly handles trailing slash], | ||
| 39 | [gl_cv_func_lstat_dereferences_slashed_symlink], | ||
| 40 | [rm -f conftest.sym conftest.file | ||
| 41 | echo >conftest.file | ||
| 42 | AC_RUN_IFELSE( | ||
| 43 | [AC_LANG_PROGRAM( | ||
| 44 | [AC_INCLUDES_DEFAULT], | ||
| 45 | [[struct stat sbuf; | ||
| 46 | if (symlink ("conftest.file", "conftest.sym") != 0) | ||
| 47 | return 1; | ||
| 48 | /* Linux will dereference the symlink and fail, as required by | ||
| 49 | POSIX. That is better in the sense that it means we will not | ||
| 50 | have to compile and use the lstat wrapper. */ | ||
| 51 | return lstat ("conftest.sym/", &sbuf) == 0; | ||
| 52 | ]])], | ||
| 53 | [gl_cv_func_lstat_dereferences_slashed_symlink=yes], | ||
| 54 | [gl_cv_func_lstat_dereferences_slashed_symlink=no], | ||
| 55 | [case "$host_os" in | ||
| 56 | linux-* | linux) | ||
| 57 | # Guess yes on Linux systems. | ||
| 58 | gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; | ||
| 59 | midipix*) | ||
| 60 | # Guess yes on systems that emulate the Linux system calls. | ||
| 61 | gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; | ||
| 62 | *-gnu* | gnu*) | ||
| 63 | # Guess yes on glibc systems. | ||
| 64 | gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; | ||
| 65 | mingw* | windows*) | ||
| 66 | # Guess no on native Windows. | ||
| 67 | gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; | ||
| 68 | *) | ||
| 69 | # If we don't know, obey --enable-cross-guesses. | ||
| 70 | gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; | ||
| 71 | esac | ||
| 72 | ]) | ||
| 73 | rm -f conftest.sym conftest.file | ||
| 74 | ]) | ||
| 75 | case "$gl_cv_func_lstat_dereferences_slashed_symlink" in | ||
| 76 | *yes) | ||
| 77 | AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], | ||
| 78 | [Define to 1 if 'lstat' dereferences a symlink specified | ||
| 79 | with a trailing slash.]) | ||
| 80 | ;; | ||
| 81 | esac | ||
| 82 | ]) | ||
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 55402924..547b4e4d 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 | |||
| @@ -1,11 +1,24 @@ | |||
| 1 | # malloc.m4 serial 28 | 1 | # malloc.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 43.1 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # This is adapted with modifications from upstream Autoconf here: | 9 | m4_version_prereq([2.73], [], [ |
| 8 | # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 | 10 | # Modules that use this macro directly or indirectly should depend |
| 11 | # on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined | ||
| 12 | # before this macro gets invoked. This helps on AIX 7.2 and earlier | ||
| 13 | # if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. | ||
| 14 | # | ||
| 15 | # This is copied from upstream Autoconf here: | ||
| 16 | # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=1f38316f6af7bf63e5e7dd187ff6456e07ad743e#n971 | ||
| 17 | # _AC_FUNC_MALLOC_IF(IF-WORKS, IF-NOT[, UNKNOWN-ASSUME]) | ||
| 18 | # ------------------------------------------------------ | ||
| 19 | # If 'malloc (0)' returns nonnull, run IF-WORKS, otherwise, IF-NOT. | ||
| 20 | # If it is not known whether it works, assume the shell word UNKNOWN-ASSUME, | ||
| 21 | # which should end in "yes" or in something else (the latter is the default). | ||
| 9 | AC_DEFUN([_AC_FUNC_MALLOC_IF], | 22 | AC_DEFUN([_AC_FUNC_MALLOC_IF], |
| 10 | [ | 23 | [ |
| 11 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | 24 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles |
| @@ -14,55 +27,81 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], | |||
| 14 | [AC_RUN_IFELSE( | 27 | [AC_RUN_IFELSE( |
| 15 | [AC_LANG_PROGRAM( | 28 | [AC_LANG_PROGRAM( |
| 16 | [[#include <stdlib.h> | 29 | [[#include <stdlib.h> |
| 17 | ]], | 30 | /* Use pmalloc to test; 'volatile' prevents the compiler |
| 18 | [[void *p = malloc (0); | 31 | from optimizing the malloc call away. */ |
| 32 | void *(*volatile pmalloc) (size_t) = malloc;]], | ||
| 33 | [[void *p = pmalloc (0); | ||
| 19 | int result = !p; | 34 | int result = !p; |
| 20 | free (p); | 35 | free (p); |
| 21 | return result;]]) | 36 | return result;]])], |
| 22 | ], | ||
| 23 | [ac_cv_func_malloc_0_nonnull=yes], | 37 | [ac_cv_func_malloc_0_nonnull=yes], |
| 24 | [ac_cv_func_malloc_0_nonnull=no], | 38 | [ac_cv_func_malloc_0_nonnull=no], |
| 25 | [case "$host_os" in | 39 | [AS_CASE([$host_os], |
| 26 | # Guess yes on platforms where we know the result. | 40 | [# Guess yes on platforms where we know the result. |
| 27 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | 41 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ |
| 28 | | gnu* | *-musl* | midnightbsd* \ | 42 | | gnu* | *-musl* | midipix* | midnightbsd* \ |
| 29 | | hpux* | solaris* | cygwin* | mingw* | msys* ) | 43 | | hpux* | solaris* | cygwin* | mingw* | windows* | msys*], |
| 30 | ac_cv_func_malloc_0_nonnull="guessing yes" ;; | 44 | [ac_cv_func_malloc_0_nonnull="guessing yes"], |
| 31 | # If we don't know, obey --enable-cross-guesses. | 45 | [# Guess as follows if we don't know. |
| 32 | *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; | 46 | ac_cv_func_malloc_0_nonnull=m4_default([$3], ["guessing no"])])])]) |
| 33 | esac | ||
| 34 | ]) | ||
| 35 | ]) | ||
| 36 | AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) | 47 | AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) |
| 37 | ])# _AC_FUNC_MALLOC_IF | 48 | ])# _AC_FUNC_MALLOC_IF |
| 49 | ]) | ||
| 50 | |||
| 51 | # gl_FUNC_MALLOC_0_NONNULL | ||
| 52 | # ------------------------ | ||
| 53 | # If 'malloc (0)' returns nonnull define HAVE_MALLOC_0_NONNULL. | ||
| 54 | # Also, set ac_cv_func_malloc_0_nonnull to a string that ends in | ||
| 55 | # "yes", otherwise set it to something else. If unknown whether | ||
| 56 | # malloc (0) works, guess as normal for cross-builds. | ||
| 57 | AC_DEFUN([gl_FUNC_MALLOC_0_NONNULL], | ||
| 58 | [ | ||
| 59 | _AC_FUNC_MALLOC_IF( | ||
| 60 | [AC_DEFINE([HAVE_MALLOC_0_NONNULL], [1], | ||
| 61 | [Define to 1 if malloc (0) returns nonnull.])], | ||
| 62 | [], | ||
| 63 | ["$gl_cross_guess_normal"]) | ||
| 64 | ]) | ||
| 38 | 65 | ||
| 39 | # gl_FUNC_MALLOC_GNU | 66 | # gl_FUNC_MALLOC_GNU |
| 40 | # ------------------ | 67 | # ------------------ |
| 41 | # Replace malloc if it is not compatible with GNU libc. | 68 | # Test whether malloc (0) is compatible with GNU libc. |
| 69 | # Replace malloc if not. | ||
| 70 | # Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull (except upon | ||
| 71 | # out-of-memory). | ||
| 72 | # Define HAVE_MALLOC_PTRDIFF if malloc (N) reliably fails when N exceeds | ||
| 73 | # PTRDIFF_MAX. | ||
| 42 | AC_DEFUN([gl_FUNC_MALLOC_GNU], | 74 | AC_DEFUN([gl_FUNC_MALLOC_GNU], |
| 43 | [ | 75 | [ |
| 44 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 76 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 45 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) | 77 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) |
| 46 | REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" | 78 | AC_REQUIRE([gl_FUNC_MALLOC_0_NONNULL]) |
| 47 | if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then | 79 | |
| 48 | _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) | 80 | AS_CASE([$ac_cv_func_malloc_0_nonnull], |
| 49 | fi | 81 | [*yes], |
| 82 | [REPLACE_MALLOC_FOR_MALLOC_GNU=$REPLACE_MALLOC_FOR_MALLOC_POSIX], | ||
| 83 | [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) | ||
| 50 | ]) | 84 | ]) |
| 51 | 85 | ||
| 52 | # gl_FUNC_MALLOC_PTRDIFF | 86 | # gl_FUNC_MALLOC_PTRDIFF |
| 53 | # ---------------------- | 87 | # ---------------------- |
| 54 | # Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, | 88 | # Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX. |
| 55 | # and replace malloc otherwise. | 89 | # Define HAVE_MALLOC_PTRDIFF if yes. |
| 90 | # Replace malloc if not. | ||
| 56 | AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], | 91 | AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], |
| 57 | [ | 92 | [ |
| 58 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 93 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 59 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) | 94 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) |
| 60 | test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 | 95 | AS_IF([test "$gl_cv_malloc_ptrdiff" = yes], |
| 96 | [AC_DEFINE([HAVE_MALLOC_PTRDIFF], 1, | ||
| 97 | [Define to 1 if malloc-like functions do not allocate objects | ||
| 98 | larger than PTRDIFF_MAX bytes.])], | ||
| 99 | [REPLACE_MALLOC_FOR_MALLOC_POSIX=1]) | ||
| 61 | ]) | 100 | ]) |
| 62 | 101 | ||
| 63 | # Test whether malloc, realloc, calloc refuse to create objects | 102 | # Test whether malloc, calloc refuse to create objects |
| 64 | # larger than what can be expressed in ptrdiff_t. | 103 | # larger than what can be expressed in ptrdiff_t. |
| 65 | # Set gl_cv_func_malloc_gnu to yes or no accordingly. | 104 | # Set gl_cv_func_malloc_gnu. |
| 66 | AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], | 105 | AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], |
| 67 | [ | 106 | [ |
| 68 | AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], | 107 | AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], |
| @@ -106,30 +145,48 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX], | |||
| 106 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 145 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 107 | AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) | 146 | AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) |
| 108 | AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) | 147 | AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) |
| 109 | if test "$gl_cv_func_malloc_posix" = yes; then | 148 | case "$gl_cv_func_malloc_posix" in |
| 110 | AC_DEFINE([HAVE_MALLOC_POSIX], [1], | 149 | *yes) |
| 111 | [Define if malloc, realloc, and calloc set errno on allocation failure.]) | 150 | AC_DEFINE([HAVE_MALLOC_POSIX], [1], |
| 112 | else | 151 | [Define if malloc and calloc set errno on allocation failure.]) |
| 113 | REPLACE_MALLOC_FOR_MALLOC_POSIX=1 | 152 | ;; |
| 114 | fi | 153 | *) |
| 154 | REPLACE_MALLOC_FOR_MALLOC_POSIX=1 | ||
| 155 | ;; | ||
| 156 | esac | ||
| 115 | ]) | 157 | ]) |
| 116 | 158 | ||
| 117 | # Test whether malloc, realloc, calloc set errno to ENOMEM on failure. | 159 | # Test whether malloc, calloc set errno to ENOMEM on failure. |
| 118 | # Set gl_cv_func_malloc_posix to yes or no accordingly. | 160 | # Set gl_cv_func_malloc_posix to *yes or *no accordingly. |
| 119 | AC_DEFUN([gl_CHECK_MALLOC_POSIX], | 161 | AC_DEFUN([gl_CHECK_MALLOC_POSIX], |
| 120 | [ | 162 | [ |
| 121 | AC_REQUIRE([AC_CANONICAL_HOST]) | 163 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 122 | AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], | 164 | AC_CACHE_CHECK([whether malloc, calloc set errno on failure], |
| 123 | [gl_cv_func_malloc_posix], | 165 | [gl_cv_func_malloc_posix], |
| 124 | [ | 166 | [ |
| 125 | dnl It is too dangerous to try to allocate a large amount of memory: | 167 | dnl It is too dangerous to try to allocate a large amount of memory: |
| 126 | dnl some systems go to their knees when you do that. So assume that | 168 | dnl some systems go to their knees when you do that. So assume that |
| 127 | dnl all Unix implementations of the function set errno on failure, | 169 | dnl all Unix implementations of the function set errno on failure, |
| 128 | dnl except on those platforms where we have seen 'test-malloc-gnu', | 170 | dnl except on those platforms where we have seen 'test-malloc-gnu', |
| 129 | dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. | 171 | dnl 'test-realloc-posix', 'test-calloc-gnu' fail. For platforms |
| 172 | dnl where only 'test-realloc-posix', see realloc.m4. | ||
| 130 | case "$host_os" in | 173 | case "$host_os" in |
| 131 | mingw*) | 174 | mingw* | windows*) |
| 132 | gl_cv_func_malloc_posix=no ;; | 175 | dnl Old MSVCRT from 2001 did not set errno=ENOMEM when malloc failed. |
| 176 | dnl More recent MSVCRT from 2019 does so. | ||
| 177 | dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well. | ||
| 178 | AC_COMPILE_IFELSE( | ||
| 179 | [AC_LANG_PROGRAM( | ||
| 180 | [[#include <stdio.h> | ||
| 181 | #ifndef _UCRT | ||
| 182 | msvcrt yuck | ||
| 183 | #endif | ||
| 184 | ]], | ||
| 185 | [[]]) | ||
| 186 | ], | ||
| 187 | [gl_cv_func_malloc_posix="guessing yes"], | ||
| 188 | [gl_cv_func_malloc_posix="guessing no"]) | ||
| 189 | ;; | ||
| 133 | irix* | solaris*) | 190 | irix* | solaris*) |
| 134 | dnl On IRIX 6.5, the three functions return NULL with errno unset | 191 | dnl On IRIX 6.5, the three functions return NULL with errno unset |
| 135 | dnl when the argument is larger than PTRDIFF_MAX. | 192 | dnl when the argument is larger than PTRDIFF_MAX. |
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4 index 1d777ebe..cabe5fe7 100644 --- a/gl/m4/malloca.m4 +++ b/gl/m4/malloca.m4 | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | # malloca.m4 serial 2 | 1 | # malloca.m4 |
| 2 | dnl Copyright (C) 2003-2004, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 3 |
| 3 | dnl Copyright (C) 2003-2004, 2006-2007, 2009-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | AC_DEFUN([gl_MALLOCA], | 10 | AC_DEFUN([gl_MALLOCA], |
| 9 | [ | 11 | [ |
| 10 | dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables | 12 | dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables |
| 11 | dnl @ALLOCA@ and @LTALLOCA@. | 13 | dnl @ALLOCA@ and @LTALLOCA@. |
| 12 | dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. | 14 | dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. |
| 13 | AC_REQUIRE([gl_EEMALLOC]) | 15 | AC_REQUIRE([gl_FUNC_MALLOC_GNU]) |
| 14 | ]) | 16 | ]) |
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4 index d2e90ff1..8c27503b 100644 --- a/gl/m4/math_h.m4 +++ b/gl/m4/math_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # math_h.m4 serial 125 | 1 | # math_h.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 140.1 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_MATH_H], | 9 | AC_DEFUN_ONCE([gl_MATH_H], |
| 8 | [ | 10 | [ |
| @@ -42,15 +44,21 @@ AC_DEFUN_ONCE([gl_MATH_H], | |||
| 42 | cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf | 44 | cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf |
| 43 | expf expl exp2 exp2f exp2l expm1 expm1f expm1l | 45 | expf expl exp2 exp2f exp2l expm1 expm1f expm1l |
| 44 | fabsf fabsl floorf floorl fma fmaf fmal | 46 | fabsf fabsl floorf floorl fma fmaf fmal |
| 45 | fmod fmodf fmodl frexpf frexpl hypotf hypotl | 47 | fmod fmodf fmodl frexpf frexpl |
| 48 | getpayload getpayloadf getpayloadl | ||
| 49 | hypotf hypotl | ||
| 46 | ilogb ilogbf ilogbl | 50 | ilogb ilogbf ilogbl |
| 47 | ldexpf ldexpl | 51 | ldexpf ldexpl |
| 48 | log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l | 52 | log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l |
| 49 | logb logbf logbl | 53 | logb logbf logbl logp1 log1pf logp1l |
| 50 | modf modff modfl powf | 54 | modf modff modfl powf |
| 51 | remainder remainderf remainderl | 55 | remainder remainderf remainderl |
| 52 | rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl | 56 | rint rintf rintl round roundf roundl |
| 53 | tanf tanl tanhf trunc truncf truncl]) | 57 | setpayload setpayloadf setpayloadl |
| 58 | setpayloadsig setpayloadsigf setpayloadsigl | ||
| 59 | sinf sinl sinhf sqrtf sqrtl | ||
| 60 | tanf tanl tanhf totalorder totalorderf totalorderl totalordermag | ||
| 61 | totalordermagf totalordermagl trunc truncf truncl]) | ||
| 54 | ]) | 62 | ]) |
| 55 | 63 | ||
| 56 | # gl_MATH_MODULE_INDICATOR([modulename]) | 64 | # gl_MATH_MODULE_INDICATOR([modulename]) |
| @@ -113,6 +121,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
| 113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF]) | 121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF]) |
| 114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP]) | 122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP]) |
| 115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL]) | 123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL]) |
| 124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOAD]) | ||
| 125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOADF]) | ||
| 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOADL]) | ||
| 116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) | 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) |
| 117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) | 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) |
| 118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) | 129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) |
| @@ -125,6 +136,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
| 125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) | 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) |
| 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) | 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) |
| 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) | 138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) |
| 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXP]) | ||
| 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) | 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) |
| 129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) | 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) |
| 130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) | 142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) |
| @@ -142,6 +154,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
| 142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) | 154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) |
| 143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) | 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) |
| 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) | 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) |
| 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1]) | ||
| 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F]) | ||
| 159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L]) | ||
| 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) | 160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) |
| 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) | 161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) |
| 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) | 162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) |
| @@ -155,6 +170,12 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
| 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND]) | 170 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND]) |
| 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF]) | 171 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF]) |
| 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL]) | 172 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL]) |
| 173 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOAD]) | ||
| 174 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADF]) | ||
| 175 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADL]) | ||
| 176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIG]) | ||
| 177 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF]) | ||
| 178 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL]) | ||
| 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) | 179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) |
| 159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) | 180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) |
| 160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) | 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) |
| @@ -164,6 +185,12 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | |||
| 164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF]) | 185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF]) |
| 165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL]) | 186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL]) |
| 166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF]) | 187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF]) |
| 188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDER]) | ||
| 189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERF]) | ||
| 190 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERL]) | ||
| 191 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAG]) | ||
| 192 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAGF]) | ||
| 193 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAGL]) | ||
| 167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) | 194 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) |
| 168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) | 195 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) |
| 169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) | 196 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) |
| @@ -209,6 +236,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 209 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) | 236 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) |
| 210 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) | 237 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) |
| 211 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) | 238 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) |
| 239 | HAVE_GETPAYLOAD=1; AC_SUBST([HAVE_GETPAYLOAD]) | ||
| 240 | HAVE_GETPAYLOADF=1; AC_SUBST([HAVE_GETPAYLOADF]) | ||
| 241 | HAVE_GETPAYLOADL=1; AC_SUBST([HAVE_GETPAYLOADL]) | ||
| 212 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) | 242 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) |
| 213 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) | 243 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) |
| 214 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) | 244 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) |
| @@ -227,6 +257,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 227 | HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) | 257 | HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) |
| 228 | HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) | 258 | HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) |
| 229 | HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) | 259 | HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) |
| 260 | HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1]) | ||
| 261 | HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F]) | ||
| 262 | HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L]) | ||
| 230 | HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) | 263 | HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) |
| 231 | HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) | 264 | HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) |
| 232 | HAVE_POWF=1; AC_SUBST([HAVE_POWF]) | 265 | HAVE_POWF=1; AC_SUBST([HAVE_POWF]) |
| @@ -234,6 +267,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 234 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) | 267 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) |
| 235 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) | 268 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) |
| 236 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) | 269 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) |
| 270 | HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD]) | ||
| 271 | HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF]) | ||
| 272 | HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL]) | ||
| 273 | HAVE_SETPAYLOADSIG=1; AC_SUBST([HAVE_SETPAYLOADSIG]) | ||
| 274 | HAVE_SETPAYLOADSIGF=1; AC_SUBST([HAVE_SETPAYLOADSIGF]) | ||
| 275 | HAVE_SETPAYLOADSIGL=1; AC_SUBST([HAVE_SETPAYLOADSIGL]) | ||
| 237 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) | 276 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) |
| 238 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) | 277 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) |
| 239 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) | 278 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) |
| @@ -242,6 +281,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 242 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) | 281 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) |
| 243 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) | 282 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) |
| 244 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) | 283 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) |
| 284 | HAVE_TOTALORDER=1; AC_SUBST([HAVE_TOTALORDER]) | ||
| 285 | HAVE_TOTALORDERF=1; AC_SUBST([HAVE_TOTALORDERF]) | ||
| 286 | HAVE_TOTALORDERL=1; AC_SUBST([HAVE_TOTALORDERL]) | ||
| 287 | HAVE_TOTALORDERMAG=1; AC_SUBST([HAVE_TOTALORDERMAG]) | ||
| 288 | HAVE_TOTALORDERMAGF=1; AC_SUBST([HAVE_TOTALORDERMAGF]) | ||
| 289 | HAVE_TOTALORDERMAGL=1; AC_SUBST([HAVE_TOTALORDERMAGL]) | ||
| 245 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) | 290 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) |
| 246 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) | 291 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) |
| 247 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) | 292 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) |
| @@ -309,6 +354,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 309 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) | 354 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) |
| 310 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) | 355 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) |
| 311 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) | 356 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) |
| 357 | REPLACE_GETPAYLOAD=0; AC_SUBST([REPLACE_GETPAYLOAD]) | ||
| 358 | REPLACE_GETPAYLOADF=0; AC_SUBST([REPLACE_GETPAYLOADF]) | ||
| 359 | REPLACE_GETPAYLOADL=0; AC_SUBST([REPLACE_GETPAYLOADL]) | ||
| 312 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) | 360 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) |
| 313 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) | 361 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) |
| 314 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) | 362 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) |
| @@ -319,6 +367,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 319 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) | 367 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) |
| 320 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) | 368 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) |
| 321 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) | 369 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) |
| 370 | REPLACE_LDEXP=0; AC_SUBST([REPLACE_LDEXP]) | ||
| 322 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) | 371 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) |
| 323 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) | 372 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) |
| 324 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) | 373 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) |
| @@ -350,10 +399,17 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 350 | REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) | 399 | REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) |
| 351 | REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) | 400 | REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) |
| 352 | REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) | 401 | REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) |
| 402 | REPLACE_SINL=0; AC_SUBST([REPLACE_SINL]) | ||
| 353 | REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) | 403 | REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) |
| 354 | REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) | 404 | REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) |
| 355 | REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) | 405 | REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) |
| 356 | REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) | 406 | REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) |
| 407 | REPLACE_TOTALORDER=0; AC_SUBST([REPLACE_TOTALORDER]) | ||
| 408 | REPLACE_TOTALORDERF=0; AC_SUBST([REPLACE_TOTALORDERF]) | ||
| 409 | REPLACE_TOTALORDERL=0; AC_SUBST([REPLACE_TOTALORDERL]) | ||
| 410 | REPLACE_TOTALORDERMAG=0; AC_SUBST([REPLACE_TOTALORDERMAG]) | ||
| 411 | REPLACE_TOTALORDERMAGF=0; AC_SUBST([REPLACE_TOTALORDERMAGF]) | ||
| 412 | REPLACE_TOTALORDERMAGL=0; AC_SUBST([REPLACE_TOTALORDERMAGL]) | ||
| 357 | REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) | 413 | REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) |
| 358 | REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) | 414 | REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) |
| 359 | REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) | 415 | REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) |
| @@ -364,7 +420,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], | |||
| 364 | # Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines | 420 | # Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines |
| 365 | # HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. | 421 | # HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. |
| 366 | # The currently known platforms where this is the case are: | 422 | # The currently known platforms where this is the case are: |
| 367 | # Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. | 423 | # Linux/HPPA, NetBSD/sparc32, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. |
| 368 | AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], | 424 | AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], |
| 369 | [ | 425 | [ |
| 370 | AC_CACHE_CHECK([whether long double and double are the same], | 426 | AC_CACHE_CHECK([whether long double and double are the same], |
diff --git a/gl/m4/mbchar.m4 b/gl/m4/mbchar.m4 new file mode 100644 index 00000000..b76f1d7b --- /dev/null +++ b/gl/m4/mbchar.m4 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # mbchar.m4 | ||
| 2 | # serial 9 | ||
| 3 | dnl Copyright (C) 2005-2007, 2009-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 | dnl autoconf tests required for use of mbchar.m4 | ||
| 10 | dnl From Bruno Haible. | ||
| 11 | |||
| 12 | AC_DEFUN([gl_MBCHAR], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 15 | ]) | ||
diff --git a/gl/m4/mbiter.m4 b/gl/m4/mbiter.m4 new file mode 100644 index 00000000..b51242e6 --- /dev/null +++ b/gl/m4/mbiter.m4 | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | # mbiter.m4 | ||
| 2 | # serial 7 | ||
| 3 | dnl Copyright (C) 2005, 2008-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 | dnl autoconf tests required for use of mbiter.h | ||
| 10 | dnl From Bruno Haible. | ||
| 11 | |||
| 12 | AC_DEFUN([gl_MBITER], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | ||
| 15 | : | ||
| 16 | ]) | ||
diff --git a/gl/m4/mbrtoc32.m4 b/gl/m4/mbrtoc32.m4 new file mode 100644 index 00000000..1991529c --- /dev/null +++ b/gl/m4/mbrtoc32.m4 | |||
| @@ -0,0 +1,326 @@ | |||
| 1 | # mbrtoc32.m4 | ||
| 2 | # serial 21 | ||
| 3 | dnl Copyright (C) 2014-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_MBRTOC32], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) | ||
| 12 | |||
| 13 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | ||
| 14 | dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is | ||
| 15 | dnl determined. It describes how our overridden mbrtowc is implemented. | ||
| 16 | dnl We then implement mbrtoc32 accordingly. | ||
| 17 | AC_REQUIRE([gl_MBSTATE_T_BROKEN]) | ||
| 18 | |||
| 19 | AC_REQUIRE([gl_TYPE_CHAR32_T]) | ||
| 20 | AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) | ||
| 21 | |||
| 22 | AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32]) | ||
| 23 | if test $gl_cv_func_mbrtoc32 = no; then | ||
| 24 | HAVE_MBRTOC32=0 | ||
| 25 | else | ||
| 26 | if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then | ||
| 27 | REPLACE_MBRTOC32=1 | ||
| 28 | else | ||
| 29 | gl_MBRTOC32_EMPTY_INPUT | ||
| 30 | gl_MBRTOC32_C_LOCALE | ||
| 31 | gl_MBRTOC32_UTF8_LOCALE | ||
| 32 | case "$gl_cv_func_mbrtoc32_empty_input" in | ||
| 33 | *yes) ;; | ||
| 34 | *) AC_DEFINE([MBRTOC32_EMPTY_INPUT_BUG], [1], | ||
| 35 | [Define if the mbrtoc32 function does not return (size_t) -2 for empty input.]) | ||
| 36 | REPLACE_MBRTOC32=1 | ||
| 37 | ;; | ||
| 38 | esac | ||
| 39 | case "$gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ" in | ||
| 40 | *yes) ;; | ||
| 41 | *) AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ], [1], | ||
| 42 | [Define if the mbrtoc32 function may signal encoding errors in the C locale.]) | ||
| 43 | REPLACE_MBRTOC32=1 | ||
| 44 | ;; | ||
| 45 | esac | ||
| 46 | case "$gl_cv_func_mbrtoc32_utf8_locale_works" in | ||
| 47 | *yes) ;; | ||
| 48 | *) AC_DEFINE([MBRTOC32_MULTIBYTE_LOCALE_BUG], [1], | ||
| 49 | [Define if the mbrtoc32 function does not accept the input bytes one-by-one.]) | ||
| 50 | REPLACE_MBRTOC32=1 | ||
| 51 | dnl Our replacement mbrtoc32 can handle UTF-8, but not GB18030. | ||
| 52 | LOCALE_ZH_CN=none | ||
| 53 | ;; | ||
| 54 | esac | ||
| 55 | fi | ||
| 56 | if test $HAVE_WORKING_MBRTOC32 = 0; then | ||
| 57 | REPLACE_MBRTOC32=1 | ||
| 58 | fi | ||
| 59 | fi | ||
| 60 | ]) | ||
| 61 | |||
| 62 | AC_DEFUN([gl_CHECK_FUNC_MBRTOC32], | ||
| 63 | [ | ||
| 64 | dnl Cf. gl_CHECK_FUNCS_ANDROID | ||
| 65 | AC_CHECK_DECL([mbrtoc32], , , | ||
| 66 | [[#ifdef __HAIKU__ | ||
| 67 | #include <stdint.h> | ||
| 68 | #endif | ||
| 69 | #include <uchar.h> | ||
| 70 | ]]) | ||
| 71 | if test $ac_cv_have_decl_mbrtoc32 = yes; then | ||
| 72 | dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a | ||
| 73 | dnl static inline function on Haiku 2020. | ||
| 74 | AC_CACHE_CHECK([for mbrtoc32], [gl_cv_func_mbrtoc32], | ||
| 75 | [AC_LINK_IFELSE( | ||
| 76 | [AC_LANG_PROGRAM( | ||
| 77 | [[#include <stdlib.h> | ||
| 78 | #ifdef __HAIKU__ | ||
| 79 | #include <stdint.h> | ||
| 80 | #endif | ||
| 81 | #include <uchar.h> | ||
| 82 | ]], | ||
| 83 | [[char32_t c; | ||
| 84 | return mbrtoc32 (&c, "", 1, NULL) == 0; | ||
| 85 | ]]) | ||
| 86 | ], | ||
| 87 | [gl_cv_func_mbrtoc32=yes], | ||
| 88 | [gl_cv_func_mbrtoc32=no]) | ||
| 89 | ]) | ||
| 90 | else | ||
| 91 | gl_cv_func_mbrtoc32=no | ||
| 92 | fi | ||
| 93 | ]) | ||
| 94 | |||
| 95 | dnl Test whether mbrtoc32 returns the correct value on empty input. | ||
| 96 | |||
| 97 | AC_DEFUN([gl_MBRTOC32_EMPTY_INPUT], | ||
| 98 | [ | ||
| 99 | AC_REQUIRE([AC_PROG_CC]) | ||
| 100 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 101 | AC_CACHE_CHECK([whether mbrtoc32 works on empty input], | ||
| 102 | [gl_cv_func_mbrtoc32_empty_input], | ||
| 103 | [ | ||
| 104 | AC_RUN_IFELSE( | ||
| 105 | [AC_LANG_SOURCE([[ | ||
| 106 | #ifdef __HAIKU__ | ||
| 107 | #include <stdint.h> | ||
| 108 | #endif | ||
| 109 | #include <uchar.h> | ||
| 110 | static char32_t wc; | ||
| 111 | static mbstate_t mbs; | ||
| 112 | int | ||
| 113 | main (void) | ||
| 114 | { | ||
| 115 | return mbrtoc32 (&wc, "", 0, &mbs) != (size_t) -2; | ||
| 116 | }]])], | ||
| 117 | [gl_cv_func_mbrtoc32_empty_input=yes], | ||
| 118 | [gl_cv_func_mbrtoc32_empty_input=no], | ||
| 119 | [case "$host_os" in | ||
| 120 | # Guess no on glibc systems. | ||
| 121 | *-gnu* | gnu*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; | ||
| 122 | # Guess no on Android. | ||
| 123 | linux*-android*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; | ||
| 124 | # Guess no on native Windows. | ||
| 125 | mingw* | windows*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; | ||
| 126 | *) gl_cv_func_mbrtoc32_empty_input="guessing yes" ;; | ||
| 127 | esac | ||
| 128 | ]) | ||
| 129 | ]) | ||
| 130 | ]) | ||
| 131 | |||
| 132 | dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html> | ||
| 133 | dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error | ||
| 134 | dnl cannot occur since all byte values are valid characters." It is reasonable | ||
| 135 | dnl to expect mbrtoc32 to behave in the same way. | ||
| 136 | |||
| 137 | AC_DEFUN([gl_MBRTOC32_C_LOCALE], | ||
| 138 | [ | ||
| 139 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 140 | AC_CACHE_CHECK([whether the C locale is free of encoding errors], | ||
| 141 | [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ], | ||
| 142 | [AC_RUN_IFELSE( | ||
| 143 | [AC_LANG_PROGRAM( | ||
| 144 | [[#include <limits.h> | ||
| 145 | #include <locale.h> | ||
| 146 | #ifdef __HAIKU__ | ||
| 147 | #include <stdint.h> | ||
| 148 | #endif | ||
| 149 | #include <uchar.h> | ||
| 150 | ]], [[ | ||
| 151 | int i; | ||
| 152 | char *locale = setlocale (LC_ALL, "C"); | ||
| 153 | if (! locale) | ||
| 154 | return 2; | ||
| 155 | for (i = CHAR_MIN; i <= CHAR_MAX; i++) | ||
| 156 | { | ||
| 157 | char c = i; | ||
| 158 | char32_t wc; | ||
| 159 | mbstate_t mbs = { 0, }; | ||
| 160 | size_t ss = mbrtoc32 (&wc, &c, 1, &mbs); | ||
| 161 | if (1 < ss) | ||
| 162 | return 3; | ||
| 163 | } | ||
| 164 | return 0; | ||
| 165 | ]])], | ||
| 166 | [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=yes], | ||
| 167 | [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=no], | ||
| 168 | [case "$host_os" in | ||
| 169 | # Guess yes on native Windows. | ||
| 170 | mingw* | windows*) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="guessing yes" ;; | ||
| 171 | *) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;; | ||
| 172 | esac | ||
| 173 | ]) | ||
| 174 | ]) | ||
| 175 | ]) | ||
| 176 | |||
| 177 | dnl Test whether mbrtoc32 works when it's fed the bytes one-by-one in an UTF-8 | ||
| 178 | dnl locale. | ||
| 179 | |||
| 180 | AC_DEFUN([gl_MBRTOC32_UTF8_LOCALE], | ||
| 181 | [ | ||
| 182 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 183 | AC_CACHE_CHECK([whether mbrtoc32 works in an UTF-8 locale], | ||
| 184 | [gl_cv_func_mbrtoc32_utf8_locale_works], | ||
| 185 | [AC_RUN_IFELSE( | ||
| 186 | [AC_LANG_PROGRAM( | ||
| 187 | [[#include <locale.h> | ||
| 188 | #ifdef __HAIKU__ | ||
| 189 | #include <stdint.h> | ||
| 190 | #endif | ||
| 191 | #include <uchar.h> | ||
| 192 | ]], [[ | ||
| 193 | char *locale = setlocale (LC_ALL, "en_US.UTF-8"); | ||
| 194 | if (locale) | ||
| 195 | { | ||
| 196 | /* This test fails on Cygwin 3.5.3. */ | ||
| 197 | mbstate_t state = { 0, }; | ||
| 198 | char32_t uc = 0xDEADBEEF; | ||
| 199 | /* \360\237\220\203 = U+0001F403 */ | ||
| 200 | if (mbrtoc32 (&uc, "\360", 1, &state) != (size_t)-2) | ||
| 201 | return 1; | ||
| 202 | if (mbrtoc32 (&uc, "\237", 1, &state) != (size_t)-2) | ||
| 203 | return 2; | ||
| 204 | if (mbrtoc32 (&uc, "\220", 1, &state) != (size_t)-2) | ||
| 205 | return 3; | ||
| 206 | if (mbrtoc32 (&uc, "\203", 1, &state) != 1) | ||
| 207 | return 4; | ||
| 208 | if (uc != 0x0001F403) | ||
| 209 | return 5; | ||
| 210 | } | ||
| 211 | return 0; | ||
| 212 | ]])], | ||
| 213 | [gl_cv_func_mbrtoc32_utf8_locale_works=yes], | ||
| 214 | [gl_cv_func_mbrtoc32_utf8_locale_works=no], | ||
| 215 | [case "$host_os" in | ||
| 216 | # Guess no on Cygwin. | ||
| 217 | cygwin*) gl_cv_func_mbrtoc32_utf8_locale_works="guessing no" ;; | ||
| 218 | *) gl_cv_func_mbrtoc32_utf8_locale_works="$gl_cross_guess_normal" ;; | ||
| 219 | esac | ||
| 220 | ]) | ||
| 221 | ]) | ||
| 222 | ]) | ||
| 223 | |||
| 224 | dnl Test whether mbrtoc32 works not worse than mbrtowc. | ||
| 225 | dnl Result is HAVE_WORKING_MBRTOC32. | ||
| 226 | |||
| 227 | AC_DEFUN([gl_MBRTOC32_SANITYCHECK], | ||
| 228 | [ | ||
| 229 | AC_REQUIRE([AC_PROG_CC]) | ||
| 230 | AC_REQUIRE([gl_TYPE_CHAR32_T]) | ||
| 231 | AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32]) | ||
| 232 | AC_REQUIRE([gt_LOCALE_FR]) | ||
| 233 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
| 234 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 235 | if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then | ||
| 236 | HAVE_WORKING_MBRTOC32=0 | ||
| 237 | else | ||
| 238 | AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc], | ||
| 239 | [gl_cv_func_mbrtoc32_sanitycheck], | ||
| 240 | [ | ||
| 241 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
| 242 | dnl is present. | ||
| 243 | changequote(,)dnl | ||
| 244 | case "$host_os" in | ||
| 245 | # Guess no on FreeBSD, Solaris, native Windows. | ||
| 246 | freebsd* | midnightbsd* | solaris* | mingw* | windows*) | ||
| 247 | gl_cv_func_mbrtoc32_sanitycheck="guessing no" | ||
| 248 | ;; | ||
| 249 | # Guess yes otherwise. | ||
| 250 | *) | ||
| 251 | gl_cv_func_mbrtoc32_sanitycheck="guessing yes" | ||
| 252 | ;; | ||
| 253 | esac | ||
| 254 | changequote([,])dnl | ||
| 255 | if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then | ||
| 256 | AC_RUN_IFELSE( | ||
| 257 | [AC_LANG_SOURCE([[ | ||
| 258 | #include <locale.h> | ||
| 259 | #include <stdlib.h> | ||
| 260 | #include <string.h> | ||
| 261 | #include <wchar.h> | ||
| 262 | #ifdef __HAIKU__ | ||
| 263 | #include <stdint.h> | ||
| 264 | #endif | ||
| 265 | #include <uchar.h> | ||
| 266 | int main () | ||
| 267 | { | ||
| 268 | int result = 0; | ||
| 269 | /* This fails on native Windows: | ||
| 270 | mbrtoc32 returns (size_t)-1. | ||
| 271 | mbrtowc returns 1 (correct). */ | ||
| 272 | if (strcmp ("$LOCALE_FR", "none") != 0 | ||
| 273 | && setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
| 274 | { | ||
| 275 | mbstate_t state; | ||
| 276 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
| 277 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 278 | if (mbrtowc (&wc, "\374", 1, &state) == 1) | ||
| 279 | { | ||
| 280 | char32_t c32 = (wchar_t) 0xBADFACE; | ||
| 281 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 282 | if (mbrtoc32 (&c32, "\374", 1, &state) != 1) | ||
| 283 | result |= 1; | ||
| 284 | } | ||
| 285 | } | ||
| 286 | /* This fails on FreeBSD 13.0 and Solaris 11.4: | ||
| 287 | mbrtoc32 returns (size_t)-2 or (size_t)-1. | ||
| 288 | mbrtowc returns 4 (correct). */ | ||
| 289 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 | ||
| 290 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
| 291 | { | ||
| 292 | mbstate_t state; | ||
| 293 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
| 294 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 295 | if (mbrtowc (&wc, "\224\071\375\067", 4, &state) == 4) | ||
| 296 | { | ||
| 297 | char32_t c32 = (wchar_t) 0xBADFACE; | ||
| 298 | memset (&state, '\0', sizeof (mbstate_t)); | ||
| 299 | if (mbrtoc32 (&c32, "\224\071\375\067", 4, &state) != 4) | ||
| 300 | result |= 2; | ||
| 301 | } | ||
| 302 | } | ||
| 303 | return result; | ||
| 304 | }]])], | ||
| 305 | [gl_cv_func_mbrtoc32_sanitycheck=yes], | ||
| 306 | [gl_cv_func_mbrtoc32_sanitycheck=no], | ||
| 307 | [:]) | ||
| 308 | fi | ||
| 309 | ]) | ||
| 310 | case "$gl_cv_func_mbrtoc32_sanitycheck" in | ||
| 311 | *yes) | ||
| 312 | HAVE_WORKING_MBRTOC32=1 | ||
| 313 | AC_DEFINE([HAVE_WORKING_MBRTOC32], [1], | ||
| 314 | [Define if the mbrtoc32 function basically works.]) | ||
| 315 | ;; | ||
| 316 | *) HAVE_WORKING_MBRTOC32=0 ;; | ||
| 317 | esac | ||
| 318 | fi | ||
| 319 | AC_SUBST([HAVE_WORKING_MBRTOC32]) | ||
| 320 | ]) | ||
| 321 | |||
| 322 | # Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c. | ||
| 323 | AC_DEFUN([gl_PREREQ_MBRTOC32], [ | ||
| 324 | AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) | ||
| 325 | : | ||
| 326 | ]) | ||
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index bb393041..cc09a5fb 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # mbrtowc.m4 serial 38 -*- coding: utf-8 -*- | 1 | # mbrtowc.m4 |
| 2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2023 Free Software Foundation, | 2 | # serial 46 |
| 3 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | AC_DEFUN([gl_FUNC_MBRTOWC], | 10 | AC_DEFUN([gl_FUNC_MBRTOWC], |
| 9 | [ | 11 | [ |
| @@ -91,20 +93,25 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
| 91 | fi | 93 | fi |
| 92 | if test $REPLACE_MBSTATE_T = 1; then | 94 | if test $REPLACE_MBSTATE_T = 1; then |
| 93 | case "$host_os" in | 95 | case "$host_os" in |
| 94 | mingw*) LIB_MBRTOWC= ;; | 96 | mingw* | windows*) |
| 97 | MBRTOWC_LIB= | ||
| 98 | ;; | ||
| 95 | *) | 99 | *) |
| 96 | gl_WEAK_SYMBOLS | 100 | gl_WEAK_SYMBOLS |
| 97 | case "$gl_cv_have_weak" in | 101 | case "$gl_cv_have_weak" in |
| 98 | *yes) LIB_MBRTOWC= ;; | 102 | *yes) MBRTOWC_LIB= ;; |
| 99 | *) LIB_MBRTOWC="$LIBPTHREAD" ;; | 103 | *) MBRTOWC_LIB="$LIBPTHREAD" ;; |
| 100 | esac | 104 | esac |
| 101 | ;; | 105 | ;; |
| 102 | esac | 106 | esac |
| 103 | else | 107 | else |
| 104 | LIB_MBRTOWC= | 108 | MBRTOWC_LIB= |
| 105 | fi | 109 | fi |
| 106 | dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX | 110 | dnl MBRTOWC_LIB is expected to be '-pthread' or '-lpthread' on AIX |
| 107 | dnl with gcc or xlc, and empty otherwise. | 111 | dnl with gcc or xlc, and empty otherwise. |
| 112 | AC_SUBST([MBRTOWC_LIB]) | ||
| 113 | dnl For backward compatibility. | ||
| 114 | LIB_MBRTOWC="$MBRTOWC_LIB" | ||
| 108 | AC_SUBST([LIB_MBRTOWC]) | 115 | AC_SUBST([LIB_MBRTOWC]) |
| 109 | ]) | 116 | ]) |
| 110 | 117 | ||
| @@ -114,7 +121,7 @@ dnl Result is REPLACE_MBSTATE_T. | |||
| 114 | dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to | 121 | dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to |
| 115 | dnl avoid inconsistencies. | 122 | dnl avoid inconsistencies. |
| 116 | 123 | ||
| 117 | AC_DEFUN([gl_MBSTATE_T_BROKEN], | 124 | AC_DEFUN_ONCE([gl_MBSTATE_T_BROKEN], |
| 118 | [ | 125 | [ |
| 119 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 126 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
| 120 | AC_REQUIRE([AC_CANONICAL_HOST]) | 127 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| @@ -126,7 +133,7 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], | |||
| 126 | dnl to override it, even if - like on MSVC - mbsinit() is only defined as | 133 | dnl to override it, even if - like on MSVC - mbsinit() is only defined as |
| 127 | dnl an inline function, not as a global function. | 134 | dnl an inline function, not as a global function. |
| 128 | if case "$host_os" in | 135 | if case "$host_os" in |
| 129 | mingw*) true ;; | 136 | mingw* | windows*) true ;; |
| 130 | *) test $ac_cv_func_mbsinit = yes ;; | 137 | *) test $ac_cv_func_mbsinit = yes ;; |
| 131 | esac \ | 138 | esac \ |
| 132 | && test $ac_cv_func_mbrtowc = yes; then | 139 | && test $ac_cv_func_mbrtowc = yes; then |
| @@ -154,7 +161,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], | |||
| 154 | [ | 161 | [ |
| 155 | AC_REQUIRE([AC_PROG_CC]) | 162 | AC_REQUIRE([AC_PROG_CC]) |
| 156 | AC_REQUIRE([gt_LOCALE_JA]) | 163 | AC_REQUIRE([gt_LOCALE_JA]) |
| 157 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 164 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) |
| 158 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 165 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 159 | AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], | 166 | AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], |
| 160 | [gl_cv_func_mbrtowc_incomplete_state], | 167 | [gl_cv_func_mbrtowc_incomplete_state], |
| @@ -194,7 +201,7 @@ int main () | |||
| 194 | [gl_cv_func_mbrtowc_incomplete_state=no], | 201 | [gl_cv_func_mbrtowc_incomplete_state=no], |
| 195 | [:]) | 202 | [:]) |
| 196 | else | 203 | else |
| 197 | if test $LOCALE_FR_UTF8 != none; then | 204 | if test "$LOCALE_EN_UTF8" != none; then |
| 198 | AC_RUN_IFELSE( | 205 | AC_RUN_IFELSE( |
| 199 | [AC_LANG_SOURCE([[ | 206 | [AC_LANG_SOURCE([[ |
| 200 | #include <locale.h> | 207 | #include <locale.h> |
| @@ -202,7 +209,7 @@ int main () | |||
| 202 | #include <wchar.h> | 209 | #include <wchar.h> |
| 203 | int main () | 210 | int main () |
| 204 | { | 211 | { |
| 205 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 212 | if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) |
| 206 | { | 213 | { |
| 207 | const char input[] = "B\303\274\303\237er"; /* "Büßer" */ | 214 | const char input[] = "B\303\274\303\237er"; /* "Büßer" */ |
| 208 | mbstate_t state; | 215 | mbstate_t state; |
| @@ -282,7 +289,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1. | |||
| 282 | AC_DEFUN([gl_MBRTOWC_NULL_ARG1], | 289 | AC_DEFUN([gl_MBRTOWC_NULL_ARG1], |
| 283 | [ | 290 | [ |
| 284 | AC_REQUIRE([AC_PROG_CC]) | 291 | AC_REQUIRE([AC_PROG_CC]) |
| 285 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 292 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) |
| 286 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 293 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 287 | AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], | 294 | AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], |
| 288 | [gl_cv_func_mbrtowc_null_arg1], | 295 | [gl_cv_func_mbrtowc_null_arg1], |
| @@ -297,7 +304,7 @@ changequote(,)dnl | |||
| 297 | *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; | 304 | *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; |
| 298 | esac | 305 | esac |
| 299 | changequote([,])dnl | 306 | changequote([,])dnl |
| 300 | if test $LOCALE_FR_UTF8 != none; then | 307 | if test "$LOCALE_EN_UTF8" != none; then |
| 301 | AC_RUN_IFELSE( | 308 | AC_RUN_IFELSE( |
| 302 | [AC_LANG_SOURCE([[ | 309 | [AC_LANG_SOURCE([[ |
| 303 | #include <locale.h> | 310 | #include <locale.h> |
| @@ -308,7 +315,7 @@ int main () | |||
| 308 | { | 315 | { |
| 309 | int result = 0; | 316 | int result = 0; |
| 310 | 317 | ||
| 311 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 318 | if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) |
| 312 | { | 319 | { |
| 313 | char input[] = "\303\237er"; | 320 | char input[] = "\303\237er"; |
| 314 | mbstate_t state; | 321 | mbstate_t state; |
| @@ -345,7 +352,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg2. | |||
| 345 | AC_DEFUN([gl_MBRTOWC_NULL_ARG2], | 352 | AC_DEFUN([gl_MBRTOWC_NULL_ARG2], |
| 346 | [ | 353 | [ |
| 347 | AC_REQUIRE([AC_PROG_CC]) | 354 | AC_REQUIRE([AC_PROG_CC]) |
| 348 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 355 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) |
| 349 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 356 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 350 | AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], | 357 | AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], |
| 351 | [gl_cv_func_mbrtowc_null_arg2], | 358 | [gl_cv_func_mbrtowc_null_arg2], |
| @@ -360,7 +367,7 @@ changequote(,)dnl | |||
| 360 | *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; | 367 | *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; |
| 361 | esac | 368 | esac |
| 362 | changequote([,])dnl | 369 | changequote([,])dnl |
| 363 | if test $LOCALE_FR_UTF8 != none; then | 370 | if test "$LOCALE_EN_UTF8" != none; then |
| 364 | AC_RUN_IFELSE( | 371 | AC_RUN_IFELSE( |
| 365 | [AC_LANG_SOURCE([[ | 372 | [AC_LANG_SOURCE([[ |
| 366 | #include <locale.h> | 373 | #include <locale.h> |
| @@ -368,7 +375,7 @@ changequote([,])dnl | |||
| 368 | #include <wchar.h> | 375 | #include <wchar.h> |
| 369 | int main () | 376 | int main () |
| 370 | { | 377 | { |
| 371 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 378 | if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) |
| 372 | { | 379 | { |
| 373 | mbstate_t state; | 380 | mbstate_t state; |
| 374 | wchar_t wc; | 381 | wchar_t wc; |
| @@ -398,7 +405,7 @@ dnl Result is gl_cv_func_mbrtowc_retval. | |||
| 398 | AC_DEFUN([gl_MBRTOWC_RETVAL], | 405 | AC_DEFUN([gl_MBRTOWC_RETVAL], |
| 399 | [ | 406 | [ |
| 400 | AC_REQUIRE([AC_PROG_CC]) | 407 | AC_REQUIRE([AC_PROG_CC]) |
| 401 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 408 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) |
| 402 | AC_REQUIRE([gt_LOCALE_JA]) | 409 | AC_REQUIRE([gt_LOCALE_JA]) |
| 403 | AC_REQUIRE([AC_CANONICAL_HOST]) | 410 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 404 | AC_CACHE_CHECK([whether mbrtowc has a correct return value], | 411 | AC_CACHE_CHECK([whether mbrtowc has a correct return value], |
| @@ -408,14 +415,16 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], | |||
| 408 | dnl is present. | 415 | dnl is present. |
| 409 | changequote(,)dnl | 416 | changequote(,)dnl |
| 410 | case "$host_os" in | 417 | case "$host_os" in |
| 411 | # Guess no on HP-UX, Solaris, native Windows. | 418 | # Guess no on HP-UX, Solaris, native Windows. |
| 412 | hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; | 419 | hpux* | solaris* | mingw* | windows*) |
| 413 | # Guess yes otherwise. | 420 | gl_cv_func_mbrtowc_retval="guessing no" ;; |
| 414 | *) gl_cv_func_mbrtowc_retval="guessing yes" ;; | 421 | # Guess yes otherwise. |
| 422 | *) | ||
| 423 | gl_cv_func_mbrtowc_retval="guessing yes" ;; | ||
| 415 | esac | 424 | esac |
| 416 | changequote([,])dnl | 425 | changequote([,])dnl |
| 417 | if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ | 426 | if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \ |
| 418 | || { case "$host_os" in mingw*) true;; *) false;; esac; }; then | 427 | || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then |
| 419 | AC_RUN_IFELSE( | 428 | AC_RUN_IFELSE( |
| 420 | [AC_LANG_SOURCE([[ | 429 | [AC_LANG_SOURCE([[ |
| 421 | #include <locale.h> | 430 | #include <locale.h> |
| @@ -426,7 +435,8 @@ int main () | |||
| 426 | int result = 0; | 435 | int result = 0; |
| 427 | int found_some_locale = 0; | 436 | int found_some_locale = 0; |
| 428 | /* This fails on Solaris. */ | 437 | /* This fails on Solaris. */ |
| 429 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 438 | if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 |
| 439 | && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) | ||
| 430 | { | 440 | { |
| 431 | char input[] = "B\303\274\303\237er"; /* "Büßer" */ | 441 | char input[] = "B\303\274\303\237er"; /* "Büßer" */ |
| 432 | mbstate_t state; | 442 | mbstate_t state; |
| @@ -442,7 +452,8 @@ int main () | |||
| 442 | found_some_locale = 1; | 452 | found_some_locale = 1; |
| 443 | } | 453 | } |
| 444 | /* This fails on HP-UX 11.11. */ | 454 | /* This fails on HP-UX 11.11. */ |
| 445 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 455 | if (strcmp ("$LOCALE_JA", "none") != 0 |
| 456 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
| 446 | { | 457 | { |
| 447 | char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ | 458 | char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ |
| 448 | mbstate_t state; | 459 | mbstate_t state; |
| @@ -577,13 +588,13 @@ AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE], | |||
| 577 | dnl is present. | 588 | dnl is present. |
| 578 | changequote(,)dnl | 589 | changequote(,)dnl |
| 579 | case "$host_os" in | 590 | case "$host_os" in |
| 580 | # Guess yes on native Windows. | 591 | # Guess yes on native Windows. |
| 581 | mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; | 592 | mingw* | windows*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; |
| 582 | *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; | 593 | *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; |
| 583 | esac | 594 | esac |
| 584 | changequote([,])dnl | 595 | changequote([,])dnl |
| 585 | case "$host_os" in | 596 | case "$host_os" in |
| 586 | mingw*) | 597 | mingw* | windows*) |
| 587 | AC_RUN_IFELSE( | 598 | AC_RUN_IFELSE( |
| 588 | [AC_LANG_SOURCE([[ | 599 | [AC_LANG_SOURCE([[ |
| 589 | #include <locale.h> | 600 | #include <locale.h> |
| @@ -639,8 +650,8 @@ int main () | |||
| 639 | [:]) | 650 | [:]) |
| 640 | ;; | 651 | ;; |
| 641 | *) | 652 | *) |
| 642 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 653 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) |
| 643 | if test $LOCALE_FR_UTF8 != none; then | 654 | if test "$LOCALE_EN_UTF8" != none; then |
| 644 | AC_RUN_IFELSE( | 655 | AC_RUN_IFELSE( |
| 645 | [AC_LANG_SOURCE([[ | 656 | [AC_LANG_SOURCE([[ |
| 646 | #include <locale.h> | 657 | #include <locale.h> |
| @@ -648,7 +659,7 @@ int main () | |||
| 648 | #include <wchar.h> | 659 | #include <wchar.h> |
| 649 | int main () | 660 | int main () |
| 650 | { | 661 | { |
| 651 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 662 | if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) |
| 652 | { | 663 | { |
| 653 | wchar_t wc = (wchar_t) 0xBADFACE; | 664 | wchar_t wc = (wchar_t) 0xBADFACE; |
| 654 | mbstate_t state; | 665 | mbstate_t state; |
| @@ -677,31 +688,28 @@ AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], | |||
| 677 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 688 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 678 | AC_CACHE_CHECK([whether mbrtowc works on empty input], | 689 | AC_CACHE_CHECK([whether mbrtowc works on empty input], |
| 679 | [gl_cv_func_mbrtowc_empty_input], | 690 | [gl_cv_func_mbrtowc_empty_input], |
| 680 | [ | 691 | [AC_RUN_IFELSE( |
| 681 | dnl Initial guess, used when cross-compiling or when no suitable locale | 692 | [AC_LANG_SOURCE([[ |
| 682 | dnl is present. | 693 | #include <wchar.h> |
| 683 | changequote(,)dnl | 694 | static wchar_t wc; |
| 684 | case "$host_os" in | 695 | static mbstate_t mbs; |
| 685 | # Guess no on AIX and glibc systems. | 696 | int |
| 686 | aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; | 697 | main (void) |
| 687 | # Guess yes on native Windows. | 698 | { |
| 688 | mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; | 699 | return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; |
| 689 | *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; | 700 | }]])], |
| 690 | esac | 701 | [gl_cv_func_mbrtowc_empty_input=yes], |
| 691 | changequote([,])dnl | 702 | [gl_cv_func_mbrtowc_empty_input=no], |
| 692 | AC_RUN_IFELSE( | 703 | [case "$host_os" in |
| 693 | [AC_LANG_SOURCE([[ | 704 | # Guess no on AIX and glibc systems. |
| 694 | #include <wchar.h> | 705 | aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; |
| 695 | static wchar_t wc; | 706 | # Guess no on Android. |
| 696 | static mbstate_t mbs; | 707 | linux*-android*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; |
| 697 | int | 708 | # Guess no on native Windows. |
| 698 | main (void) | 709 | mingw* | windows*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; |
| 699 | { | 710 | *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; |
| 700 | return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; | 711 | esac |
| 701 | }]])], | 712 | ]) |
| 702 | [gl_cv_func_mbrtowc_empty_input=yes], | ||
| 703 | [gl_cv_func_mbrtowc_empty_input=no], | ||
| 704 | [:]) | ||
| 705 | ]) | 713 | ]) |
| 706 | ]) | 714 | ]) |
| 707 | 715 | ||
| @@ -709,18 +717,17 @@ dnl Test whether mbrtowc reports encoding errors in the C locale. | |||
| 709 | dnl Although POSIX was never intended to allow this, the GNU C Library | 717 | dnl Although POSIX was never intended to allow this, the GNU C Library |
| 710 | dnl and other implementations do it. See: | 718 | dnl and other implementations do it. See: |
| 711 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 | 719 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 |
| 720 | dnl POSIX has now clarified it: | ||
| 721 | dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html> | ||
| 722 | dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte | ||
| 723 | dnl values are valid characters." | ||
| 712 | 724 | ||
| 713 | AC_DEFUN([gl_MBRTOWC_C_LOCALE], | 725 | AC_DEFUN([gl_MBRTOWC_C_LOCALE], |
| 714 | [ | 726 | [ |
| 715 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 727 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 716 | AC_CACHE_CHECK([whether the C locale is free of encoding errors], | 728 | AC_CACHE_CHECK([whether the C locale is free of encoding errors], |
| 717 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], | 729 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], |
| 718 | [ | 730 | [AC_RUN_IFELSE( |
| 719 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
| 720 | dnl is present. | ||
| 721 | gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" | ||
| 722 | |||
| 723 | AC_RUN_IFELSE( | ||
| 724 | [AC_LANG_PROGRAM( | 731 | [AC_LANG_PROGRAM( |
| 725 | [[#include <limits.h> | 732 | [[#include <limits.h> |
| 726 | #include <locale.h> | 733 | #include <locale.h> |
| @@ -741,13 +748,14 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], | |||
| 741 | } | 748 | } |
| 742 | return 0; | 749 | return 0; |
| 743 | ]])], | 750 | ]])], |
| 744 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], | 751 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], |
| 745 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], | 752 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], |
| 746 | [case "$host_os" in | 753 | [case "$host_os" in |
| 747 | # Guess yes on native Windows. | 754 | # Guess yes on native Windows. |
| 748 | mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; | 755 | mingw* | windows*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; |
| 749 | esac | 756 | *) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;; |
| 750 | ]) | 757 | esac |
| 758 | ]) | ||
| 751 | ]) | 759 | ]) |
| 752 | ]) | 760 | ]) |
| 753 | 761 | ||
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4 index c388a8b9..69cfa574 100644 --- a/gl/m4/mbsinit.m4 +++ b/gl/m4/mbsinit.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # mbsinit.m4 serial 9 | 1 | # mbsinit.m4 |
| 2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
| 3 | dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_MBSINIT], | 9 | AC_DEFUN([gl_FUNC_MBSINIT], |
| 8 | [ | 10 | [ |
| @@ -32,7 +34,7 @@ AC_DEFUN([gl_FUNC_MBSINIT], | |||
| 32 | dnl states produced by mbrtowc() for an incomplete multibyte character | 34 | dnl states produced by mbrtowc() for an incomplete multibyte character |
| 33 | dnl in multibyte locales. | 35 | dnl in multibyte locales. |
| 34 | case "$host_os" in | 36 | case "$host_os" in |
| 35 | mingw*) REPLACE_MBSINIT=1 ;; | 37 | mingw* | windows*) REPLACE_MBSINIT=1 ;; |
| 36 | esac | 38 | esac |
| 37 | fi | 39 | fi |
| 38 | fi | 40 | fi |
diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4 index dcd66b96..59df1e2e 100644 --- a/gl/m4/mbstate_t.m4 +++ b/gl/m4/mbstate_t.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # mbstate_t.m4 serial 14 | 1 | # mbstate_t.m4 |
| 2 | dnl Copyright (C) 2000-2002, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 14 |
| 3 | dnl Copyright (C) 2000-2002, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # From Paul Eggert. | 9 | # From Paul Eggert. |
| 8 | 10 | ||
diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4 index 7823be0e..3e3f6ce0 100644 --- a/gl/m4/mbtowc.m4 +++ b/gl/m4/mbtowc.m4 | |||
| @@ -1,16 +1,21 @@ | |||
| 1 | # mbtowc.m4 serial 3 | 1 | # mbtowc.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_MBTOWC], | 9 | AC_DEFUN([gl_FUNC_MBTOWC], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 10 | 12 | ||
| 11 | AC_CHECK_FUNCS([mbtowc]) | 13 | gl_CHECK_FUNCS_ANDROID([mbtowc], [[#include <stdlib.h>]]) |
| 12 | if test $ac_cv_func_mbtowc = no; then | 14 | if test $ac_cv_func_mbtowc = no; then |
| 13 | HAVE_MBTOWC=0 | 15 | HAVE_MBTOWC=0 |
| 16 | case "$gl_cv_onwards_func_mbtowc" in | ||
| 17 | future*) REPLACE_MBTOWC=1 ;; | ||
| 18 | esac | ||
| 14 | else | 19 | else |
| 15 | if false; then | 20 | if false; then |
| 16 | REPLACE_MBTOWC=1 | 21 | REPLACE_MBTOWC=1 |
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index 4f1aed01..1c2ecf1d 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # memchr.m4 serial 18 | 1 | # memchr.m4 |
| 2 | dnl Copyright (C) 2002-2004, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 20 |
| 3 | dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | 9 | AC_DEFUN_ONCE([gl_FUNC_MEMCHR], |
| 8 | [ | 10 | [ |
| @@ -48,7 +50,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | |||
| 48 | if (fd >= 0) | 50 | if (fd >= 0) |
| 49 | # endif | 51 | # endif |
| 50 | { | 52 | { |
| 51 | int pagesize = getpagesize (); | 53 | long int pagesize = sysconf (_SC_PAGESIZE); |
| 52 | char *two_pages = | 54 | char *two_pages = |
| 53 | (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, | 55 | (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, |
| 54 | flags, fd, 0); | 56 | flags, fd, 0); |
| @@ -85,12 +87,12 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | |||
| 85 | [gl_cv_func_memchr_works=yes], | 87 | [gl_cv_func_memchr_works=yes], |
| 86 | [gl_cv_func_memchr_works=no], | 88 | [gl_cv_func_memchr_works=no], |
| 87 | [case "$host_os" in | 89 | [case "$host_os" in |
| 88 | # Guess no on Android. | 90 | # Guess no on Android. |
| 89 | linux*-android*) gl_cv_func_memchr_works="guessing no" ;; | 91 | linux*-android*) gl_cv_func_memchr_works="guessing no" ;; |
| 90 | # Guess yes on native Windows. | 92 | # Guess yes on native Windows. |
| 91 | mingw*) gl_cv_func_memchr_works="guessing yes" ;; | 93 | mingw* | windows*) gl_cv_func_memchr_works="guessing yes" ;; |
| 92 | # If we don't know, obey --enable-cross-guesses. | 94 | # If we don't know, obey --enable-cross-guesses. |
| 93 | *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; | 95 | *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; |
| 94 | esac | 96 | esac |
| 95 | ]) | 97 | ]) |
| 96 | ]) | 98 | ]) |
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 index fd09846f..69c8a89f 100644 --- a/gl/m4/minmax.m4 +++ b/gl/m4/minmax.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # minmax.m4 serial 4 | 1 | # minmax.m4 |
| 2 | dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
| 3 | dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_PREREQ([2.53]) | 9 | AC_PREREQ([2.53]) |
| 8 | 10 | ||
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index e9d31f35..eca6c4d8 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # serial 37 | 1 | # mktime.m4 |
| 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation, | 2 | # serial 42 |
| 3 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | dnl From Jim Meyering. | 10 | dnl From Jim Meyering. |
| 9 | 11 | ||
| @@ -264,9 +266,9 @@ main () | |||
| 264 | [gl_cv_func_working_mktime=yes], | 266 | [gl_cv_func_working_mktime=yes], |
| 265 | [gl_cv_func_working_mktime=no], | 267 | [gl_cv_func_working_mktime=no], |
| 266 | [case "$host_os" in | 268 | [case "$host_os" in |
| 267 | # Guess no on native Windows. | 269 | # Guess no on native Windows. |
| 268 | mingw*) gl_cv_func_working_mktime="guessing no" ;; | 270 | mingw* | windows*) gl_cv_func_working_mktime="guessing no" ;; |
| 269 | *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; | 271 | *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; |
| 270 | esac | 272 | esac |
| 271 | ]) | 273 | ]) |
| 272 | fi | 274 | fi |
| @@ -280,7 +282,6 @@ AC_DEFUN([gl_FUNC_MKTIME], | |||
| 280 | AC_REQUIRE([AC_CANONICAL_HOST]) | 282 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 281 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) | 283 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) |
| 282 | 284 | ||
| 283 | REPLACE_MKTIME=0 | ||
| 284 | if test "$gl_cv_func_working_mktime" != yes; then | 285 | if test "$gl_cv_func_working_mktime" != yes; then |
| 285 | REPLACE_MKTIME=1 | 286 | REPLACE_MKTIME=1 |
| 286 | AC_DEFINE([NEED_MKTIME_WORKING], [1], | 287 | AC_DEFINE([NEED_MKTIME_WORKING], [1], |
| @@ -288,7 +289,7 @@ AC_DEFUN([gl_FUNC_MKTIME], | |||
| 288 | with the algorithmic workarounds.]) | 289 | with the algorithmic workarounds.]) |
| 289 | fi | 290 | fi |
| 290 | case "$host_os" in | 291 | case "$host_os" in |
| 291 | mingw*) | 292 | mingw* | windows*) |
| 292 | REPLACE_MKTIME=1 | 293 | REPLACE_MKTIME=1 |
| 293 | AC_DEFINE([NEED_MKTIME_WINDOWS], [1], | 294 | AC_DEFINE([NEED_MKTIME_WINDOWS], [1], |
| 294 | [Define if the compilation of mktime.c should define 'mktime' | 295 | [Define if the compilation of mktime.c should define 'mktime' |
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 index d07d26e4..3f7a6656 100644 --- a/gl/m4/mmap-anon.m4 +++ b/gl/m4/mmap-anon.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # mmap-anon.m4 serial 12 | 1 | # mmap-anon.m4 |
| 2 | dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
| 3 | dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # Detect how mmap can be used to create anonymous (not file-backed) memory | 9 | # Detect how mmap can be used to create anonymous (not file-backed) memory |
| 8 | # mappings. | 10 | # mappings. |
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4 index 82197c02..7dae201b 100644 --- a/gl/m4/mode_t.m4 +++ b/gl/m4/mode_t.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # mode_t.m4 serial 2 | 1 | # mode_t.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 2 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # For using mode_t, it's sufficient to use AC_TYPE_MODE_T and | 9 | # For using mode_t, it's sufficient to use AC_TYPE_MODE_T and |
| 8 | # include <sys/types.h>. | 10 | # include <sys/types.h>. |
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4 index a9b4edb9..e7eac2e9 100644 --- a/gl/m4/mountlist.m4 +++ b/gl/m4/mountlist.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # serial 15 | 1 | # mountlist.m4 |
| 2 | dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
| 3 | dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Jim Meyering. | 9 | dnl From Jim Meyering. |
| 8 | 10 | ||
| @@ -106,7 +108,18 @@ $ac_includes_default | |||
| 106 | [Define if there is a function named getmntent for reading the list | 108 | [Define if there is a function named getmntent for reading the list |
| 107 | of mounted file systems, and that function takes a single argument. | 109 | of mounted file systems, and that function takes a single argument. |
| 108 | (4.3BSD, SunOS, HP-UX, Irix)]) | 110 | (4.3BSD, SunOS, HP-UX, Irix)]) |
| 109 | AC_CHECK_FUNCS([setmntent endmntent hasmntopt]) | 111 | gl_CHECK_FUNCS_ANDROID([setmntent], |
| 112 | [[#include <stdio.h> | ||
| 113 | #include <mntent.h> | ||
| 114 | ]]) | ||
| 115 | gl_CHECK_FUNCS_ANDROID([endmntent], | ||
| 116 | [[#include <stdio.h> | ||
| 117 | #include <mntent.h> | ||
| 118 | ]]) | ||
| 119 | gl_CHECK_FUNCS_ANDROID([hasmntopt], | ||
| 120 | [[#include <stdio.h> | ||
| 121 | #include <mntent.h> | ||
| 122 | ]]) | ||
| 110 | fi | 123 | fi |
| 111 | fi | 124 | fi |
| 112 | 125 | ||
| @@ -306,12 +319,17 @@ int getmntinfo (struct statfs **, int); | |||
| 306 | fi | 319 | fi |
| 307 | 320 | ||
| 308 | if test -z "$ac_list_mounted_fs"; then | 321 | if test -z "$ac_list_mounted_fs"; then |
| 309 | AC_MSG_ERROR([could not determine how to read list of mounted file systems]) | 322 | case "$host_os" in |
| 310 | # FIXME -- no need to abort building the whole package | 323 | mingw* | windows*) ac_list_mounted_fs=found ;; |
| 311 | # Can't build mountlist.c or anything that needs its functions | 324 | esac |
| 325 | fi | ||
| 326 | |||
| 327 | if test -z "$ac_list_mounted_fs"; then | ||
| 328 | AC_DEFINE([MOUNTED_NOT_PORTED], [1], | ||
| 329 | [Define if we don't know how to determine the list of mounted file systems.]) | ||
| 312 | fi | 330 | fi |
| 313 | 331 | ||
| 314 | if test $ac_list_mounted_fs = found; then | 332 | if test "$ac_list_mounted_fs" = found; then |
| 315 | gl_cv_list_mounted_fs=yes | 333 | gl_cv_list_mounted_fs=yes |
| 316 | else | 334 | else |
| 317 | gl_cv_list_mounted_fs=no | 335 | gl_cv_list_mounted_fs=no |
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4 index 8d9d21b5..bfbb983b 100644 --- a/gl/m4/msvc-inval.m4 +++ b/gl/m4/msvc-inval.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # msvc-inval.m4 serial 1 | 1 | # msvc-inval.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_MSVC_INVAL], | 9 | AC_DEFUN([gl_MSVC_INVAL], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4 index 0263e490..6a470971 100644 --- a/gl/m4/msvc-nothrow.m4 +++ b/gl/m4/msvc-nothrow.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # msvc-nothrow.m4 serial 1 | 1 | # msvc-nothrow.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_MSVC_NOTHROW], | 9 | AC_DEFUN([gl_MSVC_NOTHROW], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 3ba5b0f7..817f01f1 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # multiarch.m4 serial 9 | 1 | # multiarch.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # Determine whether the compiler is or may be producing universal binaries. | 9 | # Determine whether the compiler is or may be producing universal binaries. |
| 8 | # | 10 | # |
diff --git a/gl/m4/musl.m4 b/gl/m4/musl.m4 new file mode 100644 index 00000000..6ff778cb --- /dev/null +++ b/gl/m4/musl.m4 | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # musl.m4 | ||
| 2 | # serial 4 | ||
| 3 | dnl Copyright (C) 2019-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 | # Test for musl libc, despite the musl libc authors don't like it | ||
| 10 | # <https://wiki.musl-libc.org/faq.html> | ||
| 11 | # <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>. | ||
| 12 | # From Bruno Haible. | ||
| 13 | |||
| 14 | AC_DEFUN_ONCE([gl_MUSL_LIBC], | ||
| 15 | [ | ||
| 16 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 17 | case "$host_os" in | ||
| 18 | *-musl* | midipix*) | ||
| 19 | AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) | ||
| 20 | ;; | ||
| 21 | esac | ||
| 22 | ]) | ||
diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index e6aa8925..88512546 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # netdb_h.m4 serial 15 | 1 | # netdb_h.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_NETDB_H], | 9 | AC_DEFUN_ONCE([gl_NETDB_H], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index 71154191..b56e354c 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # netinet_in_h.m4 serial 6 | 1 | # netinet_in_h.m4 |
| 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
| 3 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_HEADER_NETINET_IN], | 9 | AC_DEFUN([gl_HEADER_NETINET_IN], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4 index 51e783ce..9b1e0f32 100644 --- a/gl/m4/nl_langinfo.m4 +++ b/gl/m4/nl_langinfo.m4 | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | # nl_langinfo.m4 serial 8 | 1 | # nl_langinfo.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12.1 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_NL_LANGINFO], | 9 | AC_DEFUN([gl_FUNC_NL_LANGINFO], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) |
| 10 | AC_REQUIRE([gl_LANGINFO_H]) | 12 | AC_REQUIRE([gl_LANGINFO_H]) |
| 11 | AC_CHECK_FUNCS_ONCE([nl_langinfo]) | 13 | gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]]) |
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 14 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 13 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) | 15 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) |
| 14 | AC_REQUIRE([gl_PTHREADLIB]) | 16 | AC_REQUIRE([gl_PTHREADLIB]) |
| @@ -39,16 +41,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
| 39 | AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], | 41 | AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], |
| 40 | [$FUNC_NL_LANGINFO_YESEXPR_WORKS], | 42 | [$FUNC_NL_LANGINFO_YESEXPR_WORKS], |
| 41 | [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) | 43 | [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) |
| 42 | # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. | 44 | # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not |
| 45 | # multithread-safe. | ||
| 43 | case "$host_os" in | 46 | case "$host_os" in |
| 44 | solaris*) NL_LANGINFO_MTSAFE=0 ;; | 47 | darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;; |
| 45 | *) NL_LANGINFO_MTSAFE=1 ;; | 48 | *) NL_LANGINFO_MTSAFE=1 ;; |
| 46 | esac | 49 | esac |
| 47 | AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], | 50 | AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], |
| 48 | [Define to 1 if nl_langinfo is multithread-safe.]) | 51 | [Define to 1 if nl_langinfo is multithread-safe.]) |
| 49 | if test $HAVE_LANGINFO_CODESET = 1 \ | 52 | if test $HAVE_LANGINFO_CODESET = 1 \ |
| 50 | && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ | 53 | && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ |
| 51 | && test $HAVE_LANGINFO_ALTMON = 1 \ | 54 | && test $HAVE_LANGINFO_ALTMON = 1 \ |
| 55 | && test $HAVE_LANGINFO_ABALTMON = 1 \ | ||
| 52 | && test $HAVE_LANGINFO_ERA = 1 \ | 56 | && test $HAVE_LANGINFO_ERA = 1 \ |
| 53 | && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ | 57 | && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ |
| 54 | && test $NL_LANGINFO_MTSAFE = 1; then | 58 | && test $NL_LANGINFO_MTSAFE = 1; then |
| @@ -60,9 +64,12 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
| 60 | fi | 64 | fi |
| 61 | else | 65 | else |
| 62 | HAVE_NL_LANGINFO=0 | 66 | HAVE_NL_LANGINFO=0 |
| 67 | case "$gl_cv_onwards_func_nl_langinfo" in | ||
| 68 | future*) REPLACE_NL_LANGINFO=1 ;; | ||
| 69 | esac | ||
| 63 | fi | 70 | fi |
| 64 | if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then | 71 | if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then |
| 65 | LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" | 72 | LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB" |
| 66 | else | 73 | else |
| 67 | LIB_NL_LANGINFO= | 74 | LIB_NL_LANGINFO= |
| 68 | fi | 75 | fi |
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4 index 6a766387..662fb049 100644 --- a/gl/m4/nocrash.m4 +++ b/gl/m4/nocrash.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # nocrash.m4 serial 5 | 1 | # nocrash.m4 |
| 2 | dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. | 9 | dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. |
| 8 | 10 | ||
diff --git a/gl/m4/off64_t.m4 b/gl/m4/off64_t.m4 new file mode 100644 index 00000000..963d53e9 --- /dev/null +++ b/gl/m4/off64_t.m4 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | # off64_t.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2024-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 | dnl Check whether <sys/types.h> defines the 'off64_t' type. | ||
| 10 | dnl Set HAVE_OFF64_T. | ||
| 11 | |||
| 12 | AC_DEFUN([gl_TYPE_OFF64_T], | ||
| 13 | [ | ||
| 14 | dnl Persuade glibc <sys/types.h>, <stdio.h>, <fcntl.h>, <unistd.h>, <aio.h> | ||
| 15 | dnl to define off64_t. | ||
| 16 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 17 | |||
| 18 | AC_CACHE_CHECK([for off64_t], [gl_cv_off64_t], | ||
| 19 | [AC_COMPILE_IFELSE( | ||
| 20 | [AC_LANG_PROGRAM( | ||
| 21 | [[#include <sys/types.h>]], | ||
| 22 | [[int x = sizeof (off64_t *) + sizeof (off64_t); | ||
| 23 | return !x;]])], | ||
| 24 | [gl_cv_off64_t=yes], [gl_cv_off64_t=no])]) | ||
| 25 | |||
| 26 | if test $gl_cv_off64_t != no; then | ||
| 27 | HAVE_OFF64_T=1 | ||
| 28 | else | ||
| 29 | HAVE_OFF64_T=0 | ||
| 30 | fi | ||
| 31 | AC_SUBST([HAVE_OFF64_T]) | ||
| 32 | ]) | ||
diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4 index 880f3472..f4f4bbf6 100644 --- a/gl/m4/off_t.m4 +++ b/gl/m4/off_t.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # off_t.m4 serial 1 | 1 | # off_t.m4 |
| 2 | dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Check whether to override the 'off_t' type. | 9 | dnl Check whether to override the 'off_t' type. |
| 8 | dnl Set WINDOWS_64_BIT_OFF_T. | 10 | dnl Set WINDOWS_64_BIT_OFF_T. |
diff --git a/gl/m4/once.m4 b/gl/m4/once.m4 new file mode 100644 index 00000000..7876a8fe --- /dev/null +++ b/gl/m4/once.m4 | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | # once.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2024-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 | dnl From Bruno Haible. | ||
| 10 | |||
| 11 | AC_DEFUN([gl_ONCE], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([gl_THREADLIB]) | ||
| 14 | ]) | ||
diff --git a/gl/m4/open-cloexec.m4 b/gl/m4/open-cloexec.m4 index fd572fcd..860541b0 100644 --- a/gl/m4/open-cloexec.m4 +++ b/gl/m4/open-cloexec.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | # Test whether O_CLOEXEC is defined. | 1 | # open-cloexec.m4 |
| 2 | 2 | # serial 1 | |
| 3 | dnl Copyright 2017-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2017-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | # Test whether O_CLOEXEC is defined. | ||
| 7 | 10 | ||
| 8 | AC_DEFUN([gl_PREPROC_O_CLOEXEC], | 11 | AC_DEFUN([gl_PREPROC_O_CLOEXEC], |
| 9 | [ | 12 | [ |
diff --git a/gl/m4/open-slash.m4 b/gl/m4/open-slash.m4 index 1f731f8a..2cba48fe 100644 --- a/gl/m4/open-slash.m4 +++ b/gl/m4/open-slash.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # open-slash.m4 serial 2 | 1 | # open-slash.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 2 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Tests whether open() and creat() recognize a trailing slash. | 9 | dnl Tests whether open() and creat() recognize a trailing slash. |
| 8 | dnl Sets gl_cv_func_open_slash. | 10 | dnl Sets gl_cv_func_open_slash. |
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 index 94fa2bb7..dd3a805f 100644 --- a/gl/m4/open.m4 +++ b/gl/m4/open.m4 | |||
| @@ -1,15 +1,20 @@ | |||
| 1 | # open.m4 serial 15 | 1 | # open.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 17 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_OPEN], | 9 | AC_DEFUN([gl_FUNC_OPEN], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([AC_CANONICAL_HOST]) | 11 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 10 | AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) | 12 | AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) |
| 13 | AC_REQUIRE([gl_FCNTL_O_FLAGS]) | ||
| 14 | AS_CASE([$gl_cv_header_working_fcntl_h], | ||
| 15 | [*O_DIRECTORY* | *no], [REPLACE_OPEN=1]) | ||
| 11 | case "$host_os" in | 16 | case "$host_os" in |
| 12 | mingw* | pw*) | 17 | mingw* | windows* | pw*) |
| 13 | REPLACE_OPEN=1 | 18 | REPLACE_OPEN=1 |
| 14 | ;; | 19 | ;; |
| 15 | *) | 20 | *) |
diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4 index 6d47d2c0..0c3925df 100644 --- a/gl/m4/pathmax.m4 +++ b/gl/m4/pathmax.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # pathmax.m4 serial 11 | 1 | # pathmax.m4 |
| 2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2023 Free Software Foundation, | 2 | # serial 11 |
| 3 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | AC_DEFUN([gl_PATHMAX], | 10 | AC_DEFUN([gl_PATHMAX], |
| 9 | [ | 11 | [ |
diff --git a/gl/m4/pid_t.m4 b/gl/m4/pid_t.m4 index 0fd7d0a1..a8bdabc2 100644 --- a/gl/m4/pid_t.m4 +++ b/gl/m4/pid_t.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # pid_t.m4 serial 4 | 1 | # pid_t.m4 |
| 2 | dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
| 3 | dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # The following implementation works around a problem in autoconf <= 2.69. | 9 | # The following implementation works around a problem in autoconf <= 2.69. |
| 8 | m4_version_prereq([2.70], [], [ | 10 | m4_version_prereq([2.70], [], [ |
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 4e65abc6..4619a402 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # printf.m4 serial 73 | 1 | # printf.m4 |
| 2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 96 |
| 3 | dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Test whether the *printf family of functions supports the 'j', 'z', 't', | 9 | dnl Test whether the *printf family of functions supports the 'j', 'z', 't', |
| 8 | dnl 'L' size specifiers. (ISO C99, POSIX:2001) | 10 | dnl 'L' size specifiers. (ISO C99, POSIX:2001) |
| @@ -63,7 +65,7 @@ changequote(,)dnl | |||
| 63 | # Guess yes on glibc systems. | 65 | # Guess yes on glibc systems. |
| 64 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; | 66 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; |
| 65 | # Guess yes on musl systems. | 67 | # Guess yes on musl systems. |
| 66 | *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; | 68 | *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";; |
| 67 | # Guess yes on FreeBSD >= 5. | 69 | # Guess yes on FreeBSD >= 5. |
| 68 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; | 70 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; |
| 69 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | 71 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; |
| @@ -86,7 +88,8 @@ changequote(,)dnl | |||
| 86 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; | 88 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; |
| 87 | changequote([,])dnl | 89 | changequote([,])dnl |
| 88 | # Guess yes on MSVC, no on mingw. | 90 | # Guess yes on MSVC, no on mingw. |
| 89 | mingw*) AC_EGREP_CPP([Known], [ | 91 | windows*-msvc*) gl_cv_func_printf_sizes_c99="guessing yes" ;; |
| 92 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
| 90 | #ifdef _MSC_VER | 93 | #ifdef _MSC_VER |
| 91 | Known | 94 | Known |
| 92 | #endif | 95 | #endif |
| @@ -101,6 +104,92 @@ changequote([,])dnl | |||
| 101 | ]) | 104 | ]) |
| 102 | ]) | 105 | ]) |
| 103 | 106 | ||
| 107 | dnl Test whether the *printf family of functions supports the 'w8', 'w16', | ||
| 108 | dnl 'w32', 'w64', 'wf8', 'wf16', 'wf32', 'wf64' size specifiers. (ISO C23) | ||
| 109 | dnl Result is gl_cv_func_printf_sizes_c23. | ||
| 110 | |||
| 111 | AC_DEFUN([gl_PRINTF_SIZES_C23], | ||
| 112 | [ | ||
| 113 | AC_REQUIRE([AC_PROG_CC]) | ||
| 114 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
| 115 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
| 116 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 117 | AC_CACHE_CHECK([whether printf supports size specifiers as in C23], | ||
| 118 | [gl_cv_func_printf_sizes_c23], | ||
| 119 | [ | ||
| 120 | AC_RUN_IFELSE( | ||
| 121 | [AC_LANG_SOURCE([[ | ||
| 122 | #include <stddef.h> | ||
| 123 | #include <stdio.h> | ||
| 124 | #include <string.h> | ||
| 125 | #include <sys/types.h> | ||
| 126 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
| 127 | # include <stdint.h> | ||
| 128 | #endif | ||
| 129 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 130 | # include <inttypes.h> | ||
| 131 | #endif | ||
| 132 | static char buf[100]; | ||
| 133 | int main () | ||
| 134 | { | ||
| 135 | int result = 0; | ||
| 136 | buf[0] = '\0'; | ||
| 137 | if (sprintf (buf, "%w8u %d", (uint8_t) 123, 33, 44, 55) < 0 | ||
| 138 | || strcmp (buf, "123 33") != 0) | ||
| 139 | result |= 1; | ||
| 140 | buf[0] = '\0'; | ||
| 141 | if (sprintf (buf, "%wf8u %d", (uint_fast8_t) 123, 33, 44, 55) < 0 | ||
| 142 | || strcmp (buf, "123 33") != 0) | ||
| 143 | result |= 1; | ||
| 144 | buf[0] = '\0'; | ||
| 145 | if (sprintf (buf, "%w16u %d", (uint16_t) 12345, 33, 44, 55) < 0 | ||
| 146 | || strcmp (buf, "12345 33") != 0) | ||
| 147 | result |= 2; | ||
| 148 | buf[0] = '\0'; | ||
| 149 | if (sprintf (buf, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55) < 0 | ||
| 150 | || strcmp (buf, "12345 33") != 0) | ||
| 151 | result |= 2; | ||
| 152 | buf[0] = '\0'; | ||
| 153 | if (sprintf (buf, "%w32u %d", (uint32_t) 12345671, 33, 44, 55) < 0 | ||
| 154 | || strcmp (buf, "12345671 33") != 0) | ||
| 155 | result |= 4; | ||
| 156 | buf[0] = '\0'; | ||
| 157 | if (sprintf (buf, "%wf32u %d", (uint_fast32_t) 12345671, 33, 44, 55) < 0 | ||
| 158 | || strcmp (buf, "12345671 33") != 0) | ||
| 159 | result |= 4; | ||
| 160 | #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 161 | buf[0] = '\0'; | ||
| 162 | if (sprintf (buf, "%w64u %d", (uint64_t) 12345671, 33, 44, 55) < 0 | ||
| 163 | || strcmp (buf, "12345671 33") != 0) | ||
| 164 | result |= 8; | ||
| 165 | buf[0] = '\0'; | ||
| 166 | if (sprintf (buf, "%wf64u %d", (uint_fast64_t) 12345671, 33, 44, 55) < 0 | ||
| 167 | || strcmp (buf, "12345671 33") != 0) | ||
| 168 | result |= 8; | ||
| 169 | #else | ||
| 170 | result |= 8; | ||
| 171 | #endif | ||
| 172 | return result; | ||
| 173 | }]])], | ||
| 174 | [gl_cv_func_printf_sizes_c23=yes], | ||
| 175 | [gl_cv_func_printf_sizes_c23=no], | ||
| 176 | [ | ||
| 177 | case "$host_os" in | ||
| 178 | # Guess no on glibc systems. | ||
| 179 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 180 | # Guess no on musl systems. | ||
| 181 | *-musl* | midipix*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 182 | # Guess no on Android. | ||
| 183 | linux*-android*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 184 | # Guess no on native Windows. | ||
| 185 | mingw* | windows*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 186 | # If we don't know, obey --enable-cross-guesses. | ||
| 187 | *) gl_cv_func_printf_sizes_c23="$gl_cross_guess_normal";; | ||
| 188 | esac | ||
| 189 | ]) | ||
| 190 | ]) | ||
| 191 | ]) | ||
| 192 | |||
| 104 | dnl Test whether the *printf family of functions supports 'long double' | 193 | dnl Test whether the *printf family of functions supports 'long double' |
| 105 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) | 194 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) |
| 106 | dnl Result is gl_cv_func_printf_long_double. | 195 | dnl Result is gl_cv_func_printf_long_double. |
| @@ -137,20 +226,21 @@ int main () | |||
| 137 | [gl_cv_func_printf_long_double=yes], | 226 | [gl_cv_func_printf_long_double=yes], |
| 138 | [gl_cv_func_printf_long_double=no], | 227 | [gl_cv_func_printf_long_double=no], |
| 139 | [case "$host_os" in | 228 | [case "$host_os" in |
| 140 | # Guess no on BeOS. | 229 | # Guess no on BeOS. |
| 141 | beos*) gl_cv_func_printf_long_double="guessing no";; | 230 | beos*) gl_cv_func_printf_long_double="guessing no";; |
| 142 | # Guess yes on Android. | 231 | # Guess yes on Android. |
| 143 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; | 232 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; |
| 144 | # Guess yes on MSVC, no on mingw. | 233 | # Guess yes on MSVC, no on mingw. |
| 145 | mingw*) AC_EGREP_CPP([Known], [ | 234 | windows*-msvc*) gl_cv_func_printf_long_double="guessing yes" ;; |
| 235 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
| 146 | #ifdef _MSC_VER | 236 | #ifdef _MSC_VER |
| 147 | Known | 237 | Known |
| 148 | #endif | 238 | #endif |
| 149 | ], | 239 | ], |
| 150 | [gl_cv_func_printf_long_double="guessing yes"], | 240 | [gl_cv_func_printf_long_double="guessing yes"], |
| 151 | [gl_cv_func_printf_long_double="guessing no"]) | 241 | [gl_cv_func_printf_long_double="guessing no"]) |
| 152 | ;; | 242 | ;; |
| 153 | *) gl_cv_func_printf_long_double="guessing yes";; | 243 | *) gl_cv_func_printf_long_double="guessing yes";; |
| 154 | esac | 244 | esac |
| 155 | ]) | 245 | ]) |
| 156 | ]) | 246 | ]) |
| @@ -244,7 +334,7 @@ changequote(,)dnl | |||
| 244 | # Guess yes on glibc systems. | 334 | # Guess yes on glibc systems. |
| 245 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; | 335 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; |
| 246 | # Guess yes on musl systems. | 336 | # Guess yes on musl systems. |
| 247 | *-musl*) gl_cv_func_printf_infinite="guessing yes";; | 337 | *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";; |
| 248 | # Guess yes on FreeBSD >= 6. | 338 | # Guess yes on FreeBSD >= 6. |
| 249 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; | 339 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; |
| 250 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; | 340 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; |
| @@ -268,7 +358,8 @@ changequote(,)dnl | |||
| 268 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; | 358 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; |
| 269 | changequote([,])dnl | 359 | changequote([,])dnl |
| 270 | # Guess yes on MSVC, no on mingw. | 360 | # Guess yes on MSVC, no on mingw. |
| 271 | mingw*) AC_EGREP_CPP([Known], [ | 361 | windows*-msvc*) gl_cv_func_printf_infinite="guessing yes" ;; |
| 362 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
| 272 | #ifdef _MSC_VER | 363 | #ifdef _MSC_VER |
| 273 | Known | 364 | Known |
| 274 | #endif | 365 | #endif |
| @@ -467,7 +558,7 @@ changequote(,)dnl | |||
| 467 | # Guess yes on glibc systems. | 558 | # Guess yes on glibc systems. |
| 468 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 559 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
| 469 | # Guess yes on musl systems. | 560 | # Guess yes on musl systems. |
| 470 | *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 561 | *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
| 471 | # Guess yes on FreeBSD >= 6. | 562 | # Guess yes on FreeBSD >= 6. |
| 472 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; | 563 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; |
| 473 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 564 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
| @@ -482,7 +573,8 @@ changequote(,)dnl | |||
| 482 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; | 573 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; |
| 483 | changequote([,])dnl | 574 | changequote([,])dnl |
| 484 | # Guess yes on MSVC, no on mingw. | 575 | # Guess yes on MSVC, no on mingw. |
| 485 | mingw*) AC_EGREP_CPP([Known], [ | 576 | windows*-msvc*) gl_cv_func_printf_infinite_long_double="guessing yes" ;; |
| 577 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
| 486 | #ifdef _MSC_VER | 578 | #ifdef _MSC_VER |
| 487 | Known | 579 | Known |
| 488 | #endif | 580 | #endif |
| @@ -525,6 +617,7 @@ static double zero = 0.0; | |||
| 525 | int main () | 617 | int main () |
| 526 | { | 618 | { |
| 527 | int result = 0; | 619 | int result = 0; |
| 620 | /* This fails on FreeBSD 5.2.1, Solaris 11.4. */ | ||
| 528 | if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 | 621 | if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 |
| 529 | || (strcmp (buf, "0x1.922p+1 33") != 0 | 622 | || (strcmp (buf, "0x1.922p+1 33") != 0 |
| 530 | && strcmp (buf, "0x3.244p+0 33") != 0 | 623 | && strcmp (buf, "0x3.244p+0 33") != 0 |
| @@ -536,27 +629,29 @@ int main () | |||
| 536 | && strcmp (buf, "-0X3.244P+0 33") != 0 | 629 | && strcmp (buf, "-0X3.244P+0 33") != 0 |
| 537 | && strcmp (buf, "-0X6.488P-1 33") != 0 | 630 | && strcmp (buf, "-0X6.488P-1 33") != 0 |
| 538 | && strcmp (buf, "-0XC.91P-2 33") != 0)) | 631 | && strcmp (buf, "-0XC.91P-2 33") != 0)) |
| 539 | result |= 2; | 632 | result |= 1; |
| 540 | /* This catches a FreeBSD 13.0 bug: it doesn't round. */ | 633 | /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug: |
| 634 | it doesn't round. */ | ||
| 541 | if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 | 635 | if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 |
| 542 | || (strcmp (buf, "0x1.83p+0 33") != 0 | 636 | || (strcmp (buf, "0x1.83p+0 33") != 0 |
| 543 | && strcmp (buf, "0x3.05p-1 33") != 0 | 637 | && strcmp (buf, "0x3.05p-1 33") != 0 |
| 544 | && strcmp (buf, "0x6.0ap-2 33") != 0 | 638 | && strcmp (buf, "0x6.0ap-2 33") != 0 |
| 545 | && strcmp (buf, "0xc.14p-3 33") != 0)) | 639 | && strcmp (buf, "0xc.14p-3 33") != 0)) |
| 546 | result |= 4; | 640 | result |= 2; |
| 547 | /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ | 641 | /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3, |
| 642 | Solaris 11.4 bug: it doesn't round. */ | ||
| 548 | if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 | 643 | if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 |
| 549 | || (strcmp (buf, "0x2p+0 33") != 0 | 644 | || (strcmp (buf, "0x2p+0 33") != 0 |
| 550 | && strcmp (buf, "0x3p-1 33") != 0 | 645 | && strcmp (buf, "0x3p-1 33") != 0 |
| 551 | && strcmp (buf, "0x6p-2 33") != 0 | 646 | && strcmp (buf, "0x6p-2 33") != 0 |
| 552 | && strcmp (buf, "0xcp-3 33") != 0)) | 647 | && strcmp (buf, "0xcp-3 33") != 0)) |
| 553 | result |= 4; | 648 | result |= 4; |
| 554 | /* This catches a FreeBSD 6.1 bug. See | 649 | /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See |
| 555 | <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ | 650 | <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ |
| 556 | if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 | 651 | if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 |
| 557 | || buf[0] == '0') | 652 | || buf[0] == '0') |
| 558 | result |= 8; | 653 | result |= 8; |
| 559 | /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ | 654 | /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */ |
| 560 | if (sprintf (buf, "%.1a", 1.999) < 0 | 655 | if (sprintf (buf, "%.1a", 1.999) < 0 |
| 561 | || (strcmp (buf, "0x1.0p+1") != 0 | 656 | || (strcmp (buf, "0x1.0p+1") != 0 |
| 562 | && strcmp (buf, "0x2.0p+0") != 0 | 657 | && strcmp (buf, "0x2.0p+0") != 0 |
| @@ -564,7 +659,8 @@ int main () | |||
| 564 | && strcmp (buf, "0x8.0p-2") != 0)) | 659 | && strcmp (buf, "0x8.0p-2") != 0)) |
| 565 | result |= 16; | 660 | result |= 16; |
| 566 | /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a | 661 | /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a |
| 567 | glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ | 662 | glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908> |
| 663 | and a FreeBSD 6.4, NetBSD 10.0 bug. */ | ||
| 568 | if (sprintf (buf, "%.1La", 1.999L) < 0 | 664 | if (sprintf (buf, "%.1La", 1.999L) < 0 |
| 569 | || (strcmp (buf, "0x1.0p+1") != 0 | 665 | || (strcmp (buf, "0x1.0p+1") != 0 |
| 570 | && strcmp (buf, "0x2.0p+0") != 0 | 666 | && strcmp (buf, "0x2.0p+0") != 0 |
| @@ -591,11 +687,11 @@ int main () | |||
| 591 | [gl_cv_func_printf_directive_a="guessing no"]) | 687 | [gl_cv_func_printf_directive_a="guessing no"]) |
| 592 | ;; | 688 | ;; |
| 593 | # Guess yes on musl systems. | 689 | # Guess yes on musl systems. |
| 594 | *-musl*) gl_cv_func_printf_directive_a="guessing yes";; | 690 | *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";; |
| 595 | # Guess no on Android. | 691 | # Guess no on Android. |
| 596 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; | 692 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; |
| 597 | # Guess no on native Windows. | 693 | # Guess no on native Windows. |
| 598 | mingw*) gl_cv_func_printf_directive_a="guessing no";; | 694 | mingw* | windows*) gl_cv_func_printf_directive_a="guessing no";; |
| 599 | # If we don't know, obey --enable-cross-guesses. | 695 | # If we don't know, obey --enable-cross-guesses. |
| 600 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; | 696 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; |
| 601 | esac | 697 | esac |
| @@ -603,6 +699,116 @@ int main () | |||
| 603 | ]) | 699 | ]) |
| 604 | ]) | 700 | ]) |
| 605 | 701 | ||
| 702 | dnl Test whether the *printf family of functions supports the 'b' conversion | ||
| 703 | dnl specifier for binary output of integers. | ||
| 704 | dnl (ISO C23) | ||
| 705 | dnl Result is gl_cv_func_printf_directive_b. | ||
| 706 | |||
| 707 | AC_DEFUN([gl_PRINTF_DIRECTIVE_B], | ||
| 708 | [ | ||
| 709 | AC_REQUIRE([AC_PROG_CC]) | ||
| 710 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 711 | AC_CACHE_CHECK([whether printf supports the 'b' directive], | ||
| 712 | [gl_cv_func_printf_directive_b], | ||
| 713 | [ | ||
| 714 | AC_RUN_IFELSE( | ||
| 715 | [AC_LANG_SOURCE([[ | ||
| 716 | #include <stdio.h> | ||
| 717 | #include <string.h> | ||
| 718 | static char buf[100]; | ||
| 719 | int main () | ||
| 720 | { | ||
| 721 | int result = 0; | ||
| 722 | if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0 | ||
| 723 | || strcmp (buf, "11000000111001 33") != 0) | ||
| 724 | result |= 1; | ||
| 725 | return result; | ||
| 726 | }]])], | ||
| 727 | [gl_cv_func_printf_directive_b=yes], | ||
| 728 | [gl_cv_func_printf_directive_b=no], | ||
| 729 | [ | ||
| 730 | case "$host_os" in | ||
| 731 | # Guess yes on glibc >= 2.35 systems. | ||
| 732 | *-gnu* | gnu*) | ||
| 733 | AC_EGREP_CPP([Lucky], [ | ||
| 734 | #include <features.h> | ||
| 735 | #ifdef __GNU_LIBRARY__ | ||
| 736 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
| 737 | Lucky user | ||
| 738 | #endif | ||
| 739 | #endif | ||
| 740 | ], | ||
| 741 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
| 742 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
| 743 | ;; | ||
| 744 | # Guess no on musl systems. | ||
| 745 | *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";; | ||
| 746 | # Guess no on Android. | ||
| 747 | linux*-android*) gl_cv_func_printf_directive_b="guessing no";; | ||
| 748 | # Guess no on native Windows. | ||
| 749 | mingw* | windows*) gl_cv_func_printf_directive_b="guessing no";; | ||
| 750 | # If we don't know, obey --enable-cross-guesses. | ||
| 751 | *) gl_cv_func_printf_directive_b="$gl_cross_guess_normal";; | ||
| 752 | esac | ||
| 753 | ]) | ||
| 754 | ]) | ||
| 755 | ]) | ||
| 756 | |||
| 757 | dnl Test whether the *printf family of functions supports the 'B' conversion | ||
| 758 | dnl specifier for binary output of integers. | ||
| 759 | dnl (GNU, encouraged by ISO C23 § 7.23.6.1) | ||
| 760 | dnl Result is gl_cv_func_printf_directive_uppercase_b. | ||
| 761 | |||
| 762 | AC_DEFUN([gl_PRINTF_DIRECTIVE_UPPERCASE_B], | ||
| 763 | [ | ||
| 764 | AC_REQUIRE([AC_PROG_CC]) | ||
| 765 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 766 | AC_CACHE_CHECK([whether printf supports the 'B' directive], | ||
| 767 | [gl_cv_func_printf_directive_uppercase_b], | ||
| 768 | [ | ||
| 769 | AC_RUN_IFELSE( | ||
| 770 | [AC_LANG_SOURCE([[ | ||
| 771 | #include <stdio.h> | ||
| 772 | #include <string.h> | ||
| 773 | static char buf[100]; | ||
| 774 | int main () | ||
| 775 | { | ||
| 776 | int result = 0; | ||
| 777 | if (sprintf (buf, "%#B %d", 12345, 33, 44, 55) < 0 | ||
| 778 | || strcmp (buf, "0B11000000111001 33") != 0) | ||
| 779 | result |= 1; | ||
| 780 | return result; | ||
| 781 | }]])], | ||
| 782 | [gl_cv_func_printf_directive_uppercase_b=yes], | ||
| 783 | [gl_cv_func_printf_directive_uppercase_b=no], | ||
| 784 | [ | ||
| 785 | case "$host_os" in | ||
| 786 | # Guess yes on glibc >= 2.35 systems. | ||
| 787 | *-gnu* | gnu*) | ||
| 788 | AC_EGREP_CPP([Lucky], [ | ||
| 789 | #include <features.h> | ||
| 790 | #ifdef __GNU_LIBRARY__ | ||
| 791 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
| 792 | Lucky user | ||
| 793 | #endif | ||
| 794 | #endif | ||
| 795 | ], | ||
| 796 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
| 797 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
| 798 | ;; | ||
| 799 | # Guess no on musl systems. | ||
| 800 | *-musl* | midipix*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
| 801 | # Guess no on Android. | ||
| 802 | linux*-android*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
| 803 | # Guess no on native Windows. | ||
| 804 | mingw* | windows*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
| 805 | # If we don't know, obey --enable-cross-guesses. | ||
| 806 | *) gl_cv_func_printf_directive_uppercase_b="$gl_cross_guess_normal";; | ||
| 807 | esac | ||
| 808 | ]) | ||
| 809 | ]) | ||
| 810 | ]) | ||
| 811 | |||
| 606 | dnl Test whether the *printf family of functions supports the %F format | 812 | dnl Test whether the *printf family of functions supports the %F format |
| 607 | dnl directive. (ISO C99, POSIX:2001) | 813 | dnl directive. (ISO C99, POSIX:2001) |
| 608 | dnl Result is gl_cv_func_printf_directive_f. | 814 | dnl Result is gl_cv_func_printf_directive_f. |
| @@ -643,7 +849,7 @@ changequote(,)dnl | |||
| 643 | # Guess yes on glibc systems. | 849 | # Guess yes on glibc systems. |
| 644 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; | 850 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; |
| 645 | # Guess yes on musl systems. | 851 | # Guess yes on musl systems. |
| 646 | *-musl*) gl_cv_func_printf_directive_f="guessing yes";; | 852 | *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";; |
| 647 | # Guess yes on FreeBSD >= 6. | 853 | # Guess yes on FreeBSD >= 6. |
| 648 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; | 854 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; |
| 649 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; | 855 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; |
| @@ -661,7 +867,8 @@ changequote(,)dnl | |||
| 661 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; | 867 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; |
| 662 | changequote([,])dnl | 868 | changequote([,])dnl |
| 663 | # Guess yes on MSVC, no on mingw. | 869 | # Guess yes on MSVC, no on mingw. |
| 664 | mingw*) AC_EGREP_CPP([Known], [ | 870 | windows*-msvc*) gl_cv_func_printf_directive_f="guessing yes" ;; |
| 871 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
| 665 | #ifdef _MSC_VER | 872 | #ifdef _MSC_VER |
| 666 | Known | 873 | Known |
| 667 | #endif | 874 | #endif |
| @@ -689,10 +896,16 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], | |||
| 689 | [ | 896 | [ |
| 690 | AC_RUN_IFELSE( | 897 | AC_RUN_IFELSE( |
| 691 | [AC_LANG_SOURCE([[ | 898 | [AC_LANG_SOURCE([[ |
| 899 | #include <signal.h> | ||
| 692 | #include <stdio.h> | 900 | #include <stdio.h> |
| 693 | #include <stdlib.h> | ||
| 694 | #include <string.h> | 901 | #include <string.h> |
| 902 | #if defined _WIN32 && !defined __CYGWIN__ | ||
| 903 | # include <stdlib.h> | ||
| 904 | #else | ||
| 905 | # include <unistd.h> | ||
| 906 | #endif | ||
| 695 | #ifdef _MSC_VER | 907 | #ifdef _MSC_VER |
| 908 | #include <crtdbg.h> | ||
| 696 | #include <inttypes.h> | 909 | #include <inttypes.h> |
| 697 | /* See page about "Parameter Validation" on msdn.microsoft.com. | 910 | /* See page about "Parameter Validation" on msdn.microsoft.com. |
| 698 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> | 911 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> |
| @@ -706,6 +919,12 @@ invalid_parameter_handler (const wchar_t *expression, | |||
| 706 | exit (1); | 919 | exit (1); |
| 707 | } | 920 | } |
| 708 | #endif | 921 | #endif |
| 922 | static void | ||
| 923 | abort_handler (int sig) | ||
| 924 | { | ||
| 925 | (void) sig; | ||
| 926 | _exit (1); | ||
| 927 | } | ||
| 709 | static char fmtstring[10]; | 928 | static char fmtstring[10]; |
| 710 | static char buf[100]; | 929 | static char buf[100]; |
| 711 | int main () | 930 | int main () |
| @@ -713,7 +932,11 @@ int main () | |||
| 713 | int count = -1; | 932 | int count = -1; |
| 714 | #ifdef _MSC_VER | 933 | #ifdef _MSC_VER |
| 715 | _set_invalid_parameter_handler (invalid_parameter_handler); | 934 | _set_invalid_parameter_handler (invalid_parameter_handler); |
| 935 | /* Also avoid an Abort/Retry/Ignore dialog in debug builds. | ||
| 936 | <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode> */ | ||
| 937 | _CrtSetReportMode (_CRT_ASSERT, 0); | ||
| 716 | #endif | 938 | #endif |
| 939 | signal (SIGABRT, abort_handler); | ||
| 717 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | 940 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) |
| 718 | support %n in format strings in read-only memory but not in writable | 941 | support %n in format strings in read-only memory but not in writable |
| 719 | memory. */ | 942 | memory. */ |
| @@ -727,21 +950,21 @@ int main () | |||
| 727 | [gl_cv_func_printf_directive_n=yes], | 950 | [gl_cv_func_printf_directive_n=yes], |
| 728 | [gl_cv_func_printf_directive_n=no], | 951 | [gl_cv_func_printf_directive_n=no], |
| 729 | [case "$host_os" in | 952 | [case "$host_os" in |
| 730 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. | 953 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. |
| 731 | *-gnu* | gnu*) AC_COMPILE_IFELSE( | 954 | *-gnu* | gnu*) AC_COMPILE_IFELSE( |
| 732 | [AC_LANG_SOURCE( | 955 | [AC_LANG_SOURCE( |
| 733 | [[#if _FORTIFY_SOURCE >= 2 | 956 | [[#if _FORTIFY_SOURCE >= 2 |
| 734 | error fail | 957 | error fail |
| 735 | #endif | 958 | #endif |
| 736 | ]])], | 959 | ]])], |
| 737 | [gl_cv_func_printf_directive_n="guessing yes"], | 960 | [gl_cv_func_printf_directive_n="guessing yes"], |
| 738 | [gl_cv_func_printf_directive_n="guessing no"]) | 961 | [gl_cv_func_printf_directive_n="guessing no"]) |
| 739 | ;; | 962 | ;; |
| 740 | # Guess no on Android. | 963 | # Guess no on Android. |
| 741 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; | 964 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; |
| 742 | # Guess no on native Windows. | 965 | # Guess no on native Windows. |
| 743 | mingw*) gl_cv_func_printf_directive_n="guessing no";; | 966 | mingw* | windows*) gl_cv_func_printf_directive_n="guessing no";; |
| 744 | *) gl_cv_func_printf_directive_n="guessing yes";; | 967 | *) gl_cv_func_printf_directive_n="guessing yes";; |
| 745 | esac | 968 | esac |
| 746 | ]) | 969 | ]) |
| 747 | ]) | 970 | ]) |
| @@ -811,18 +1034,64 @@ int main () | |||
| 811 | [ | 1034 | [ |
| 812 | changequote(,)dnl | 1035 | changequote(,)dnl |
| 813 | case "$host_os" in | 1036 | case "$host_os" in |
| 814 | # Guess yes on OpenBSD >= 6.0. | 1037 | # Guess yes on OpenBSD >= 6.0. |
| 815 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; | 1038 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; |
| 816 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; | 1039 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; |
| 817 | irix*) gl_cv_func_printf_directive_ls="guessing no";; | 1040 | irix*) gl_cv_func_printf_directive_ls="guessing no";; |
| 818 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; | 1041 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; |
| 819 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; | 1042 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; |
| 820 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; | 1043 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; |
| 821 | # Guess no on Android. | 1044 | # Guess no on Android. |
| 822 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; | 1045 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; |
| 823 | # Guess yes on native Windows. | 1046 | # Guess yes on native Windows. |
| 824 | mingw*) gl_cv_func_printf_directive_ls="guessing yes";; | 1047 | mingw* | windows*) gl_cv_func_printf_directive_ls="guessing yes";; |
| 825 | *) gl_cv_func_printf_directive_ls="guessing yes";; | 1048 | *) gl_cv_func_printf_directive_ls="guessing yes";; |
| 1049 | esac | ||
| 1050 | changequote([,])dnl | ||
| 1051 | ]) | ||
| 1052 | ]) | ||
| 1053 | ]) | ||
| 1054 | |||
| 1055 | dnl Test whether the *printf family of functions supports the %lc format | ||
| 1056 | dnl directive and in particular, when the argument is a null wide character, | ||
| 1057 | dnl whether the functions produce a NUL byte, as specified in ISO C 23 | ||
| 1058 | dnl after the issue GB-141 was fixed. | ||
| 1059 | dnl Result is gl_cv_func_printf_directive_lc. | ||
| 1060 | |||
| 1061 | AC_DEFUN([gl_PRINTF_DIRECTIVE_LC], | ||
| 1062 | [ | ||
| 1063 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1064 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1065 | AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly], | ||
| 1066 | [gl_cv_func_printf_directive_lc], | ||
| 1067 | [ | ||
| 1068 | AC_RUN_IFELSE( | ||
| 1069 | [AC_LANG_SOURCE([[ | ||
| 1070 | #include <stdio.h> | ||
| 1071 | #include <wchar.h> | ||
| 1072 | #include <string.h> | ||
| 1073 | int main () | ||
| 1074 | { | ||
| 1075 | int result = 0; | ||
| 1076 | char buf[100]; | ||
| 1077 | /* This test fails on musl libc 1.2.4. */ | ||
| 1078 | { | ||
| 1079 | buf[0] = '\0'; | ||
| 1080 | if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0 | ||
| 1081 | || memcmp (buf, "a\0z", 4) != 0) | ||
| 1082 | result |= 1; | ||
| 1083 | } | ||
| 1084 | return result; | ||
| 1085 | }]])], | ||
| 1086 | [gl_cv_func_printf_directive_lc=yes], | ||
| 1087 | [gl_cv_func_printf_directive_lc=no], | ||
| 1088 | [ | ||
| 1089 | changequote(,)dnl | ||
| 1090 | case "$host_os" in | ||
| 1091 | # Guess no on musl libc. | ||
| 1092 | *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing no";; | ||
| 1093 | # Guess yes otherwise. | ||
| 1094 | *) gl_cv_func_printf_directive_lc="guessing yes";; | ||
| 826 | esac | 1095 | esac |
| 827 | changequote([,])dnl | 1096 | changequote([,])dnl |
| 828 | ]) | 1097 | ]) |
| @@ -833,7 +1102,7 @@ dnl Test whether the *printf family of functions supports POSIX/XSI format | |||
| 833 | dnl strings with positions. (POSIX:2001) | 1102 | dnl strings with positions. (POSIX:2001) |
| 834 | dnl Result is gl_cv_func_printf_positions. | 1103 | dnl Result is gl_cv_func_printf_positions. |
| 835 | 1104 | ||
| 836 | AC_DEFUN([gl_PRINTF_POSITIONS], | 1105 | AC_DEFUN_ONCE([gl_PRINTF_POSITIONS], |
| 837 | [ | 1106 | [ |
| 838 | AC_REQUIRE([AC_PROG_CC]) | 1107 | AC_REQUIRE([AC_PROG_CC]) |
| 839 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 1108 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| @@ -859,13 +1128,17 @@ int main () | |||
| 859 | changequote(,)dnl | 1128 | changequote(,)dnl |
| 860 | case "$host_os" in | 1129 | case "$host_os" in |
| 861 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) | 1130 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) |
| 862 | gl_cv_func_printf_positions="guessing no";; | 1131 | gl_cv_func_printf_positions="guessing no";; |
| 863 | beos*) gl_cv_func_printf_positions="guessing no";; | 1132 | beos*) |
| 864 | # Guess yes on Android. | 1133 | gl_cv_func_printf_positions="guessing no";; |
| 865 | linux*-android*) gl_cv_func_printf_positions="guessing yes";; | 1134 | # Guess yes on Android. |
| 866 | # Guess no on native Windows. | 1135 | linux*-android*) |
| 867 | mingw* | pw*) gl_cv_func_printf_positions="guessing no";; | 1136 | gl_cv_func_printf_positions="guessing yes";; |
| 868 | *) gl_cv_func_printf_positions="guessing yes";; | 1137 | # Guess no on native Windows. |
| 1138 | mingw* | windows* | pw*) | ||
| 1139 | gl_cv_func_printf_positions="guessing no";; | ||
| 1140 | *) | ||
| 1141 | gl_cv_func_printf_positions="guessing yes";; | ||
| 869 | esac | 1142 | esac |
| 870 | changequote([,])dnl | 1143 | changequote([,])dnl |
| 871 | ]) | 1144 | ]) |
| @@ -900,19 +1173,125 @@ int main () | |||
| 900 | [ | 1173 | [ |
| 901 | changequote(,)dnl | 1174 | changequote(,)dnl |
| 902 | case "$host_os" in | 1175 | case "$host_os" in |
| 903 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; | 1176 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; |
| 904 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; | 1177 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; |
| 905 | # Guess no on Android. | 1178 | # Guess no on Android. |
| 906 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; | 1179 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; |
| 907 | # Guess no on native Windows. | 1180 | # Guess no on native Windows. |
| 908 | mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; | 1181 | mingw* | windows* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; |
| 909 | *) gl_cv_func_printf_flag_grouping="guessing yes";; | 1182 | *) gl_cv_func_printf_flag_grouping="guessing yes";; |
| 910 | esac | 1183 | esac |
| 911 | changequote([,])dnl | 1184 | changequote([,])dnl |
| 912 | ]) | 1185 | ]) |
| 913 | ]) | 1186 | ]) |
| 914 | ]) | 1187 | ]) |
| 915 | 1188 | ||
| 1189 | dnl Test whether the *printf family of functions supports POSIX/XSI format | ||
| 1190 | dnl strings with the ' flag for grouping of decimal digits on integers, | ||
| 1191 | dnl together with a precision. | ||
| 1192 | dnl Result is gl_cv_func_printf_flag_grouping_int_precision. | ||
| 1193 | |||
| 1194 | AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION], | ||
| 1195 | [ | ||
| 1196 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1197 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 1198 | AC_CACHE_CHECK([whether printf supports grouping on integers with a precision], | ||
| 1199 | [gl_cv_func_printf_flag_grouping_int_precision], | ||
| 1200 | [ | ||
| 1201 | dnl Prepare a guess, used when cross-compiling or when specific locales | ||
| 1202 | dnl are not available. | ||
| 1203 | case "$host_os" in | ||
| 1204 | # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku. | ||
| 1205 | freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*) | ||
| 1206 | gl_cv_func_printf_flag_grouping_int_precision="guessing no";; | ||
| 1207 | *) | ||
| 1208 | gl_cv_func_printf_flag_grouping_int_precision="guessing yes";; | ||
| 1209 | esac | ||
| 1210 | AC_RUN_IFELSE( | ||
| 1211 | [AC_LANG_SOURCE([[ | ||
| 1212 | #include <locale.h> | ||
| 1213 | #include <stdio.h> | ||
| 1214 | #include <string.h> | ||
| 1215 | static char buf[100]; | ||
| 1216 | int main () | ||
| 1217 | { | ||
| 1218 | if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL | ||
| 1219 | || setlocale (LC_ALL, "fr_FR") != NULL | ||
| 1220 | || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL | ||
| 1221 | || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) | ||
| 1222 | { | ||
| 1223 | if (sprintf (buf, "%'.10d", 1000) < 0) | ||
| 1224 | return 1; | ||
| 1225 | if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0) | ||
| 1226 | /* The sprintf implementation has produced fewer than 10 digits. */ | ||
| 1227 | return 2; | ||
| 1228 | else | ||
| 1229 | return 0; | ||
| 1230 | } | ||
| 1231 | return 3; | ||
| 1232 | }]])], | ||
| 1233 | [gl_cv_func_printf_flag_grouping_int_precision=yes], | ||
| 1234 | [if test $? = 2; then | ||
| 1235 | gl_cv_func_printf_flag_grouping_int_precision=no | ||
| 1236 | fi | ||
| 1237 | ], | ||
| 1238 | [:]) | ||
| 1239 | ]) | ||
| 1240 | ]) | ||
| 1241 | |||
| 1242 | dnl Test whether the *printf family of functions supports POSIX/XSI format | ||
| 1243 | dnl strings with the ' flag for grouping of decimal digits, when the thousands | ||
| 1244 | dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8 | ||
| 1245 | dnl locale). | ||
| 1246 | dnl Result is gl_cv_func_printf_flag_grouping_multibyte. | ||
| 1247 | |||
| 1248 | AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE], | ||
| 1249 | [ | ||
| 1250 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1251 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 1252 | AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator], | ||
| 1253 | [gl_cv_func_printf_flag_grouping_multibyte], | ||
| 1254 | [ | ||
| 1255 | dnl Prepare a guess, used when cross-compiling or when specific locales | ||
| 1256 | dnl are not available. | ||
| 1257 | case "$host_os" in | ||
| 1258 | # Guess no on NetBSD and Solaris 11 OpenIndiana. | ||
| 1259 | netbsd* | solaris*) | ||
| 1260 | gl_cv_func_printf_flag_grouping_multibyte="guessing no";; | ||
| 1261 | *) | ||
| 1262 | gl_cv_func_printf_flag_grouping_multibyte="guessing yes";; | ||
| 1263 | esac | ||
| 1264 | AC_RUN_IFELSE( | ||
| 1265 | [AC_LANG_SOURCE([[ | ||
| 1266 | #include <locale.h> | ||
| 1267 | #include <stdio.h> | ||
| 1268 | #include <string.h> | ||
| 1269 | static char buf[100]; | ||
| 1270 | int main () | ||
| 1271 | { | ||
| 1272 | if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) | ||
| 1273 | return 0; | ||
| 1274 | if (sprintf (buf, "%'.0f", 1000.0) < 0) | ||
| 1275 | return 1; | ||
| 1276 | if (strlen (localeconv ()->thousands_sep) > 1) | ||
| 1277 | { | ||
| 1278 | if (strlen (buf) <= 4 + 1) | ||
| 1279 | return 2; | ||
| 1280 | else | ||
| 1281 | return 3; | ||
| 1282 | } | ||
| 1283 | return 0; | ||
| 1284 | }]])], | ||
| 1285 | [:], | ||
| 1286 | [case $? in | ||
| 1287 | 2) gl_cv_func_printf_flag_grouping_multibyte=no ;; | ||
| 1288 | 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;; | ||
| 1289 | esac | ||
| 1290 | ], | ||
| 1291 | [:]) | ||
| 1292 | ]) | ||
| 1293 | ]) | ||
| 1294 | |||
| 916 | dnl Test whether the *printf family of functions supports the - flag correctly. | 1295 | dnl Test whether the *printf family of functions supports the - flag correctly. |
| 917 | dnl (ISO C99.) See | 1296 | dnl (ISO C99.) See |
| 918 | dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> | 1297 | dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> |
| @@ -943,16 +1322,16 @@ int main () | |||
| 943 | [ | 1322 | [ |
| 944 | changequote(,)dnl | 1323 | changequote(,)dnl |
| 945 | case "$host_os" in | 1324 | case "$host_os" in |
| 946 | # Guess yes on HP-UX 11. | 1325 | # Guess yes on HP-UX 11. |
| 947 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1326 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
| 948 | # Guess no on HP-UX 10 and older. | 1327 | # Guess no on HP-UX 10 and older. |
| 949 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; | 1328 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; |
| 950 | # Guess yes on Android. | 1329 | # Guess yes on Android. |
| 951 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1330 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
| 952 | # Guess yes on native Windows. | 1331 | # Guess yes on native Windows. |
| 953 | mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1332 | mingw* | windows*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
| 954 | # Guess yes otherwise. | 1333 | # Guess yes otherwise. |
| 955 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1334 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
| 956 | esac | 1335 | esac |
| 957 | changequote([,])dnl | 1336 | changequote([,])dnl |
| 958 | ]) | 1337 | ]) |
| @@ -990,18 +1369,62 @@ int main () | |||
| 990 | [ | 1369 | [ |
| 991 | changequote(,)dnl | 1370 | changequote(,)dnl |
| 992 | case "$host_os" in | 1371 | case "$host_os" in |
| 993 | # Guess yes on glibc systems. | 1372 | # Guess yes on glibc systems. |
| 994 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; | 1373 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; |
| 995 | # Guess yes on musl systems. | 1374 | # Guess yes on musl systems. |
| 996 | *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; | 1375 | *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";; |
| 997 | # Guess yes on BeOS. | 1376 | # Guess yes on BeOS. |
| 998 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; | 1377 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; |
| 999 | # Guess no on Android. | 1378 | # Guess no on Android. |
| 1000 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; | 1379 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; |
| 1001 | # Guess no on native Windows. | 1380 | # Guess no on native Windows. |
| 1002 | mingw*) gl_cv_func_printf_flag_zero="guessing no";; | 1381 | mingw* | windows*) gl_cv_func_printf_flag_zero="guessing no";; |
| 1003 | # If we don't know, obey --enable-cross-guesses. | 1382 | # If we don't know, obey --enable-cross-guesses. |
| 1004 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; | 1383 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; |
| 1384 | esac | ||
| 1385 | changequote([,])dnl | ||
| 1386 | ]) | ||
| 1387 | ]) | ||
| 1388 | ]) | ||
| 1389 | |||
| 1390 | dnl Test whether the *printf family of functions supports the # flag with a | ||
| 1391 | dnl zero precision and a zero value in the 'x' and 'X' directives correctly. | ||
| 1392 | dnl ISO C and POSIX specify that for the 'd', 'i', 'b', 'o', 'u', 'x', 'X' | ||
| 1393 | dnl directives: "The result of converting a zero value with a precision of | ||
| 1394 | dnl zero is no characters." But on Mac OS X 10.5, for the 'x', 'X' directives, | ||
| 1395 | dnl when a # flag is present, the output is "0" instead of "". | ||
| 1396 | dnl Result is gl_cv_func_printf_flag_alt_precision_zero. | ||
| 1397 | |||
| 1398 | AC_DEFUN([gl_PRINTF_FLAG_ALT_PRECISION_ZERO], | ||
| 1399 | [ | ||
| 1400 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1401 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1402 | AC_CACHE_CHECK([whether printf supports the alternative flag with a zero precision], | ||
| 1403 | [gl_cv_func_printf_flag_alt_precision_zero], | ||
| 1404 | [ | ||
| 1405 | AC_RUN_IFELSE( | ||
| 1406 | [AC_LANG_SOURCE([[ | ||
| 1407 | #include <stdio.h> | ||
| 1408 | static char buf[10]; | ||
| 1409 | int main () | ||
| 1410 | { | ||
| 1411 | int result = 0; | ||
| 1412 | if (sprintf (buf, "%#.0x %d", 0, 33, 44) > 0 + 3) | ||
| 1413 | result |= 1; | ||
| 1414 | return result; | ||
| 1415 | }]])], | ||
| 1416 | [gl_cv_func_printf_flag_alt_precision_zero=yes], | ||
| 1417 | [gl_cv_func_printf_flag_alt_precision_zero=no], | ||
| 1418 | [ | ||
| 1419 | changequote(,)dnl | ||
| 1420 | case "$host_os" in | ||
| 1421 | # Guess no only on macOS 10..12 systems. | ||
| 1422 | darwin[0-9] | darwin[0-9].* | \ | ||
| 1423 | darwin1[0-9] | darwin1[0-9].* | \ | ||
| 1424 | darwin2[0-1] | darwin2[0-1].*) | ||
| 1425 | gl_cv_func_printf_flag_alt_precision_zero="guessing no" ;; | ||
| 1426 | darwin*) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; | ||
| 1427 | *) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; | ||
| 1005 | esac | 1428 | esac |
| 1006 | changequote([,])dnl | 1429 | changequote([,])dnl |
| 1007 | ]) | 1430 | ]) |
| @@ -1054,12 +1477,12 @@ int main () | |||
| 1054 | changequote(,)dnl | 1477 | changequote(,)dnl |
| 1055 | case "$host_os" in | 1478 | case "$host_os" in |
| 1056 | # Guess no only on Solaris, native Windows, and BeOS systems. | 1479 | # Guess no only on Solaris, native Windows, and BeOS systems. |
| 1057 | solaris*) gl_cv_func_printf_precision="guessing no" ;; | 1480 | solaris*) gl_cv_func_printf_precision="guessing no" ;; |
| 1058 | mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; | 1481 | mingw* | windows* | pw*) gl_cv_func_printf_precision="guessing no" ;; |
| 1059 | beos*) gl_cv_func_printf_precision="guessing no" ;; | 1482 | beos*) gl_cv_func_printf_precision="guessing no" ;; |
| 1060 | # Guess yes on Android. | 1483 | # Guess yes on Android. |
| 1061 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; | 1484 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; |
| 1062 | *) gl_cv_func_printf_precision="guessing yes" ;; | 1485 | *) gl_cv_func_printf_precision="guessing yes" ;; |
| 1063 | esac | 1486 | esac |
| 1064 | changequote([,])dnl | 1487 | changequote([,])dnl |
| 1065 | ]) | 1488 | ]) |
| @@ -1239,7 +1662,7 @@ changequote(,)dnl | |||
| 1239 | # Guess yes on glibc systems. | 1662 | # Guess yes on glibc systems. |
| 1240 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1663 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
| 1241 | # Guess yes on musl systems. | 1664 | # Guess yes on musl systems. |
| 1242 | *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1665 | *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
| 1243 | # Guess yes on FreeBSD >= 5. | 1666 | # Guess yes on FreeBSD >= 5. |
| 1244 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1667 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
| 1245 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1668 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
| @@ -1275,7 +1698,7 @@ changequote(,)dnl | |||
| 1275 | # Guess yes on Android. | 1698 | # Guess yes on Android. |
| 1276 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1699 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
| 1277 | # Guess no on native Windows. | 1700 | # Guess no on native Windows. |
| 1278 | mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1701 | mingw* | windows*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
| 1279 | # If we don't know, obey --enable-cross-guesses. | 1702 | # If we don't know, obey --enable-cross-guesses. |
| 1280 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; | 1703 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; |
| 1281 | esac | 1704 | esac |
| @@ -1344,7 +1767,7 @@ changequote(,)dnl | |||
| 1344 | # Guess yes on glibc systems. | 1767 | # Guess yes on glibc systems. |
| 1345 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1768 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
| 1346 | # Guess yes on musl systems. | 1769 | # Guess yes on musl systems. |
| 1347 | *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1770 | *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
| 1348 | # Guess yes on FreeBSD >= 5. | 1771 | # Guess yes on FreeBSD >= 5. |
| 1349 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; | 1772 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; |
| 1350 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1773 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
| @@ -1372,7 +1795,8 @@ changequote(,)dnl | |||
| 1372 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1795 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
| 1373 | changequote([,])dnl | 1796 | changequote([,])dnl |
| 1374 | # Guess yes on MSVC, no on mingw. | 1797 | # Guess yes on MSVC, no on mingw. |
| 1375 | mingw*) AC_EGREP_CPP([Known], [ | 1798 | windows*-msvc*) gl_cv_func_snprintf_retval_c99="guessing yes" ;; |
| 1799 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
| 1376 | #ifdef _MSC_VER | 1800 | #ifdef _MSC_VER |
| 1377 | Known | 1801 | Known |
| 1378 | #endif | 1802 | #endif |
| @@ -1401,8 +1825,14 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], | |||
| 1401 | [ | 1825 | [ |
| 1402 | AC_RUN_IFELSE( | 1826 | AC_RUN_IFELSE( |
| 1403 | [AC_LANG_SOURCE([[ | 1827 | [AC_LANG_SOURCE([[ |
| 1828 | #include <signal.h> | ||
| 1404 | #include <stdio.h> | 1829 | #include <stdio.h> |
| 1405 | #include <string.h> | 1830 | #include <string.h> |
| 1831 | #if defined _WIN32 && !defined __CYGWIN__ | ||
| 1832 | # include <stdlib.h> | ||
| 1833 | #else | ||
| 1834 | # include <unistd.h> | ||
| 1835 | #endif | ||
| 1406 | #if HAVE_SNPRINTF | 1836 | #if HAVE_SNPRINTF |
| 1407 | # define my_snprintf snprintf | 1837 | # define my_snprintf snprintf |
| 1408 | #else | 1838 | #else |
| @@ -1417,11 +1847,18 @@ static int my_snprintf (char *buf, int size, const char *format, ...) | |||
| 1417 | return ret; | 1847 | return ret; |
| 1418 | } | 1848 | } |
| 1419 | #endif | 1849 | #endif |
| 1850 | static void | ||
| 1851 | abort_handler (int sig) | ||
| 1852 | { | ||
| 1853 | (void) sig; | ||
| 1854 | _exit (1); | ||
| 1855 | } | ||
| 1420 | static char fmtstring[10]; | 1856 | static char fmtstring[10]; |
| 1421 | static char buf[100]; | 1857 | static char buf[100]; |
| 1422 | int main () | 1858 | int main () |
| 1423 | { | 1859 | { |
| 1424 | int count = -1; | 1860 | int count = -1; |
| 1861 | signal (SIGABRT, abort_handler); | ||
| 1425 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | 1862 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) |
| 1426 | support %n in format strings in read-only memory but not in writable | 1863 | support %n in format strings in read-only memory but not in writable |
| 1427 | memory. */ | 1864 | memory. */ |
| @@ -1447,7 +1884,7 @@ int main () | |||
| 1447 | ;; | 1884 | ;; |
| 1448 | changequote(,)dnl | 1885 | changequote(,)dnl |
| 1449 | # Guess yes on musl systems. | 1886 | # Guess yes on musl systems. |
| 1450 | *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1887 | *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";; |
| 1451 | # Guess yes on FreeBSD >= 5. | 1888 | # Guess yes on FreeBSD >= 5. |
| 1452 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; | 1889 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; |
| 1453 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1890 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; |
| @@ -1476,7 +1913,7 @@ changequote(,)dnl | |||
| 1476 | # Guess no on Android. | 1913 | # Guess no on Android. |
| 1477 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; | 1914 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; |
| 1478 | # Guess no on native Windows. | 1915 | # Guess no on native Windows. |
| 1479 | mingw*) gl_cv_func_snprintf_directive_n="guessing no";; | 1916 | mingw* | windows*) gl_cv_func_snprintf_directive_n="guessing no";; |
| 1480 | # If we don't know, obey --enable-cross-guesses. | 1917 | # If we don't know, obey --enable-cross-guesses. |
| 1481 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; | 1918 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; |
| 1482 | changequote([,])dnl | 1919 | changequote([,])dnl |
| @@ -1524,11 +1961,11 @@ int main() | |||
| 1524 | [gl_cv_func_snprintf_size1=yes], | 1961 | [gl_cv_func_snprintf_size1=yes], |
| 1525 | [gl_cv_func_snprintf_size1=no], | 1962 | [gl_cv_func_snprintf_size1=no], |
| 1526 | [case "$host_os" in | 1963 | [case "$host_os" in |
| 1527 | # Guess yes on Android. | 1964 | # Guess yes on Android. |
| 1528 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; | 1965 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; |
| 1529 | # Guess yes on native Windows. | 1966 | # Guess yes on native Windows. |
| 1530 | mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; | 1967 | mingw* | windows*) gl_cv_func_snprintf_size1="guessing yes" ;; |
| 1531 | *) gl_cv_func_snprintf_size1="guessing yes" ;; | 1968 | *) gl_cv_func_snprintf_size1="guessing yes" ;; |
| 1532 | esac | 1969 | esac |
| 1533 | ]) | 1970 | ]) |
| 1534 | ]) | 1971 | ]) |
| @@ -1601,128 +2038,324 @@ int main() | |||
| 1601 | [ | 2038 | [ |
| 1602 | changequote(,)dnl | 2039 | changequote(,)dnl |
| 1603 | case "$host_os" in | 2040 | case "$host_os" in |
| 1604 | # Guess yes on glibc systems. | 2041 | # Guess yes on glibc systems. |
| 1605 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2042 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1606 | # Guess yes on musl systems. | 2043 | # Guess yes on musl systems. |
| 1607 | *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2044 | *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1608 | # Guess yes on FreeBSD >= 5. | 2045 | # Guess yes on FreeBSD >= 5. |
| 1609 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 2046 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
| 1610 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2047 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1611 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2048 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1612 | # Guess yes on Mac OS X >= 10.3. | 2049 | # Guess yes on Mac OS X >= 10.3. |
| 1613 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 2050 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
| 1614 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2051 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1615 | # Guess yes on Cygwin. | 2052 | # Guess yes on Cygwin. |
| 1616 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2053 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1617 | # Guess yes on Solaris >= 2.6. | 2054 | # Guess yes on Solaris >= 2.6. |
| 1618 | solaris2.[0-5] | solaris2.[0-5].*) | 2055 | solaris2.[0-5] | solaris2.[0-5].*) |
| 1619 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 2056 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
| 1620 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2057 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1621 | # Guess yes on AIX >= 4. | 2058 | # Guess yes on AIX >= 4. |
| 1622 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 2059 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
| 1623 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2060 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1624 | # Guess yes on IRIX >= 6.5. | 2061 | # Guess yes on IRIX >= 6.5. |
| 1625 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2062 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1626 | # Guess yes on NetBSD >= 3. | 2063 | # Guess yes on NetBSD >= 3. |
| 1627 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | 2064 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) |
| 1628 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 2065 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
| 1629 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2066 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1630 | # Guess yes on BeOS. | 2067 | # Guess yes on BeOS. |
| 1631 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2068 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1632 | # Guess yes on Android. | 2069 | # Guess yes on Android. |
| 1633 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2070 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1634 | # Guess yes on native Windows. | 2071 | # Guess yes on native Windows. |
| 1635 | mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 2072 | mingw* | windows* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
| 1636 | # If we don't know, obey --enable-cross-guesses. | 2073 | # If we don't know, obey --enable-cross-guesses. |
| 1637 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; | 2074 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; |
| 1638 | esac | 2075 | esac |
| 1639 | changequote([,])dnl | 2076 | changequote([,])dnl |
| 1640 | ]) | 2077 | ]) |
| 1641 | ]) | 2078 | ]) |
| 1642 | ]) | 2079 | ]) |
| 1643 | 2080 | ||
| 2081 | dnl Test whether the swprintf function works correctly when it produces output | ||
| 2082 | dnl that contains null wide characters. | ||
| 2083 | dnl Result is gl_cv_func_swprintf_works. | ||
| 2084 | |||
| 2085 | AC_DEFUN([gl_SWPRINTF_WORKS], | ||
| 2086 | [ | ||
| 2087 | AC_REQUIRE([AC_PROG_CC]) | ||
| 2088 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 2089 | AC_CHECK_FUNCS_ONCE([swprintf]) | ||
| 2090 | AC_CACHE_CHECK([whether swprintf works], | ||
| 2091 | [gl_cv_func_swprintf_works], | ||
| 2092 | [ | ||
| 2093 | AC_RUN_IFELSE( | ||
| 2094 | [AC_LANG_SOURCE([[ | ||
| 2095 | #ifndef __USE_MINGW_ANSI_STDIO | ||
| 2096 | # define __USE_MINGW_ANSI_STDIO 1 | ||
| 2097 | #endif | ||
| 2098 | #include <stdio.h> | ||
| 2099 | #include <wchar.h> | ||
| 2100 | int main() | ||
| 2101 | { | ||
| 2102 | int result = 0; | ||
| 2103 | { /* This test fails on musl libc 1.2.3, FreeBSD, NetBSD, OpenBSD, macOS, AIX. */ | ||
| 2104 | wchar_t buf[5] = { 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF }; | ||
| 2105 | int ret = swprintf (buf, 4, L"%cz", '\0'); | ||
| 2106 | /* Expected result: | ||
| 2107 | ret = 2, buf[0] = 0x0, buf[1] = 0x7a, buf[2] = 0x0, buf[3] = 0xbeef | ||
| 2108 | musl libc 1.2.3: | ||
| 2109 | ret = 2, buf[0] = 0x0, buf[1] = 0x0, buf[2] = 0x0, buf[3] = 0x0 | ||
| 2110 | Reported at <https://www.openwall.com/lists/musl/2023/03/22/9>. | ||
| 2111 | FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2: | ||
| 2112 | ret = 2, buf[0] = 0x0, buf[1] = 0xbeef, buf[2] = 0xbeef, buf[3] = 0xbeef | ||
| 2113 | */ | ||
| 2114 | if (ret < 0 || buf[1] != 'z') | ||
| 2115 | result |= 1; | ||
| 2116 | } | ||
| 2117 | { /* This test fails on mingw. */ | ||
| 2118 | wchar_t buf[2]; | ||
| 2119 | int ret = swprintf (buf, 2, L"%lc", (wint_t)0); | ||
| 2120 | /* Expected: ret = 1 | ||
| 2121 | mingw: ret = 0 | ||
| 2122 | */ | ||
| 2123 | if (ret != 1) | ||
| 2124 | result |= 2; | ||
| 2125 | } | ||
| 2126 | return result; | ||
| 2127 | }]])], | ||
| 2128 | [gl_cv_func_swprintf_works=yes], | ||
| 2129 | [gl_cv_func_swprintf_works=no], | ||
| 2130 | [case "$host_os" in | ||
| 2131 | # Guess yes on glibc systems. | ||
| 2132 | *-gnu* | gnu*) gl_cv_func_swprintf_works="guessing yes";; | ||
| 2133 | # Guess no on musl systems. | ||
| 2134 | *-musl* | midipix*) gl_cv_func_swprintf_works="guessing no";; | ||
| 2135 | # Guess no on FreeBSD, NetBSD, OpenBSD, macOS, AIX. | ||
| 2136 | freebsd* | midnightbsd* | netbsd* | openbsd* | darwin* | aix*) | ||
| 2137 | gl_cv_func_swprintf_works="guessing no";; | ||
| 2138 | # Guess no on native Windows. | ||
| 2139 | mingw* | windows* | pw*) gl_cv_func_swprintf_works="guessing no";; | ||
| 2140 | # If we don't know, obey --enable-cross-guesses. | ||
| 2141 | *) gl_cv_func_swprintf_works="$gl_cross_guess_normal";; | ||
| 2142 | esac | ||
| 2143 | ]) | ||
| 2144 | ]) | ||
| 2145 | ]) | ||
| 2146 | |||
| 2147 | dnl Test whether the *wprintf family of functions supports the 'a' and 'A' | ||
| 2148 | dnl conversion specifier for hexadecimal output of 'long double' numbers. | ||
| 2149 | dnl (ISO C99, POSIX:2001) | ||
| 2150 | dnl Result is gl_cv_func_swprintf_directive_la. | ||
| 2151 | |||
| 2152 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LA], | ||
| 2153 | [ | ||
| 2154 | AC_REQUIRE([AC_PROG_CC]) | ||
| 2155 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 2156 | AC_CACHE_CHECK([whether swprintf supports the 'La' and 'LA' directives], | ||
| 2157 | [gl_cv_func_swprintf_directive_la], | ||
| 2158 | [ | ||
| 2159 | AC_RUN_IFELSE( | ||
| 2160 | [AC_LANG_SOURCE([[ | ||
| 2161 | #include <stdio.h> | ||
| 2162 | #include <wchar.h> | ||
| 2163 | static wchar_t buf[100]; | ||
| 2164 | int main () | ||
| 2165 | { | ||
| 2166 | int result = 0; | ||
| 2167 | /* This catches a glibc 2.15, Haiku 2022, NetBSD 10.0 bug. */ | ||
| 2168 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
| 2169 | L"%La %d", 3.1416015625L, 33, 44, 55) < 0 | ||
| 2170 | || (wcscmp (buf, L"0x1.922p+1 33") != 0 | ||
| 2171 | && wcscmp (buf, L"0x3.244p+0 33") != 0 | ||
| 2172 | && wcscmp (buf, L"0x6.488p-1 33") != 0 | ||
| 2173 | && wcscmp (buf, L"0xc.91p-2 33") != 0)) | ||
| 2174 | result |= 1; | ||
| 2175 | return result; | ||
| 2176 | }]])], | ||
| 2177 | [gl_cv_func_swprintf_directive_la=yes], | ||
| 2178 | [gl_cv_func_swprintf_directive_la=no], | ||
| 2179 | [case "$host_os" in | ||
| 2180 | # Guess yes on glibc >= 2.17 systems. | ||
| 2181 | *-gnu* | gnu*) | ||
| 2182 | AC_EGREP_CPP([Unlucky], [ | ||
| 2183 | #include <features.h> | ||
| 2184 | #ifdef __GNU_LIBRARY__ | ||
| 2185 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)) && !defined __UCLIBC__ | ||
| 2186 | Unlucky | ||
| 2187 | #endif | ||
| 2188 | #endif | ||
| 2189 | ], | ||
| 2190 | [gl_cv_func_swprintf_directive_la="guessing yes"], | ||
| 2191 | [gl_cv_func_swprintf_directive_la="guessing no"]) | ||
| 2192 | ;; | ||
| 2193 | # Guess yes on musl systems. | ||
| 2194 | *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
| 2195 | # Guess yes on Android. | ||
| 2196 | linux*-android*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
| 2197 | # Guess no on NetBSD. | ||
| 2198 | netbsd*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
| 2199 | # Guess no on native Windows. | ||
| 2200 | mingw* | windows*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
| 2201 | # If we don't know, obey --enable-cross-guesses. | ||
| 2202 | *) gl_cv_func_swprintf_directive_la="$gl_cross_guess_normal";; | ||
| 2203 | esac | ||
| 2204 | ]) | ||
| 2205 | ]) | ||
| 2206 | ]) | ||
| 2207 | |||
| 2208 | dnl Test whether the *wprintf family of functions supports the 'lc' conversion | ||
| 2209 | dnl specifier for all wide characters. | ||
| 2210 | dnl (ISO C11, POSIX:2001) | ||
| 2211 | dnl Result is gl_cv_func_swprintf_directive_lc. | ||
| 2212 | |||
| 2213 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LC], | ||
| 2214 | [ | ||
| 2215 | AC_REQUIRE([AC_PROG_CC]) | ||
| 2216 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 2217 | AC_CACHE_CHECK([whether swprintf supports the 'lc' directive], | ||
| 2218 | [gl_cv_func_swprintf_directive_lc], | ||
| 2219 | [ | ||
| 2220 | AC_RUN_IFELSE( | ||
| 2221 | [AC_LANG_SOURCE([[ | ||
| 2222 | #include <stdio.h> | ||
| 2223 | #include <wchar.h> | ||
| 2224 | static wchar_t buf[100]; | ||
| 2225 | static wint_t L_invalid = (wchar_t) 0x76543210; | ||
| 2226 | int main () | ||
| 2227 | { | ||
| 2228 | int result = 0; | ||
| 2229 | /* This catches a musl libc 1.2.4, Android bug. | ||
| 2230 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/3>. */ | ||
| 2231 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
| 2232 | L"%lc %d", L_invalid, 33, 44, 55) < 0) | ||
| 2233 | result |= 1; | ||
| 2234 | return result; | ||
| 2235 | }]])], | ||
| 2236 | [gl_cv_func_swprintf_directive_lc=yes], | ||
| 2237 | [gl_cv_func_swprintf_directive_lc=no], | ||
| 2238 | [case "$host_os" in | ||
| 2239 | # Guess yes on glibc systems. | ||
| 2240 | *-gnu* | gnu*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
| 2241 | # Guess no on musl systems. | ||
| 2242 | *-musl* | midipix*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
| 2243 | # Guess no on Android. | ||
| 2244 | linux*-android*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
| 2245 | # Guess yes on native Windows. | ||
| 2246 | mingw* | windows*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
| 2247 | # If we don't know, obey --enable-cross-guesses. | ||
| 2248 | *) gl_cv_func_swprintf_directive_lc="$gl_cross_guess_normal";; | ||
| 2249 | esac | ||
| 2250 | ]) | ||
| 2251 | ]) | ||
| 2252 | ]) | ||
| 2253 | |||
| 1644 | dnl The results of these tests on various platforms are: | 2254 | dnl The results of these tests on various platforms are: |
| 1645 | dnl | 2255 | dnl |
| 1646 | dnl 1 = gl_PRINTF_SIZES_C99 | 2256 | dnl 1 = gl_PRINTF_SIZES_C99 |
| 1647 | dnl 2 = gl_PRINTF_LONG_DOUBLE | 2257 | dnl 2 = gl_PRINTF_SIZES_C23 |
| 1648 | dnl 3 = gl_PRINTF_INFINITE | 2258 | dnl 3 = gl_PRINTF_LONG_DOUBLE |
| 1649 | dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE | 2259 | dnl 4 = gl_PRINTF_INFINITE |
| 1650 | dnl 5 = gl_PRINTF_DIRECTIVE_A | 2260 | dnl 5 = gl_PRINTF_INFINITE_LONG_DOUBLE |
| 1651 | dnl 6 = gl_PRINTF_DIRECTIVE_F | 2261 | dnl 6 = gl_PRINTF_DIRECTIVE_A |
| 1652 | dnl 7 = gl_PRINTF_DIRECTIVE_N | 2262 | dnl 7 = gl_PRINTF_DIRECTIVE_B |
| 1653 | dnl 8 = gl_PRINTF_DIRECTIVE_LS | 2263 | dnl 8 = gl_PRINTF_DIRECTIVE_UPPERCASE_B |
| 1654 | dnl 9 = gl_PRINTF_POSITIONS | 2264 | dnl 9 = gl_PRINTF_DIRECTIVE_F |
| 1655 | dnl 10 = gl_PRINTF_FLAG_GROUPING | 2265 | dnl 10 = gl_PRINTF_DIRECTIVE_N |
| 1656 | dnl 11 = gl_PRINTF_FLAG_LEFTADJUST | 2266 | dnl 11 = gl_PRINTF_DIRECTIVE_LS |
| 1657 | dnl 12 = gl_PRINTF_FLAG_ZERO | 2267 | dnl 12 = gl_PRINTF_DIRECTIVE_LC |
| 1658 | dnl 13 = gl_PRINTF_PRECISION | 2268 | dnl 13 = gl_PRINTF_POSITIONS |
| 1659 | dnl 14 = gl_PRINTF_ENOMEM | 2269 | dnl 14 = gl_PRINTF_FLAG_GROUPING |
| 1660 | dnl 15 = gl_SNPRINTF_PRESENCE | 2270 | dnl 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION |
| 1661 | dnl 16 = gl_SNPRINTF_TRUNCATION_C99 | 2271 | dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE |
| 1662 | dnl 17 = gl_SNPRINTF_RETVAL_C99 | 2272 | dnl 17 = gl_PRINTF_FLAG_LEFTADJUST |
| 1663 | dnl 18 = gl_SNPRINTF_DIRECTIVE_N | 2273 | dnl 18 = gl_PRINTF_FLAG_ZERO |
| 1664 | dnl 19 = gl_SNPRINTF_SIZE1 | 2274 | dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO |
| 1665 | dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 | 2275 | dnl 20 = gl_PRINTF_PRECISION |
| 2276 | dnl 21 = gl_PRINTF_ENOMEM | ||
| 2277 | dnl 22 = gl_SNPRINTF_PRESENCE | ||
| 2278 | dnl 23 = gl_SNPRINTF_TRUNCATION_C99 | ||
| 2279 | dnl 24 = gl_SNPRINTF_RETVAL_C99 | ||
| 2280 | dnl 25 = gl_SNPRINTF_DIRECTIVE_N | ||
| 2281 | dnl 26 = gl_SNPRINTF_SIZE1 | ||
| 2282 | dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99 | ||
| 2283 | dnl 28 = gl_SWPRINTF_WORKS | ||
| 2284 | dnl 29 = gl_SWPRINTF_DIRECTIVE_LA | ||
| 2285 | dnl 30 = gl_SWPRINTF_DIRECTIVE_LC | ||
| 1666 | dnl | 2286 | dnl |
| 1667 | dnl 1 = checking whether printf supports size specifiers as in C99... | 2287 | dnl 1 = checking whether printf supports size specifiers as in C99... |
| 1668 | dnl 2 = checking whether printf supports 'long double' arguments... | 2288 | dnl 2 = checking whether printf supports size specifiers as in C23... |
| 1669 | dnl 3 = checking whether printf supports infinite 'double' arguments... | 2289 | dnl 3 = checking whether printf supports 'long double' arguments... |
| 1670 | dnl 4 = checking whether printf supports infinite 'long double' arguments... | 2290 | dnl 4 = checking whether printf supports infinite 'double' arguments... |
| 1671 | dnl 5 = checking whether printf supports the 'a' and 'A' directives... | 2291 | dnl 5 = checking whether printf supports infinite 'long double' arguments... |
| 1672 | dnl 6 = checking whether printf supports the 'F' directive... | 2292 | dnl 6 = checking whether printf supports the 'a' and 'A' directives... |
| 1673 | dnl 7 = checking whether printf supports the 'n' directive... | 2293 | dnl 7 = checking whether printf supports the 'b' directive... |
| 1674 | dnl 8 = checking whether printf supports the 'ls' directive... | 2294 | dnl 8 = checking whether printf supports the 'B' directive... |
| 1675 | dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... | 2295 | dnl 9 = checking whether printf supports the 'F' directive... |
| 1676 | dnl 10 = checking whether printf supports the grouping flag... | 2296 | dnl 10 = checking whether printf supports the 'n' directive... |
| 1677 | dnl 11 = checking whether printf supports the left-adjust flag correctly... | 2297 | dnl 11 = checking whether printf supports the 'ls' directive... |
| 1678 | dnl 12 = checking whether printf supports the zero flag correctly... | 2298 | dnl 12 = checking whether printf supports the 'lc' directive correctly... |
| 1679 | dnl 13 = checking whether printf supports large precisions... | 2299 | dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... |
| 1680 | dnl 14 = checking whether printf survives out-of-memory conditions... | 2300 | dnl 14 = checking whether printf supports the grouping flag... |
| 1681 | dnl 15 = checking for snprintf... | 2301 | dnl 15 = checking whether printf supports grouping on integers with a precision... |
| 1682 | dnl 16 = checking whether snprintf truncates the result as in C99... | 2302 | dnl 16 = checking whether printf supports grouping with a multibyte separator... |
| 1683 | dnl 17 = checking whether snprintf returns a byte count as in C99... | 2303 | dnl 17 = checking whether printf supports the left-adjust flag correctly... |
| 1684 | dnl 18 = checking whether snprintf fully supports the 'n' directive... | 2304 | dnl 18 = checking whether printf supports the zero flag correctly... |
| 1685 | dnl 19 = checking whether snprintf respects a size of 1... | 2305 | dnl 19 = checking whether printf supports the alternative flag with a zero precision... |
| 1686 | dnl 20 = checking whether vsnprintf respects a zero size as in C99... | 2306 | dnl 20 = checking whether printf supports large precisions... |
| 2307 | dnl 21 = checking whether printf survives out-of-memory conditions... | ||
| 2308 | dnl 22 = checking for snprintf... | ||
| 2309 | dnl 23 = checking whether snprintf truncates the result as in C99... | ||
| 2310 | dnl 24 = checking whether snprintf returns a byte count as in C99... | ||
| 2311 | dnl 25 = checking whether snprintf fully supports the 'n' directive... | ||
| 2312 | dnl 26 = checking whether snprintf respects a size of 1... | ||
| 2313 | dnl 27 = checking whether vsnprintf respects a zero size as in C99... | ||
| 2314 | dnl 28 = checking whether swprintf works... | ||
| 2315 | dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives... | ||
| 2316 | dnl 30 = checking whether swprintf supports the 'lc' directive... | ||
| 1687 | dnl | 2317 | dnl |
| 1688 | dnl . = yes, # = no. | 2318 | dnl . = yes, # = no. |
| 1689 | dnl | 2319 | dnl |
| 1690 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 2320 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
| 1691 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . | 2321 | dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . . . . . . . . . . . . # . # |
| 1692 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . | 2322 | dnl glibc 2.35 . # . . . . . . . . . . . . # . . . . . . . . . . . . . . . |
| 1693 | dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . | 2323 | dnl glibc 2.5 . # . . . . # # . . . . . . # . . . . . . . . . . . . . # . |
| 1694 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . | 2324 | dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . . . # . |
| 1695 | dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . | 2325 | dnl FreeBSD 14.0 . . . . . # . . . . . . . . # . . . . . # . . . . . . # . # |
| 1696 | dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . | 2326 | dnl FreeBSD 13.0 . # . . . # # # . . . . . . # . . . . . # . . . . . . # . # |
| 1697 | dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . | 2327 | dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . . . # ? . # . . . . . . # ? ? |
| 1698 | dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . | 2328 | dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . ? ? . . . . . . . . # . . # ? ? |
| 1699 | dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . | 2329 | dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . ? ? . # # . . . . . . . . # ? ? |
| 1700 | dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . | 2330 | dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . ? ? . # # . # . . . . . . # ? ? |
| 1701 | dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . | 2331 | dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . . . # . . . . . . # . # |
| 1702 | dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . | 2332 | dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # ? ? . # ? . # . . . . . . # ? ? |
| 1703 | dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . | 2333 | dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . ? ? . . ? . ? . . . . . . ? ? ? |
| 1704 | dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . | 2334 | dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . ? ? . . ? . # . . . . . . ? ? ? |
| 1705 | dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . | 2335 | dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # ? ? . # ? # # . . . . . . ? ? ? |
| 1706 | dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . | 2336 | dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # . |
| 1707 | dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . | 2337 | dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # . |
| 1708 | dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # | 2338 | dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ? |
| 1709 | dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . | 2339 | dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # . |
| 1710 | dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . | 2340 | dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ? |
| 1711 | dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . | 2341 | dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ? |
| 1712 | dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . | 2342 | dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . . |
| 1713 | dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # | 2343 | dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ? |
| 1714 | dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # | 2344 | dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ? |
| 1715 | dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . | 2345 | dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ? |
| 1716 | dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # | 2346 | dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . ? ? . # ? . . . . # # . # ? ? ? |
| 1717 | dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # | 2347 | dnl HP-UX 10.20 # # . # . # # # # . ? ? . . ? ? # # ? . . . . # # ? # ? ? ? |
| 1718 | dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . | 2348 | dnl IRIX 6.5 # # . # # # # # # . # . . . ? ? . # ? . . . . # . . . # ? ? |
| 1719 | dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . | 2349 | dnl OSF/1 5.1 # # . # # # # # # . . ? . . ? ? . # ? . . . . # . . # ? ? ? |
| 1720 | dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? | 2350 | dnl OSF/1 4.0d # # . # # # # # # . . ? . . ? ? . # ? . . # # # # # # ? ? ? |
| 1721 | dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . | 2351 | dnl NetBSD 9.0 . # . . . # # # . . . . . . # # . . . . . . . . . . . # . # |
| 1722 | dnl Haiku . . . # # # . # . . . . . ? . . ? . . . | 2352 | dnl NetBSD 5.0 . # . . # # # # . . . . . . ? ? . # ? . # . . . . . . # ? ? |
| 1723 | dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . | 2353 | dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? ? ? . . . ? ? ? # ? ? |
| 1724 | dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . | 2354 | dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? ? ? # ? . # . . . . . . # ? ? |
| 1725 | dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . | 2355 | dnl Haiku . # . . # # # # # . # ? . . # . . . ? . ? . . ? . . . . # . |
| 1726 | dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . | 2356 | dnl BeOS # # # . # # # # # . ? ? # . ? ? ? . ? # ? . . ? . . . ? ? ? |
| 1727 | dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . | 2357 | dnl Android 4.3 . # . # # # # # # # # ? . # ? ? . # ? . # . . . # . . ? ? ? |
| 1728 | dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . | 2358 | dnl old mingw / msvcrt # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ? |
| 2359 | dnl MSVC 9 # # # # # # # # # # . ? # # ? ? . # ? # ? # # # # . . # ? ? | ||
| 2360 | dnl mingw 2009-2011 . # # . # . # # . . . ? # # ? ? . . ? . ? . . . . . . # ? ? | ||
| 2361 | dnl mingw-w64 2011 # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ? | ||
diff --git a/gl/m4/pthread-once.m4 b/gl/m4/pthread-once.m4 new file mode 100644 index 00000000..85549254 --- /dev/null +++ b/gl/m4/pthread-once.m4 | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | # pthread-once.m4 | ||
| 2 | # serial 6 | ||
| 3 | dnl Copyright (C) 2019-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_PTHREAD_ONCE], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_PTHREAD_H]) | ||
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 13 | AC_REQUIRE([gl_PTHREADLIB]) | ||
| 14 | |||
| 15 | if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ | ||
| 16 | && test $gl_threads_api = windows; then | ||
| 17 | dnl Choose function names that don't conflict with the mingw-w64 winpthreads | ||
| 18 | dnl library. | ||
| 19 | REPLACE_PTHREAD_ONCE=1 | ||
| 20 | PTHREAD_ONCE_LIB= | ||
| 21 | else | ||
| 22 | if test $HAVE_PTHREAD_H = 0; then | ||
| 23 | HAVE_PTHREAD_ONCE=0 | ||
| 24 | PTHREAD_ONCE_LIB= | ||
| 25 | else | ||
| 26 | dnl Work around Cygwin 3.5.3 bug. | ||
| 27 | AC_CACHE_CHECK([whether pthread_once works], | ||
| 28 | [gl_cv_func_pthread_once_works], | ||
| 29 | [case "$host_os" in | ||
| 30 | cygwin*) gl_cv_func_pthread_once_works="guessing no" ;; | ||
| 31 | *) gl_cv_func_pthread_once_works="yes" ;; | ||
| 32 | esac | ||
| 33 | ]) | ||
| 34 | case "$gl_cv_func_pthread_once_works" in | ||
| 35 | *yes) ;; | ||
| 36 | *) REPLACE_PTHREAD_ONCE=1 ;; | ||
| 37 | esac | ||
| 38 | dnl Determine whether linking requires $(LIBPMULTITHREAD) or only | ||
| 39 | dnl $(LIBPTHREAD). | ||
| 40 | if test -z "$LIBPTHREAD" && test -n "$LIBPMULTITHREAD"; then | ||
| 41 | AC_CACHE_CHECK([whether pthread_once can be used without linking with libpthread], | ||
| 42 | [gl_cv_func_pthread_once_no_lib], | ||
| 43 | [AC_RUN_IFELSE( | ||
| 44 | [AC_LANG_PROGRAM( | ||
| 45 | [[#include <pthread.h> | ||
| 46 | static pthread_once_t a_once = PTHREAD_ONCE_INIT; | ||
| 47 | static int a; | ||
| 48 | static void a_init (void) { a = 8647; } | ||
| 49 | ]], | ||
| 50 | [[if (pthread_once (&a_once, a_init)) return 1; | ||
| 51 | if (a != 8647) return 2; | ||
| 52 | return 0; | ||
| 53 | ]])], | ||
| 54 | [gl_cv_func_pthread_once_no_lib=yes], | ||
| 55 | [gl_cv_func_pthread_once_no_lib=no], | ||
| 56 | [case "$host_os" in | ||
| 57 | # Guess no on glibc. | ||
| 58 | *-gnu* | gnu*) | ||
| 59 | gl_cv_func_pthread_once_no_lib="guessing no" ;; | ||
| 60 | # Guess no on FreeBSD. | ||
| 61 | freebsd* | dragonfly* | midnightbsd*) | ||
| 62 | gl_cv_func_pthread_once_no_lib="guessing no" ;; | ||
| 63 | # Guess yes otherwise. | ||
| 64 | *) | ||
| 65 | gl_cv_func_pthread_once_no_lib="guessing yes" ;; | ||
| 66 | esac | ||
| 67 | ]) | ||
| 68 | ]) | ||
| 69 | case "$gl_cv_func_pthread_once_no_lib" in | ||
| 70 | *yes) PTHREAD_ONCE_LIB="$LIBPTHREAD" ;; | ||
| 71 | *) PTHREAD_ONCE_LIB="$LIBPMULTITHREAD" ;; | ||
| 72 | esac | ||
| 73 | dnl Expected result: | ||
| 74 | dnl PTHREAD_ONCE_LIB is $(LIBPMULTITHREAD) on glibc < 2.34, FreeBSD. | ||
| 75 | dnl PTHREAD_ONCE_LIB is $(LIBPTHREAD) in particular on | ||
| 76 | dnl musl libc, macOS, NetBSD, Solaris, Cygwin, Haiku, Android. | ||
| 77 | else | ||
| 78 | PTHREAD_ONCE_LIB="$LIBPTHREAD" | ||
| 79 | fi | ||
| 80 | fi | ||
| 81 | fi | ||
| 82 | AC_SUBST([PTHREAD_ONCE_LIB]) | ||
| 83 | ]) | ||
diff --git a/gl/m4/pthread-spin.m4 b/gl/m4/pthread-spin.m4 new file mode 100644 index 00000000..aae2fb3b --- /dev/null +++ b/gl/m4/pthread-spin.m4 | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # pthread-spin.m4 | ||
| 2 | # serial 8 | ||
| 3 | dnl Copyright (C) 2019-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_ONCE([gl_PTHREAD_SPIN], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_PTHREAD_H_PART1]) | ||
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 13 | |||
| 14 | if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ | ||
| 15 | && test $gl_threads_api = windows; then | ||
| 16 | dnl Choose function names that don't conflict with the mingw-w64 winpthreads | ||
| 17 | dnl library. | ||
| 18 | REPLACE_PTHREAD_SPIN_INIT=1 | ||
| 19 | REPLACE_PTHREAD_SPIN_LOCK=1 | ||
| 20 | REPLACE_PTHREAD_SPIN_TRYLOCK=1 | ||
| 21 | REPLACE_PTHREAD_SPIN_UNLOCK=1 | ||
| 22 | REPLACE_PTHREAD_SPIN_DESTROY=1 | ||
| 23 | else | ||
| 24 | if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then | ||
| 25 | HAVE_PTHREAD_SPIN_INIT=0 | ||
| 26 | HAVE_PTHREAD_SPIN_LOCK=0 | ||
| 27 | HAVE_PTHREAD_SPIN_TRYLOCK=0 | ||
| 28 | HAVE_PTHREAD_SPIN_UNLOCK=0 | ||
| 29 | HAVE_PTHREAD_SPIN_DESTROY=0 | ||
| 30 | else | ||
| 31 | dnl Test whether the gnulib module 'threadlib' is in use. | ||
| 32 | dnl Some packages like Emacs use --avoid=threadlib. | ||
| 33 | dnl Write the symbol in such a way that it does not cause 'aclocal' to pick | ||
| 34 | dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. | ||
| 35 | m4_ifdef([gl_][THREADLIB], [ | ||
| 36 | AC_REQUIRE([gl_][THREADLIB]) | ||
| 37 | dnl Test whether the functions actually exist. | ||
| 38 | dnl FreeBSD 5.2.1 declares them but does not define them. | ||
| 39 | AC_CACHE_CHECK([for pthread_spin_init], | ||
| 40 | [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD], | ||
| 41 | [gl_saved_LIBS="$LIBS" | ||
| 42 | LIBS="$LIBS $LIBMULTITHREAD" | ||
| 43 | AC_LINK_IFELSE( | ||
| 44 | [AC_LANG_PROGRAM( | ||
| 45 | [[#include <pthread.h> | ||
| 46 | ]], | ||
| 47 | [[pthread_spinlock_t lock; | ||
| 48 | return pthread_spin_init (&lock, 0); | ||
| 49 | ]]) | ||
| 50 | ], | ||
| 51 | [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=yes], | ||
| 52 | [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=no]) | ||
| 53 | LIBS="$gl_saved_LIBS" | ||
| 54 | ]) | ||
| 55 | if test $gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD != yes; then | ||
| 56 | HAVE_PTHREAD_SPIN_INIT=0 | ||
| 57 | REPLACE_PTHREAD_SPIN_INIT=1 | ||
| 58 | HAVE_PTHREAD_SPIN_LOCK=0 | ||
| 59 | REPLACE_PTHREAD_SPIN_LOCK=1 | ||
| 60 | HAVE_PTHREAD_SPIN_TRYLOCK=0 | ||
| 61 | REPLACE_PTHREAD_SPIN_TRYLOCK=1 | ||
| 62 | HAVE_PTHREAD_SPIN_UNLOCK=0 | ||
| 63 | REPLACE_PTHREAD_SPIN_UNLOCK=1 | ||
| 64 | HAVE_PTHREAD_SPIN_DESTROY=0 | ||
| 65 | REPLACE_PTHREAD_SPIN_DESTROY=1 | ||
| 66 | fi | ||
| 67 | ], [ | ||
| 68 | : | ||
| 69 | ]) | ||
| 70 | fi | ||
| 71 | fi | ||
| 72 | ]) | ||
diff --git a/gl/m4/pthread_h.m4 b/gl/m4/pthread_h.m4 new file mode 100644 index 00000000..bb921386 --- /dev/null +++ b/gl/m4/pthread_h.m4 | |||
| @@ -0,0 +1,293 @@ | |||
| 1 | # pthread_h.m4 | ||
| 2 | # serial 11 | ||
| 3 | dnl Copyright (C) 2009-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_ONCE([gl_PTHREAD_H_PART1], | ||
| 10 | [ | ||
| 11 | dnl Ensure to expand the default settings once only, before all statements | ||
| 12 | dnl that occur in other macros. | ||
| 13 | AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) | ||
| 14 | |||
| 15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 16 | AC_REQUIRE([gl_PTHREADLIB]) | ||
| 17 | |||
| 18 | gl_CHECK_NEXT_HEADERS([pthread.h]) | ||
| 19 | if test $ac_cv_header_pthread_h = yes; then | ||
| 20 | HAVE_PTHREAD_H=1 | ||
| 21 | dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used, | ||
| 22 | dnl ignore the <pthread.h> from the mingw-w64 winpthreads library. | ||
| 23 | m4_ifdef([gl_][THREADLIB], [ | ||
| 24 | AC_REQUIRE([gl_][THREADLIB]) | ||
| 25 | if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ | ||
| 26 | && test $gl_threads_api = windows; then | ||
| 27 | HAVE_PTHREAD_H=0 | ||
| 28 | fi | ||
| 29 | ]) | ||
| 30 | else | ||
| 31 | HAVE_PTHREAD_H=0 | ||
| 32 | fi | ||
| 33 | AC_SUBST([HAVE_PTHREAD_H]) | ||
| 34 | |||
| 35 | AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [], | ||
| 36 | [AC_INCLUDES_DEFAULT[ | ||
| 37 | #if HAVE_PTHREAD_H | ||
| 38 | #include <pthread.h> | ||
| 39 | #endif]]) | ||
| 40 | if test $ac_cv_type_pthread_t != yes; then | ||
| 41 | HAVE_PTHREAD_T=0 | ||
| 42 | fi | ||
| 43 | if test $ac_cv_type_pthread_spinlock_t != yes; then | ||
| 44 | HAVE_PTHREAD_SPINLOCK_T=0 | ||
| 45 | fi | ||
| 46 | ]) | ||
| 47 | |||
| 48 | AC_DEFUN([gl_PTHREAD_H], | ||
| 49 | [ | ||
| 50 | AC_REQUIRE([gl_PTHREAD_H_PART1]) | ||
| 51 | |||
| 52 | dnl Set HAVE_PTHREAD_SPIN_INIT, REPLACE_PTHREAD_SPIN_INIT. | ||
| 53 | gl_PTHREAD_SPIN | ||
| 54 | |||
| 55 | dnl Constants may be defined as C preprocessor macros or as enum items. | ||
| 56 | |||
| 57 | AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED], | ||
| 58 | [gl_cv_const_PTHREAD_CREATE_DETACHED], | ||
| 59 | [AC_COMPILE_IFELSE( | ||
| 60 | [AC_LANG_PROGRAM( | ||
| 61 | [[#include <pthread.h> | ||
| 62 | int x = PTHREAD_CREATE_DETACHED; | ||
| 63 | ]], | ||
| 64 | [[]])], | ||
| 65 | [gl_cv_const_PTHREAD_CREATE_DETACHED=yes], | ||
| 66 | [gl_cv_const_PTHREAD_CREATE_DETACHED=no]) | ||
| 67 | ]) | ||
| 68 | if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then | ||
| 69 | HAVE_PTHREAD_CREATE_DETACHED=0 | ||
| 70 | fi | ||
| 71 | |||
| 72 | AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE], | ||
| 73 | [gl_cv_const_PTHREAD_MUTEX_RECURSIVE], | ||
| 74 | [AC_COMPILE_IFELSE( | ||
| 75 | [AC_LANG_PROGRAM( | ||
| 76 | [[#include <pthread.h> | ||
| 77 | int x = PTHREAD_MUTEX_RECURSIVE; | ||
| 78 | ]], | ||
| 79 | [[]])], | ||
| 80 | [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes], | ||
| 81 | [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no]) | ||
| 82 | ]) | ||
| 83 | if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then | ||
| 84 | HAVE_PTHREAD_MUTEX_RECURSIVE=0 | ||
| 85 | fi | ||
| 86 | |||
| 87 | AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST], | ||
| 88 | [gl_cv_const_PTHREAD_MUTEX_ROBUST], | ||
| 89 | [AC_COMPILE_IFELSE( | ||
| 90 | [AC_LANG_PROGRAM( | ||
| 91 | [[#include <pthread.h> | ||
| 92 | int x = PTHREAD_MUTEX_ROBUST; | ||
| 93 | ]], | ||
| 94 | [[]])], | ||
| 95 | [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes], | ||
| 96 | [gl_cv_const_PTHREAD_MUTEX_ROBUST=no]) | ||
| 97 | ]) | ||
| 98 | if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then | ||
| 99 | HAVE_PTHREAD_MUTEX_ROBUST=0 | ||
| 100 | fi | ||
| 101 | |||
| 102 | AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED], | ||
| 103 | [gl_cv_const_PTHREAD_PROCESS_SHARED], | ||
| 104 | [AC_COMPILE_IFELSE( | ||
| 105 | [AC_LANG_PROGRAM( | ||
| 106 | [[#include <pthread.h> | ||
| 107 | int x = PTHREAD_PROCESS_SHARED; | ||
| 108 | ]], | ||
| 109 | [[]])], | ||
| 110 | [gl_cv_const_PTHREAD_PROCESS_SHARED=yes], | ||
| 111 | [gl_cv_const_PTHREAD_PROCESS_SHARED=no]) | ||
| 112 | ]) | ||
| 113 | if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then | ||
| 114 | HAVE_PTHREAD_PROCESS_SHARED=0 | ||
| 115 | fi | ||
| 116 | |||
| 117 | dnl Check for declarations of anything we want to poison if the | ||
| 118 | dnl corresponding gnulib module is not in use, if it is not common | ||
| 119 | dnl enough to be declared everywhere. | ||
| 120 | gl_WARN_ON_USE_PREPARE([[#include <pthread.h> | ||
| 121 | ]], [ | ||
| 122 | pthread_create pthread_attr_init pthread_attr_getdetachstate | ||
| 123 | pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal | ||
| 124 | pthread_detach pthread_join pthread_exit | ||
| 125 | pthread_once | ||
| 126 | pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype | ||
| 127 | pthread_mutexattr_settype pthread_mutexattr_getrobust | ||
| 128 | pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock | ||
| 129 | pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock | ||
| 130 | pthread_mutex_destroy | ||
| 131 | pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy | ||
| 132 | pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock | ||
| 133 | pthread_rwlock_trywrlock pthread_rwlock_timedrdlock | ||
| 134 | pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy | ||
| 135 | pthread_cond_init pthread_condattr_init pthread_condattr_destroy | ||
| 136 | pthread_cond_wait pthread_cond_timedwait pthread_cond_signal | ||
| 137 | pthread_cond_broadcast pthread_cond_destroy | ||
| 138 | pthread_key_create pthread_setspecific pthread_getspecific | ||
| 139 | pthread_key_delete | ||
| 140 | pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock | ||
| 141 | pthread_spin_destroy]) | ||
| 142 | |||
| 143 | AC_REQUIRE([AC_C_RESTRICT]) | ||
| 144 | |||
| 145 | dnl For backward compatibility with gnulib versions <= 2019-07. | ||
| 146 | LIB_PTHREAD="$LIBPMULTITHREAD" | ||
| 147 | AC_SUBST([LIB_PTHREAD]) | ||
| 148 | ]) | ||
| 149 | |||
| 150 | # gl_PTHREAD_MODULE_INDICATOR([modulename]) | ||
| 151 | # sets the shell variable that indicates the presence of the given module | ||
| 152 | # to a C preprocessor expression that will evaluate to 1. | ||
| 153 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 154 | AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR], | ||
| 155 | [ | ||
| 156 | dnl Ensure to expand the default settings once only. | ||
| 157 | gl_PTHREAD_H_REQUIRE_DEFAULTS | ||
| 158 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 159 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 160 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 161 | ]) | ||
| 162 | |||
| 163 | # Initializes the default values for AC_SUBSTed shell variables. | ||
| 164 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
| 165 | # outside of macros or in macros that are not AC_REQUIREd. | ||
| 166 | AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS], | ||
| 167 | [ | ||
| 168 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [ | ||
| 169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD]) | ||
| 170 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE]) | ||
| 171 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX]) | ||
| 172 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK]) | ||
| 173 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND]) | ||
| 174 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS]) | ||
| 175 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN]) | ||
| 176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK]) | ||
| 177 | ]) | ||
| 178 | m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS]) | ||
| 179 | AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) | ||
| 180 | ]) | ||
| 181 | |||
| 182 | AC_DEFUN([gl_PTHREAD_H_DEFAULTS], | ||
| 183 | [ | ||
| 184 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 185 | HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) | ||
| 186 | HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) | ||
| 187 | HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED]) | ||
| 188 | HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE]) | ||
| 189 | HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST]) | ||
| 190 | HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED]) | ||
| 191 | HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE]) | ||
| 192 | HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT]) | ||
| 193 | HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE]) | ||
| 194 | HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE]) | ||
| 195 | HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY]) | ||
| 196 | HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF]) | ||
| 197 | HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL]) | ||
| 198 | HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH]) | ||
| 199 | HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN]) | ||
| 200 | HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT]) | ||
| 201 | HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE]) | ||
| 202 | HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT]) | ||
| 203 | HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT]) | ||
| 204 | HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE]) | ||
| 205 | HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE]) | ||
| 206 | HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST]) | ||
| 207 | HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST]) | ||
| 208 | HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY]) | ||
| 209 | HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK]) | ||
| 210 | HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK]) | ||
| 211 | HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK]) | ||
| 212 | HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK]) | ||
| 213 | HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY]) | ||
| 214 | HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT]) | ||
| 215 | HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT]) | ||
| 216 | HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY]) | ||
| 217 | HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK]) | ||
| 218 | HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK]) | ||
| 219 | HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK]) | ||
| 220 | HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK]) | ||
| 221 | HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK]) | ||
| 222 | HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK]) | ||
| 223 | HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK]) | ||
| 224 | HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY]) | ||
| 225 | HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT]) | ||
| 226 | HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT]) | ||
| 227 | HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY]) | ||
| 228 | HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT]) | ||
| 229 | HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT]) | ||
| 230 | HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL]) | ||
| 231 | HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST]) | ||
| 232 | HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY]) | ||
| 233 | HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE]) | ||
| 234 | HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC]) | ||
| 235 | HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC]) | ||
| 236 | HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE]) | ||
| 237 | HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT]) | ||
| 238 | HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK]) | ||
| 239 | HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK]) | ||
| 240 | HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK]) | ||
| 241 | HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY]) | ||
| 242 | REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE]) | ||
| 243 | REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT]) | ||
| 244 | REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE]) | ||
| 245 | REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE]) | ||
| 246 | REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY]) | ||
| 247 | REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF]) | ||
| 248 | REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL]) | ||
| 249 | REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH]) | ||
| 250 | REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN]) | ||
| 251 | REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT]) | ||
| 252 | REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE]) | ||
| 253 | REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT]) | ||
| 254 | REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT]) | ||
| 255 | REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE]) | ||
| 256 | REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE]) | ||
| 257 | REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST]) | ||
| 258 | REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST]) | ||
| 259 | REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY]) | ||
| 260 | REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK]) | ||
| 261 | REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK]) | ||
| 262 | REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK]) | ||
| 263 | REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK]) | ||
| 264 | REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY]) | ||
| 265 | REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT]) | ||
| 266 | REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT]) | ||
| 267 | REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY]) | ||
| 268 | REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK]) | ||
| 269 | REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK]) | ||
| 270 | REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK]) | ||
| 271 | REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK]) | ||
| 272 | REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK]) | ||
| 273 | REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK]) | ||
| 274 | REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK]) | ||
| 275 | REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY]) | ||
| 276 | REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT]) | ||
| 277 | REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT]) | ||
| 278 | REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY]) | ||
| 279 | REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT]) | ||
| 280 | REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT]) | ||
| 281 | REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL]) | ||
| 282 | REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST]) | ||
| 283 | REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY]) | ||
| 284 | REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE]) | ||
| 285 | REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC]) | ||
| 286 | REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC]) | ||
| 287 | REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE]) | ||
| 288 | REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT]) | ||
| 289 | REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK]) | ||
| 290 | REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK]) | ||
| 291 | REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK]) | ||
| 292 | REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY]) | ||
| 293 | ]) | ||
diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4 index ae6a8853..aec9f076 100644 --- a/gl/m4/pthread_rwlock_rdlock.m4 +++ b/gl/m4/pthread_rwlock_rdlock.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # pthread_rwlock_rdlock.m4 serial 4 | 1 | # pthread_rwlock_rdlock.m4 |
| 2 | dnl Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
| 3 | dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | dnl Inspired by | 10 | dnl Inspired by |
| @@ -34,11 +36,11 @@ dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 | |||
| 34 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 | 36 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 |
| 35 | AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], | 37 | AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], |
| 36 | [ | 38 | [ |
| 37 | AC_REQUIRE([gl_THREADLIB_EARLY]) | 39 | AC_REQUIRE([gl_THREADLIB]) |
| 38 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 40 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 39 | AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], | 41 | AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], |
| 40 | [gl_cv_pthread_rwlock_rdlock_prefer_writer], | 42 | [gl_cv_pthread_rwlock_rdlock_prefer_writer], |
| 41 | [save_LIBS="$LIBS" | 43 | [saved_LIBS="$LIBS" |
| 42 | LIBS="$LIBS $LIBMULTITHREAD" | 44 | LIBS="$LIBS $LIBMULTITHREAD" |
| 43 | AC_RUN_IFELSE( | 45 | AC_RUN_IFELSE( |
| 44 | [AC_LANG_SOURCE([[ | 46 | [AC_LANG_SOURCE([[ |
| @@ -156,25 +158,25 @@ main () | |||
| 156 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], | 158 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], |
| 157 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], | 159 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], |
| 158 | [case "$host_os" in | 160 | [case "$host_os" in |
| 159 | # Guess no on glibc systems. | 161 | # Guess no on glibc systems. |
| 160 | *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | 162 | *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; |
| 161 | # Guess no on musl systems. | 163 | # Guess no on musl systems. |
| 162 | *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | 164 | *-musl* | midipix*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; |
| 163 | # Guess no on bionic systems. | 165 | # Guess no on bionic systems. |
| 164 | *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | 166 | *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; |
| 165 | # Guess yes on native Windows with the mingw-w64 winpthreads library. | 167 | # Guess yes on native Windows with the mingw-w64 winpthreads library. |
| 166 | # Guess no on native Windows with the gnulib windows-rwlock module. | 168 | # Guess no on native Windows with the gnulib windows-rwlock module. |
| 167 | mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then | 169 | mingw* | windows*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then |
| 168 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" | 170 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" |
| 169 | else | 171 | else |
| 170 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" | 172 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" |
| 171 | fi | 173 | fi |
| 172 | ;; | 174 | ;; |
| 173 | # If we don't know, obey --enable-cross-guesses. | 175 | # If we don't know, obey --enable-cross-guesses. |
| 174 | *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; | 176 | *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; |
| 175 | esac | 177 | esac |
| 176 | ]) | 178 | ]) |
| 177 | LIBS="$save_LIBS" | 179 | LIBS="$saved_LIBS" |
| 178 | ]) | 180 | ]) |
| 179 | case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in | 181 | case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in |
| 180 | *yes) | 182 | *yes) |
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 index d22138fc..67c1476b 100644 --- a/gl/m4/realloc.m4 +++ b/gl/m4/realloc.m4 | |||
| @@ -1,52 +1,22 @@ | |||
| 1 | # realloc.m4 serial 26 | 1 | # realloc.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 39.1 |
| 3 | dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # This is adapted with modifications from upstream Autoconf here: | 9 | # An an experimental option, the user can request a sanitized realloc() |
| 8 | # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 | 10 | # implementation, i.e. one that aborts upon undefined behaviour, |
| 9 | AC_DEFUN([_AC_FUNC_REALLOC_IF], | 11 | # by setting |
| 12 | # gl_cv_func_realloc_sanitize=yes | ||
| 13 | # at configure time. | ||
| 14 | AC_DEFUN([gl_FUNC_REALLOC_SANITIZED], | ||
| 10 | [ | 15 | [ |
| 11 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | 16 | AC_CACHE_CHECK([whether realloc should abort upon undefined behaviour], |
| 12 | AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], | 17 | [gl_cv_func_realloc_sanitize], |
| 13 | [ac_cv_func_realloc_0_nonnull], | 18 | [test -n "$gl_cv_func_realloc_sanitize" || gl_cv_func_realloc_sanitize=no]) |
| 14 | [AC_RUN_IFELSE( | 19 | ]) |
| 15 | [AC_LANG_PROGRAM( | ||
| 16 | [[#include <stdlib.h> | ||
| 17 | ]], | ||
| 18 | [[void *p = realloc (0, 0); | ||
| 19 | int result = !p; | ||
| 20 | free (p); | ||
| 21 | return result;]]) | ||
| 22 | ], | ||
| 23 | [ac_cv_func_realloc_0_nonnull=yes], | ||
| 24 | [ac_cv_func_realloc_0_nonnull=no], | ||
| 25 | [case "$host_os" in | ||
| 26 | # Guess yes on platforms where we know the result. | ||
| 27 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | ||
| 28 | | gnu* | *-musl* | midnightbsd* \ | ||
| 29 | | hpux* | solaris* | cygwin* | mingw* | msys* ) | ||
| 30 | ac_cv_func_realloc_0_nonnull="guessing yes" ;; | ||
| 31 | # If we don't know, obey --enable-cross-guesses. | ||
| 32 | *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; | ||
| 33 | esac | ||
| 34 | ]) | ||
| 35 | ]) | ||
| 36 | AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) | ||
| 37 | ])# AC_FUNC_REALLOC | ||
| 38 | |||
| 39 | # gl_FUNC_REALLOC_GNU | ||
| 40 | # ------------------- | ||
| 41 | # Replace realloc if it is not compatible with GNU libc. | ||
| 42 | AC_DEFUN([gl_FUNC_REALLOC_GNU], | ||
| 43 | [ | ||
| 44 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
| 45 | AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) | ||
| 46 | if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then | ||
| 47 | _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1]) | ||
| 48 | fi | ||
| 49 | ])# gl_FUNC_REALLOC_GNU | ||
| 50 | 20 | ||
| 51 | # gl_FUNC_REALLOC_POSIX | 21 | # gl_FUNC_REALLOC_POSIX |
| 52 | # --------------------- | 22 | # --------------------- |
| @@ -57,7 +27,100 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX], | |||
| 57 | [ | 27 | [ |
| 58 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 28 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 59 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) | 29 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) |
| 60 | if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then | 30 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 31 | AC_CACHE_CHECK([whether realloc sets errno on failure], | ||
| 32 | [gl_cv_func_realloc_posix], | ||
| 33 | [ | ||
| 34 | dnl FreeBSD 15.0 realloc() does not set errno when asked for more than | ||
| 35 | dnl 0x7000000000000000 bytes. | ||
| 36 | case "$host_os" in | ||
| 37 | darwin* | freebsd* | dragonfly* | midnightbsd* | netbsd* | openbsd*) | ||
| 38 | AC_RUN_IFELSE( | ||
| 39 | [AC_LANG_SOURCE( | ||
| 40 | [[#include <errno.h> | ||
| 41 | #include <stdlib.h> | ||
| 42 | int main (int argc, char **argv) | ||
| 43 | { | ||
| 44 | void *p; | ||
| 45 | errno = 1729; | ||
| 46 | p = realloc (malloc (1), (size_t)(-1) / 100 * 49); | ||
| 47 | return (!p && errno == 1729); | ||
| 48 | } | ||
| 49 | ]]) | ||
| 50 | ], | ||
| 51 | [gl_cv_func_realloc_posix=yes], | ||
| 52 | [gl_cv_func_realloc_posix=no], | ||
| 53 | [case "$host_os" in | ||
| 54 | freebsd*) gl_cv_func_realloc_posix="guessing no" ;; | ||
| 55 | *) gl_cv_func_realloc_posix="guessing yes" ;; | ||
| 56 | esac | ||
| 57 | ]) | ||
| 58 | ;; | ||
| 59 | *) | ||
| 60 | gl_cv_func_realloc_posix="$gl_cv_func_malloc_posix" | ||
| 61 | ;; | ||
| 62 | esac | ||
| 63 | ]) | ||
| 64 | case "$gl_cv_func_realloc_posix" in | ||
| 65 | *yes) | ||
| 66 | AC_DEFINE([HAVE_REALLOC_POSIX], [1], | ||
| 67 | [Define if realloc sets errno on allocation failure.]) | ||
| 68 | ;; | ||
| 69 | *) | ||
| 70 | REPLACE_REALLOC_FOR_REALLOC_POSIX=1 | ||
| 71 | ;; | ||
| 72 | esac | ||
| 73 | AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED]) | ||
| 74 | if test "$gl_cv_func_realloc_sanitize" != no; then | ||
| 61 | REPLACE_REALLOC_FOR_REALLOC_POSIX=1 | 75 | REPLACE_REALLOC_FOR_REALLOC_POSIX=1 |
| 76 | AC_DEFINE([NEED_SANITIZED_REALLOC], [1], | ||
| 77 | [Define to 1 if realloc should abort upon undefined behaviour.]) | ||
| 62 | fi | 78 | fi |
| 63 | ]) | 79 | ]) |
| 80 | |||
| 81 | # gl_FUNC_REALLOC_0_NONNULL | ||
| 82 | # ------------------------- | ||
| 83 | # Replace realloc if realloc (..., 0) returns null. | ||
| 84 | # Modules that use this macro directly or indirectly should depend | ||
| 85 | # on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined | ||
| 86 | # before this macro gets invoked. This helps if !(__VEC__ || __AIXVEC), | ||
| 87 | # and doesn't hurt otherwise. | ||
| 88 | AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL], | ||
| 89 | [ | ||
| 90 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
| 91 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | ||
| 92 | AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) | ||
| 93 | AC_CACHE_CHECK([whether realloc (..., 0) returns nonnull], | ||
| 94 | [gl_cv_func_realloc_0_nonnull], | ||
| 95 | [AC_RUN_IFELSE( | ||
| 96 | [AC_LANG_PROGRAM( | ||
| 97 | [[#include <stdlib.h> | ||
| 98 | /* Use prealloc to test; "volatile" prevents the compiler | ||
| 99 | from optimizing the realloc call away. */ | ||
| 100 | void *(*volatile prealloc) (void *, size_t) = realloc;]], | ||
| 101 | [[void *p = prealloc (0, 0); | ||
| 102 | int result = !p; | ||
| 103 | p = prealloc (p, 0); | ||
| 104 | result |= !p; | ||
| 105 | free (p); | ||
| 106 | return result;]])], | ||
| 107 | [gl_cv_func_realloc_0_nonnull=yes], | ||
| 108 | [gl_cv_func_realloc_0_nonnull=no], | ||
| 109 | [AS_CASE([$host_os], | ||
| 110 | [# Guess yes on platforms where we know the result. | ||
| 111 | freebsd* | netbsd* | openbsd* | darwin* | bitrig* \ | ||
| 112 | | *-musl* | midipix* | midnightbsd* \ | ||
| 113 | | hpux* | solaris* | cygwin*], | ||
| 114 | [gl_cv_func_realloc_0_nonnull="guessing yes"], | ||
| 115 | [# Guess as follows if we don't know. | ||
| 116 | gl_cv_func_realloc_0_nonnull=$gl_cross_guess_normal])])]) | ||
| 117 | AS_CASE([$gl_cv_func_realloc_0_nonnull], | ||
| 118 | [*yes], | ||
| 119 | [AC_DEFINE([HAVE_REALLOC_0_NONNULL], [1], | ||
| 120 | [Define to 1 if realloc (..., 0) returns nonnull.])], | ||
| 121 | [AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host], | ||
| 122 | [yes,*,*,* | *,no,*,* | *,*,*no,* | *,*,*,aarch64c-*-freebsd*], | ||
| 123 | [REPLACE_REALLOC_FOR_REALLOC_POSIX=1], | ||
| 124 | [# Optimize for common case of glibc 2.1.1+ and compatibles. | ||
| 125 | REPLACE_REALLOC_FOR_REALLOC_POSIX=2])]) | ||
| 126 | ]) | ||
diff --git a/gl/m4/reallocarray.m4 b/gl/m4/reallocarray.m4 index 1607b7a9..3970d9e1 100644 --- a/gl/m4/reallocarray.m4 +++ b/gl/m4/reallocarray.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # reallocarray.m4 serial 3 | 1 | # reallocarray.m4 |
| 2 | dnl Copyright (C) 2017-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_REALLOCARRAY], | 9 | AC_DEFUN([gl_FUNC_REALLOCARRAY], |
| 8 | [ | 10 | [ |
| @@ -11,11 +13,21 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY], | |||
| 11 | 13 | ||
| 12 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 14 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 13 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) | 15 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) |
| 14 | AC_CHECK_FUNCS([reallocarray]) | 16 | AC_REQUIRE([gl_FUNC_REALLOC_0_NONNULL]) |
| 17 | gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]]) | ||
| 15 | if test "$ac_cv_func_reallocarray" = no; then | 18 | if test "$ac_cv_func_reallocarray" = no; then |
| 16 | HAVE_REALLOCARRAY=0 | 19 | HAVE_REALLOCARRAY=0 |
| 17 | elif test "$gl_cv_malloc_ptrdiff" = no; then | 20 | case "$gl_cv_onwards_func_reallocarray" in |
| 18 | REPLACE_REALLOCARRAY=1 | 21 | future*) REPLACE_REALLOCARRAY=1 ;; |
| 22 | esac | ||
| 23 | else | ||
| 24 | if test "$gl_cv_malloc_ptrdiff" = no; then | ||
| 25 | REPLACE_REALLOCARRAY=1 | ||
| 26 | fi | ||
| 27 | case "$gl_cv_func_realloc_0_nonnull" in | ||
| 28 | *yes) ;; | ||
| 29 | *) REPLACE_REALLOCARRAY=1 ;; | ||
| 30 | esac | ||
| 19 | fi | 31 | fi |
| 20 | ]) | 32 | ]) |
| 21 | 33 | ||
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index c89a1432..49a8059f 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | # serial 73 | 1 | # regex.m4 |
| 2 | 2 | # serial 81 | |
| 3 | # Copyright (C) 1996-2001, 2003-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc. |
| 4 | # | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | # with or without modifications, as long as this notice is preserved. | 7 | dnl This file is offered as-is, without any warranty. |
| 8 | 8 | ||
| 9 | dnl Initially derived from code in GNU grep. | 9 | dnl Initially derived from code in GNU grep. |
| 10 | dnl Mostly written by Jim Meyering. | 10 | dnl Mostly written by Jim Meyering. |
| @@ -15,7 +15,7 @@ AC_DEFUN([gl_REGEX], | |||
| 15 | [ | 15 | [ |
| 16 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 16 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 17 | AC_ARG_WITH([included-regex], | 17 | AC_ARG_WITH([included-regex], |
| 18 | [AS_HELP_STRING([--without-included-regex], | 18 | [AS_HELP_STRING([[--without-included-regex]], |
| 19 | [don't compile regex; this is the default on systems | 19 | [don't compile regex; this is the default on systems |
| 20 | with recent-enough versions of the GNU C Library | 20 | with recent-enough versions of the GNU C Library |
| 21 | (use with caution on other systems).])]) | 21 | (use with caution on other systems).])]) |
| @@ -40,19 +40,24 @@ AC_DEFUN([gl_REGEX], | |||
| 40 | #include <limits.h> | 40 | #include <limits.h> |
| 41 | #include <string.h> | 41 | #include <string.h> |
| 42 | 42 | ||
| 43 | #if defined M_CHECK_ACTION || HAVE_DECL_ALARM | 43 | #if HAVE_MALLOC_H |
| 44 | # include <signal.h> | 44 | # include <malloc.h> /* defines M_CHECK_ACTION on glibc */ |
| 45 | # include <unistd.h> | ||
| 46 | #endif | 45 | #endif |
| 47 | 46 | ||
| 48 | #if HAVE_MALLOC_H | 47 | #if defined __HAIKU__ || defined M_CHECK_ACTION || HAVE_DECL_ALARM |
| 49 | # include <malloc.h> | 48 | # include <signal.h> |
| 49 | # include <unistd.h> | ||
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
| 52 | #ifdef M_CHECK_ACTION | 52 | #if defined __HAIKU__ || defined M_CHECK_ACTION |
| 53 | /* Exit with distinguishable exit code. */ | 53 | /* Exit with distinguishable exit code. */ |
| 54 | static void sigabrt_no_core (int sig) { raise (SIGTERM); } | 54 | static void sigabrt_no_core (int sig) { raise (SIGTERM); } |
| 55 | #endif | 55 | #endif |
| 56 | |||
| 57 | /* There is no need to check whether RE_SYNTAX_EMACS is | ||
| 58 | (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to | ||
| 59 | Emacs 21 (2001) and later, because Gnulib's lib/regex.h | ||
| 60 | is always used and has this value. */ | ||
| 56 | ]], | 61 | ]], |
| 57 | [[int result = 0; | 62 | [[int result = 0; |
| 58 | static struct re_pattern_buffer regex; | 63 | static struct re_pattern_buffer regex; |
| @@ -68,6 +73,9 @@ AC_DEFUN([gl_REGEX], | |||
| 68 | signal (SIGALRM, SIG_DFL); | 73 | signal (SIGALRM, SIG_DFL); |
| 69 | alarm (2); | 74 | alarm (2); |
| 70 | #endif | 75 | #endif |
| 76 | #ifdef __HAIKU__ | ||
| 77 | signal (SIGABRT, sigabrt_no_core); | ||
| 78 | #endif | ||
| 71 | #ifdef M_CHECK_ACTION | 79 | #ifdef M_CHECK_ACTION |
| 72 | signal (SIGABRT, sigabrt_no_core); | 80 | signal (SIGABRT, sigabrt_no_core); |
| 73 | mallopt (M_CHECK_ACTION, 2); | 81 | mallopt (M_CHECK_ACTION, 2); |
| @@ -327,10 +335,10 @@ AC_DEFUN([gl_REGEX], | |||
| 327 | [gl_cv_func_re_compile_pattern_working=yes], | 335 | [gl_cv_func_re_compile_pattern_working=yes], |
| 328 | [gl_cv_func_re_compile_pattern_working=no], | 336 | [gl_cv_func_re_compile_pattern_working=no], |
| 329 | [case "$host_os" in | 337 | [case "$host_os" in |
| 330 | # Guess no on native Windows. | 338 | # Guess no on native Windows. |
| 331 | mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; | 339 | mingw* | windows*) gl_cv_func_re_compile_pattern_working="guessing no" ;; |
| 332 | # Otherwise obey --enable-cross-guesses. | 340 | # Otherwise obey --enable-cross-guesses. |
| 333 | *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; | 341 | *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; |
| 334 | esac | 342 | esac |
| 335 | ]) | 343 | ]) |
| 336 | ]) | 344 | ]) |
| @@ -389,7 +397,6 @@ AC_DEFUN([gl_PREREQ_REGEX], | |||
| 389 | AC_REQUIRE([AC_C_INLINE]) | 397 | AC_REQUIRE([AC_C_INLINE]) |
| 390 | AC_REQUIRE([AC_C_RESTRICT]) | 398 | AC_REQUIRE([AC_C_RESTRICT]) |
| 391 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | 399 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) |
| 392 | AC_REQUIRE([gl_EEMALLOC]) | ||
| 393 | AC_CHECK_HEADERS([libintl.h]) | 400 | AC_CHECK_HEADERS([libintl.h]) |
| 394 | AC_CHECK_FUNCS_ONCE([isblank iswctype]) | 401 | AC_CHECK_FUNCS_ONCE([isblank iswctype]) |
| 395 | AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) | 402 | AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) |
diff --git a/gl/m4/sched_h.m4 b/gl/m4/sched_h.m4 new file mode 100644 index 00000000..1ffd465f --- /dev/null +++ b/gl/m4/sched_h.m4 | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | # sched_h.m4 | ||
| 2 | # serial 16 | ||
| 3 | dnl Copyright (C) 2008-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 | dnl Written by Bruno Haible. | ||
| 10 | |||
| 11 | AC_DEFUN_ONCE([gl_SCHED_H], | ||
| 12 | [ | ||
| 13 | dnl Ensure to expand the default settings once only, before all statements | ||
| 14 | dnl that occur in other macros. | ||
| 15 | AC_REQUIRE([gl_SCHED_H_DEFAULTS]) | ||
| 16 | |||
| 17 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 18 | |||
| 19 | AC_REQUIRE([gl_CHECK_HEADER_SYS_CDEFS_H]) | ||
| 20 | |||
| 21 | AC_CHECK_HEADERS([sched.h], [], [], | ||
| 22 | [[#if HAVE_SYS_CDEFS_H | ||
| 23 | #include <sys/cdefs.h> | ||
| 24 | #endif | ||
| 25 | ]]) | ||
| 26 | gl_NEXT_HEADERS([sched.h]) | ||
| 27 | |||
| 28 | if test "$ac_cv_header_sched_h" = yes; then | ||
| 29 | HAVE_SCHED_H=1 | ||
| 30 | else | ||
| 31 | HAVE_SCHED_H=0 | ||
| 32 | fi | ||
| 33 | AC_SUBST([HAVE_SCHED_H]) | ||
| 34 | |||
| 35 | if test "$HAVE_SCHED_H" = 1; then | ||
| 36 | AC_CHECK_TYPE([struct sched_param], | ||
| 37 | [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], | ||
| 38 | [[#if HAVE_SYS_CDEFS_H | ||
| 39 | #include <sys/cdefs.h> | ||
| 40 | #endif | ||
| 41 | #include <sched.h> | ||
| 42 | ]]) | ||
| 43 | else | ||
| 44 | HAVE_STRUCT_SCHED_PARAM=0 | ||
| 45 | case "$host_os" in | ||
| 46 | os2*) | ||
| 47 | dnl On OS/2 kLIBC, struct sched_param is in spawn.h. | ||
| 48 | AC_CHECK_TYPE([struct sched_param], | ||
| 49 | [HAVE_STRUCT_SCHED_PARAM=1], [], | ||
| 50 | [#include <spawn.h>]) | ||
| 51 | ;; | ||
| 52 | vms) | ||
| 53 | dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h. | ||
| 54 | AC_CHECK_TYPE([struct sched_param], | ||
| 55 | [HAVE_STRUCT_SCHED_PARAM=1], [], | ||
| 56 | [#include <pthread.h>]) | ||
| 57 | ;; | ||
| 58 | esac | ||
| 59 | fi | ||
| 60 | AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) | ||
| 61 | |||
| 62 | dnl Ensure the type pid_t gets defined. | ||
| 63 | AC_REQUIRE([AC_TYPE_PID_T]) | ||
| 64 | |||
| 65 | dnl Check for declarations of anything we want to poison if the | ||
| 66 | dnl corresponding gnulib module is not in use, if it is not common | ||
| 67 | dnl enough to be declared everywhere. | ||
| 68 | gl_WARN_ON_USE_PREPARE([[#include <sched.h> | ||
| 69 | ]], [sched_yield]) | ||
| 70 | ]) | ||
| 71 | |||
| 72 | # gl_SCHED_MODULE_INDICATOR([modulename]) | ||
| 73 | # sets the shell variable that indicates the presence of the given module | ||
| 74 | # to a C preprocessor expression that will evaluate to 1. | ||
| 75 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 76 | AC_DEFUN([gl_SCHED_MODULE_INDICATOR], | ||
| 77 | [ | ||
| 78 | dnl Ensure to expand the default settings once only. | ||
| 79 | gl_SCHED_H_REQUIRE_DEFAULTS | ||
| 80 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 81 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 82 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 83 | ]) | ||
| 84 | |||
| 85 | # Initializes the default values for AC_SUBSTed shell variables. | ||
| 86 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
| 87 | # outside of macros or in macros that are not AC_REQUIREd. | ||
| 88 | AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS], | ||
| 89 | [ | ||
| 90 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [ | ||
| 91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD]) | ||
| 92 | ]) | ||
| 93 | m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS]) | ||
| 94 | AC_REQUIRE([gl_SCHED_H_DEFAULTS]) | ||
| 95 | ]) | ||
| 96 | |||
| 97 | AC_DEFUN([gl_SCHED_H_DEFAULTS], | ||
| 98 | [ | ||
| 99 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 100 | HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD]) | ||
| 101 | REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD]) | ||
| 102 | ]) | ||
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 0f35b8b8..ba6ebd1d 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # servent.m4 serial 4 | 1 | # servent.m4 |
| 2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_SERVENT], | 9 | AC_DEFUN([gl_SERVENT], |
| 8 | [ | 10 | [ |
| @@ -28,7 +30,7 @@ AC_DEFUN([gl_SERVENT], | |||
| 28 | AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32], | 30 | AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32], |
| 29 | [gl_cv_w32_getservbyname], | 31 | [gl_cv_w32_getservbyname], |
| 30 | [gl_cv_w32_getservbyname=no | 32 | [gl_cv_w32_getservbyname=no |
| 31 | gl_save_LIBS="$LIBS" | 33 | gl_saved_LIBS="$LIBS" |
| 32 | LIBS="$LIBS -lws2_32" | 34 | LIBS="$LIBS -lws2_32" |
| 33 | AC_LINK_IFELSE( | 35 | AC_LINK_IFELSE( |
| 34 | [AC_LANG_PROGRAM( | 36 | [AC_LANG_PROGRAM( |
| @@ -40,7 +42,7 @@ AC_DEFUN([gl_SERVENT], | |||
| 40 | ]], | 42 | ]], |
| 41 | [[getservbyname(NULL,NULL);]])], | 43 | [[getservbyname(NULL,NULL);]])], |
| 42 | [gl_cv_w32_getservbyname=yes]) | 44 | [gl_cv_w32_getservbyname=yes]) |
| 43 | LIBS="$gl_save_LIBS" | 45 | LIBS="$gl_saved_LIBS" |
| 44 | ]) | 46 | ]) |
| 45 | if test "$gl_cv_w32_getservbyname" = "yes"; then | 47 | if test "$gl_cv_w32_getservbyname" = "yes"; then |
| 46 | SERVENT_LIB="-lws2_32" | 48 | SERVENT_LIB="-lws2_32" |
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4 index 16f9eb55..727e35af 100644 --- a/gl/m4/setenv.m4 +++ b/gl/m4/setenv.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # setenv.m4 serial 30 | 1 | # setenv.m4 |
| 2 | dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. | 2 | # serial 35 |
| 3 | dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_SETENV], | 9 | AC_DEFUN([gl_FUNC_SETENV], |
| 8 | [ | 10 | [ |
| @@ -35,12 +37,12 @@ AC_DEFUN([gl_FUNC_SETENV], | |||
| 35 | ]])], | 37 | ]])], |
| 36 | [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], | 38 | [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], |
| 37 | [case "$host_os" in | 39 | [case "$host_os" in |
| 38 | # Guess yes on glibc systems. | 40 | # Guess yes on glibc systems. |
| 39 | *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; | 41 | *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; |
| 40 | # Guess yes on musl systems. | 42 | # Guess yes on musl systems. |
| 41 | *-musl*) gl_cv_func_setenv_works="guessing yes" ;; | 43 | *-musl* | midipix*) gl_cv_func_setenv_works="guessing yes" ;; |
| 42 | # If we don't know, obey --enable-cross-guesses. | 44 | # If we don't know, obey --enable-cross-guesses. |
| 43 | *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; | 45 | *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; |
| 44 | esac | 46 | esac |
| 45 | ])]) | 47 | ])]) |
| 46 | case "$gl_cv_func_setenv_works" in | 48 | case "$gl_cv_func_setenv_works" in |
| @@ -151,11 +153,11 @@ int unsetenv (const char *name); | |||
| 151 | # Prerequisites of lib/setenv.c. | 153 | # Prerequisites of lib/setenv.c. |
| 152 | AC_DEFUN([gl_PREREQ_SETENV], | 154 | AC_DEFUN([gl_PREREQ_SETENV], |
| 153 | [ | 155 | [ |
| 154 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
| 155 | AC_REQUIRE([gl_ENVIRON]) | 156 | AC_REQUIRE([gl_ENVIRON]) |
| 156 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 157 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
| 157 | AC_CHECK_HEADERS([search.h]) | 158 | AC_CHECK_HEADERS([search.h]) |
| 158 | AC_CHECK_FUNCS([tsearch]) | 159 | AC_CHECK_DECLS_ONCE([_putenv]) |
| 160 | gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) | ||
| 159 | ]) | 161 | ]) |
| 160 | 162 | ||
| 161 | # Prerequisites of lib/unsetenv.c. | 163 | # Prerequisites of lib/unsetenv.c. |
| @@ -163,4 +165,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV], | |||
| 163 | [ | 165 | [ |
| 164 | AC_REQUIRE([gl_ENVIRON]) | 166 | AC_REQUIRE([gl_ENVIRON]) |
| 165 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 167 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
| 168 | AC_CHECK_DECLS_ONCE([_putenv]) | ||
| 166 | ]) | 169 | ]) |
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4 index 032119d0..3c8b693e 100644 --- a/gl/m4/setlocale_null.m4 +++ b/gl/m4/setlocale_null.m4 | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | # setlocale_null.m4 serial 5 | 1 | # setlocale_null.m4 |
| 2 | dnl Copyright (C) 2019-2023 Free Software Foundation, Inc. | 2 | # serial 10 |
| 3 | dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | 9 | AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([AC_CANONICAL_HOST]) | 11 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 10 | AC_REQUIRE([gl_PTHREADLIB]) | 12 | AC_REQUIRE([gl_PTHREADLIB]) |
| @@ -13,11 +15,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
| 13 | AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], | 15 | AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], |
| 14 | [gl_cv_func_setlocale_null_all_mtsafe], | 16 | [gl_cv_func_setlocale_null_all_mtsafe], |
| 15 | [case "$host_os" in | 17 | [case "$host_os" in |
| 16 | # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. | 18 | # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku. |
| 17 | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) | 19 | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku*) |
| 18 | gl_cv_func_setlocale_null_all_mtsafe=no ;; | 20 | gl_cv_func_setlocale_null_all_mtsafe=no ;; |
| 21 | # Guess no on Cygwin < 3.4.6. | ||
| 22 | cygwin*) | ||
| 23 | AC_EGREP_CPP([Lucky user], | ||
| 24 | [ | ||
| 25 | #if defined __CYGWIN__ | ||
| 26 | #include <cygwin/version.h> | ||
| 27 | #if CYGWIN_VERSION_DLL_COMBINED >= CYGWIN_VERSION_DLL_MAKE_COMBINED (3004, 6) | ||
| 28 | Lucky user | ||
| 29 | #endif | ||
| 30 | #endif | ||
| 31 | ], | ||
| 32 | [gl_cv_func_setlocale_null_all_mtsafe=yes], | ||
| 33 | [gl_cv_func_setlocale_null_all_mtsafe=no]) | ||
| 34 | ;; | ||
| 19 | # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. | 35 | # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. |
| 20 | *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) | 36 | *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*) |
| 21 | gl_cv_func_setlocale_null_all_mtsafe=yes ;; | 37 | gl_cv_func_setlocale_null_all_mtsafe=yes ;; |
| 22 | # If we don't know, obey --enable-cross-guesses. | 38 | # If we don't know, obey --enable-cross-guesses. |
| 23 | *) | 39 | *) |
| @@ -26,7 +42,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
| 26 | ]) | 42 | ]) |
| 27 | dnl On platforms without multithreading, there is no issue. | 43 | dnl On platforms without multithreading, there is no issue. |
| 28 | case "$host_os" in | 44 | case "$host_os" in |
| 29 | mingw*) ;; | 45 | mingw* | windows*) ;; |
| 30 | *) | 46 | *) |
| 31 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | 47 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then |
| 32 | gl_cv_func_setlocale_null_all_mtsafe="trivially yes" | 48 | gl_cv_func_setlocale_null_all_mtsafe="trivially yes" |
| @@ -48,7 +64,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
| 48 | openbsd* | aix*) | 64 | openbsd* | aix*) |
| 49 | gl_cv_func_setlocale_null_one_mtsafe=no ;; | 65 | gl_cv_func_setlocale_null_one_mtsafe=no ;; |
| 50 | # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. | 66 | # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. |
| 51 | *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) | 67 | *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*) |
| 52 | gl_cv_func_setlocale_null_one_mtsafe=yes ;; | 68 | gl_cv_func_setlocale_null_one_mtsafe=yes ;; |
| 53 | # If we don't know, obey --enable-cross-guesses. | 69 | # If we don't know, obey --enable-cross-guesses. |
| 54 | *) | 70 | *) |
| @@ -57,7 +73,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
| 57 | ]) | 73 | ]) |
| 58 | dnl On platforms without multithreading, there is no issue. | 74 | dnl On platforms without multithreading, there is no issue. |
| 59 | case "$host_os" in | 75 | case "$host_os" in |
| 60 | mingw*) ;; | 76 | mingw* | windows*) ;; |
| 61 | *) | 77 | *) |
| 62 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | 78 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then |
| 63 | gl_cv_func_setlocale_null_one_mtsafe="trivially yes" | 79 | gl_cv_func_setlocale_null_one_mtsafe="trivially yes" |
| @@ -74,20 +90,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | |||
| 74 | dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. | 90 | dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. |
| 75 | if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then | 91 | if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then |
| 76 | case "$host_os" in | 92 | case "$host_os" in |
| 77 | mingw*) LIB_SETLOCALE_NULL= ;; | 93 | mingw* | windows*) |
| 94 | SETLOCALE_NULL_LIB= | ||
| 95 | ;; | ||
| 78 | *) | 96 | *) |
| 79 | gl_WEAK_SYMBOLS | 97 | gl_WEAK_SYMBOLS |
| 80 | case "$gl_cv_have_weak" in | 98 | case "$gl_cv_have_weak" in |
| 81 | *yes) LIB_SETLOCALE_NULL= ;; | 99 | *yes) SETLOCALE_NULL_LIB= ;; |
| 82 | *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; | 100 | *) SETLOCALE_NULL_LIB="$LIBPTHREAD" ;; |
| 83 | esac | 101 | esac |
| 84 | ;; | 102 | ;; |
| 85 | esac | 103 | esac |
| 86 | else | 104 | else |
| 87 | LIB_SETLOCALE_NULL= | 105 | SETLOCALE_NULL_LIB= |
| 88 | fi | 106 | fi |
| 89 | dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX | 107 | dnl SETLOCALE_NULL_LIB is expected to be '-pthread' or '-lpthread' on AIX |
| 90 | dnl with gcc or xlc, and empty otherwise. | 108 | dnl with gcc or xlc, and empty otherwise. |
| 109 | AC_SUBST([SETLOCALE_NULL_LIB]) | ||
| 110 | dnl For backward compatibility. | ||
| 111 | LIB_SETLOCALE_NULL="$SETLOCALE_NULL_LIB" | ||
| 91 | AC_SUBST([LIB_SETLOCALE_NULL]) | 112 | AC_SUBST([LIB_SETLOCALE_NULL]) |
| 92 | ]) | 113 | ]) |
| 93 | 114 | ||
diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4 index 4d1d1dda..30e8deeb 100644 --- a/gl/m4/sha256.m4 +++ b/gl/m4/sha256.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sha256.m4 serial 8 | 1 | # sha256.m4 |
| 2 | dnl Copyright (C) 2005, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 8 |
| 3 | dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_SHA256], | 9 | AC_DEFUN([gl_SHA256], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index 0763366d..b0460d45 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # size_max.m4 serial 12 | 1 | # size_max.m4 |
| 2 | dnl Copyright (C) 2003, 2005-2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
| 3 | dnl Copyright (C) 2003, 2005-2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 4b5fbdbf..2c50cee9 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # snprintf.m4 serial 7 | 1 | # snprintf.m4 |
| 2 | dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, | 9 | dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, |
| 8 | dnl but defers to any gnulib snprintf replacements. Therefore, gnulib | 10 | dnl but defers to any gnulib snprintf replacements. Therefore, gnulib |
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 index a556af1e..e3509f81 100644 --- a/gl/m4/socketlib.m4 +++ b/gl/m4/socketlib.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # socketlib.m4 serial 3 | 1 | # socketlib.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 4 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl gl_SOCKETLIB | 9 | dnl gl_SOCKETLIB |
| 8 | dnl Determines the library to use for socket functions. | 10 | dnl Determines the library to use for socket functions. |
| @@ -18,7 +20,7 @@ AC_DEFUN([gl_SOCKETLIB], | |||
| 18 | dnl defined through -lws2_32), we need to call it. | 20 | dnl defined through -lws2_32), we need to call it. |
| 19 | AC_CACHE_CHECK([for WSAStartup], | 21 | AC_CACHE_CHECK([for WSAStartup], |
| 20 | [gl_cv_func_wsastartup], [ | 22 | [gl_cv_func_wsastartup], [ |
| 21 | gl_save_LIBS="$LIBS" | 23 | gl_saved_LIBS="$LIBS" |
| 22 | LIBS="$LIBS -lws2_32" | 24 | LIBS="$LIBS -lws2_32" |
| 23 | AC_LINK_IFELSE( | 25 | AC_LINK_IFELSE( |
| 24 | [AC_LANG_PROGRAM([[ | 26 | [AC_LANG_PROGRAM([[ |
| @@ -33,7 +35,7 @@ AC_DEFUN([gl_SOCKETLIB], | |||
| 33 | ], | 35 | ], |
| 34 | [gl_cv_func_wsastartup=yes], | 36 | [gl_cv_func_wsastartup=yes], |
| 35 | [gl_cv_func_wsastartup=no]) | 37 | [gl_cv_func_wsastartup=no]) |
| 36 | LIBS="$gl_save_LIBS" | 38 | LIBS="$gl_saved_LIBS" |
| 37 | ]) | 39 | ]) |
| 38 | if test "$gl_cv_func_wsastartup" = "yes"; then | 40 | if test "$gl_cv_func_wsastartup" = "yes"; then |
| 39 | AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) | 41 | AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) |
| @@ -56,8 +58,8 @@ AC_DEFUN([gl_SOCKETLIB], | |||
| 56 | #endif | 58 | #endif |
| 57 | char setsockopt();]], [[setsockopt();]])], | 59 | char setsockopt();]], [[setsockopt();]])], |
| 58 | [], | 60 | [], |
| 59 | [gl_save_LIBS="$LIBS" | 61 | [gl_saved_LIBS="$LIBS" |
| 60 | LIBS="$gl_save_LIBS -lsocket" | 62 | LIBS="$gl_saved_LIBS -lsocket" |
| 61 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 63 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
| 62 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
| 63 | "C" | 65 | "C" |
| @@ -65,7 +67,7 @@ char setsockopt();]], [[setsockopt();]])], | |||
| 65 | char setsockopt();]], [[setsockopt();]])], | 67 | char setsockopt();]], [[setsockopt();]])], |
| 66 | [gl_cv_lib_socket="-lsocket"]) | 68 | [gl_cv_lib_socket="-lsocket"]) |
| 67 | if test -z "$gl_cv_lib_socket"; then | 69 | if test -z "$gl_cv_lib_socket"; then |
| 68 | LIBS="$gl_save_LIBS -lnetwork" | 70 | LIBS="$gl_saved_LIBS -lnetwork" |
| 69 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 71 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
| 70 | #ifdef __cplusplus | 72 | #ifdef __cplusplus |
| 71 | "C" | 73 | "C" |
| @@ -73,7 +75,7 @@ char setsockopt();]], [[setsockopt();]])], | |||
| 73 | char setsockopt();]], [[setsockopt();]])], | 75 | char setsockopt();]], [[setsockopt();]])], |
| 74 | [gl_cv_lib_socket="-lnetwork"]) | 76 | [gl_cv_lib_socket="-lnetwork"]) |
| 75 | if test -z "$gl_cv_lib_socket"; then | 77 | if test -z "$gl_cv_lib_socket"; then |
| 76 | LIBS="$gl_save_LIBS -lnet" | 78 | LIBS="$gl_saved_LIBS -lnet" |
| 77 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 79 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
| 78 | #ifdef __cplusplus | 80 | #ifdef __cplusplus |
| 79 | "C" | 81 | "C" |
| @@ -82,7 +84,7 @@ char setsockopt();]], [[setsockopt();]])], | |||
| 82 | [gl_cv_lib_socket="-lnet"]) | 84 | [gl_cv_lib_socket="-lnet"]) |
| 83 | fi | 85 | fi |
| 84 | fi | 86 | fi |
| 85 | LIBS="$gl_save_LIBS" | 87 | LIBS="$gl_saved_LIBS" |
| 86 | ]) | 88 | ]) |
| 87 | if test -z "$gl_cv_lib_socket"; then | 89 | if test -z "$gl_cv_lib_socket"; then |
| 88 | gl_cv_lib_socket="none needed" | 90 | gl_cv_lib_socket="none needed" |
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index ed9cb873..54f4dc79 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sockets.m4 serial 7 | 1 | # sockets.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_SOCKETS], | 9 | AC_DEFUN([gl_SOCKETS], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index 1c63a853..a8ac25b1 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # socklen.m4 serial 11 | 1 | # socklen.m4 |
| 2 | dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
| 3 | dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Albert Chin, Windows fixes from Simon Josefsson. | 9 | dnl From Albert Chin, Windows fixes from Simon Josefsson. |
| 8 | 10 | ||
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 6c6dc2f7..08ce843d 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sockpfaf.m4 serial 10 | 1 | # sockpfaf.m4 |
| 2 | dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
| 3 | dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) | 9 | dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) |
| 8 | dnl and some common address families (AF_INET, AF_INET6, ...). | 10 | dnl and some common address families (AF_INET, AF_INET6, ...). |
| @@ -63,6 +65,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], | |||
| 63 | AC_REQUIRE([gl_SYS_SOCKET_H]) | 65 | AC_REQUIRE([gl_SYS_SOCKET_H]) |
| 64 | AC_CHECK_HEADERS_ONCE([sys/un.h]) | 66 | AC_CHECK_HEADERS_ONCE([sys/un.h]) |
| 65 | 67 | ||
| 68 | dnl Windows versions released after 2017 may have support for AF_UNIX. | ||
| 69 | dnl Including it requires types from <winsock2.h> to be defined. | ||
| 70 | dnl <https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>. | ||
| 71 | if test "$ac_cv_header_winsock2_h" = yes; then | ||
| 72 | AC_CHECK_HEADERS([afunix.h], [], [], [#include <winsock2.h>]) | ||
| 73 | fi | ||
| 74 | |||
| 66 | AC_CACHE_CHECK([for UNIX domain sockets], | 75 | AC_CACHE_CHECK([for UNIX domain sockets], |
| 67 | [gl_cv_socket_unix], | 76 | [gl_cv_socket_unix], |
| 68 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | 77 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| @@ -74,6 +83,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], | |||
| 74 | #endif | 83 | #endif |
| 75 | #ifdef HAVE_WINSOCK2_H | 84 | #ifdef HAVE_WINSOCK2_H |
| 76 | #include <winsock2.h> | 85 | #include <winsock2.h> |
| 86 | #endif | ||
| 87 | #ifdef HAVE_AFUNIX_H | ||
| 88 | #include <afunix.h> | ||
| 77 | #endif]], | 89 | #endif]], |
| 78 | [[int x = AF_UNIX; struct sockaddr_un y; | 90 | [[int x = AF_UNIX; struct sockaddr_un y; |
| 79 | if (&x && &y) return 0;]])], | 91 | if (&x && &y) return 0;]])], |
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index 1c12c33e..a2ffd6fc 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 | |||
| @@ -1,23 +1,39 @@ | |||
| 1 | # ssize_t.m4 serial 5 (gettext-0.18.2) | 1 | # ssize_t.m4 |
| 2 | dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
| 3 | dnl Copyright (C) 2001-2003, 2006, 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | dnl Test whether ssize_t is defined. | 10 | dnl Define ssize_t if it does not already exist. |
| 9 | 11 | ||
| 10 | AC_DEFUN([gt_TYPE_SSIZE_T], | 12 | AC_DEFUN([gt_TYPE_SSIZE_T], |
| 11 | [ | 13 | [ |
| 12 | AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], | 14 | AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t], |
| 13 | [AC_COMPILE_IFELSE( | 15 | [AC_COMPILE_IFELSE( |
| 14 | [AC_LANG_PROGRAM( | 16 | [AC_LANG_PROGRAM( |
| 15 | [[#include <sys/types.h>]], | 17 | [[#include <sys/types.h>]], |
| 16 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); | 18 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); |
| 17 | return !x;]])], | 19 | return !x;]])], |
| 18 | [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) | 20 | [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])]) |
| 19 | if test $gt_cv_ssize_t = no; then | 21 | if test $gl_cv_ssize_t = no; then |
| 20 | AC_DEFINE([ssize_t], [int], | 22 | dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long', |
| 21 | [Define as a signed type of the same size as size_t.]) | 23 | dnl for consistency with the 64-bit size_t. |
| 24 | AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large], | ||
| 25 | [AC_COMPILE_IFELSE( | ||
| 26 | [AC_LANG_PROGRAM( | ||
| 27 | [[#include <sys/types.h> | ||
| 28 | typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1]; | ||
| 29 | ]])], | ||
| 30 | [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])]) | ||
| 31 | if test $gl_cv_size_t_large = yes; then | ||
| 32 | gl_def_ssize_t='long long' | ||
| 33 | else | ||
| 34 | gl_def_ssize_t='long' | ||
| 35 | fi | ||
| 36 | AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t], | ||
| 37 | [Define as a signed type of the same size as size_t.]) | ||
| 22 | fi | 38 | fi |
| 23 | ]) | 39 | ]) |
diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4 index 40993d57..4aa24e7f 100644 --- a/gl/m4/stat-time.m4 +++ b/gl/m4/stat-time.m4 | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | # Checks for stat-related time functions. | 1 | # stat-time.m4 |
| 2 | 2 | # serial 1 | |
| 3 | # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2023 Free Software | 3 | dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2025 Free Software |
| 4 | # Foundation, Inc. | 4 | dnl Foundation, Inc. |
| 5 | dnl This file is free software; the Free Software Foundation | ||
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 5 | 9 | ||
| 6 | # This file is free software; the Free Software Foundation | 10 | # Checks for stat-related time functions. |
| 7 | # gives unlimited permission to copy and/or distribute it, | ||
| 8 | # with or without modifications, as long as this notice is preserved. | ||
| 9 | 11 | ||
| 10 | dnl From Paul Eggert. | 12 | dnl From Paul Eggert. |
| 11 | 13 | ||
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4 index 4d241e27..66876305 100644 --- a/gl/m4/stat.m4 +++ b/gl/m4/stat.m4 | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | # serial 18 | 1 | # stat.m4 |
| 2 | 2 | # serial 21 | |
| 3 | # Copyright (C) 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. |
| 4 | # | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | # with or without modifications, as long as this notice is preserved. | 7 | dnl This file is offered as-is, without any warranty. |
| 8 | 8 | ||
| 9 | AC_DEFUN([gl_FUNC_STAT], | 9 | AC_DEFUN([gl_FUNC_STAT], |
| 10 | [ | 10 | [ |
| @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_STAT], | |||
| 12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | 12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) |
| 13 | AC_CHECK_FUNCS_ONCE([lstat]) | 13 | AC_CHECK_FUNCS_ONCE([lstat]) |
| 14 | case "$host_os" in | 14 | case "$host_os" in |
| 15 | mingw*) | 15 | mingw* | windows*) |
| 16 | dnl On this platform, the original stat() returns st_atime, st_mtime, | 16 | dnl On this platform, the original stat() returns st_atime, st_mtime, |
| 17 | dnl st_ctime values that are affected by the time zone. | 17 | dnl st_ctime values that are affected by the time zone. |
| 18 | REPLACE_STAT=1 | 18 | REPLACE_STAT=1 |
| @@ -45,6 +45,8 @@ AC_DEFUN([gl_FUNC_STAT], | |||
| 45 | [case "$host_os" in | 45 | [case "$host_os" in |
| 46 | # Guess yes on Linux systems. | 46 | # Guess yes on Linux systems. |
| 47 | linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; | 47 | linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; |
| 48 | # Guess yes on systems that emulate the Linux system calls. | ||
| 49 | midipix*) gl_cv_func_stat_file_slash="guessing yes" ;; | ||
| 48 | # Guess yes on glibc systems. | 50 | # Guess yes on glibc systems. |
| 49 | *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; | 51 | *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; |
| 50 | # If we don't know, obey --enable-cross-guesses. | 52 | # If we don't know, obey --enable-cross-guesses. |
| @@ -59,8 +61,8 @@ AC_DEFUN([gl_FUNC_STAT], | |||
| 59 | help when passed a file name with a trailing slash]);; | 61 | help when passed a file name with a trailing slash]);; |
| 60 | esac | 62 | esac |
| 61 | case $host_os in | 63 | case $host_os in |
| 62 | dnl Solaris stat can return a negative tv_nsec. | 64 | dnl macOS and Solaris stat can return a negative tv_nsec. |
| 63 | solaris*) | 65 | darwin* | solaris*) |
| 64 | REPLACE_FSTAT=1 ;; | 66 | REPLACE_FSTAT=1 ;; |
| 65 | esac | 67 | esac |
| 66 | ;; | 68 | ;; |
| @@ -78,7 +80,7 @@ AC_DEFUN([gl_PREREQ_STAT], [ | |||
| 78 | AC_DEFUN([gl_PREREQ_STAT_W32], [ | 80 | AC_DEFUN([gl_PREREQ_STAT_W32], [ |
| 79 | AC_REQUIRE([AC_CANONICAL_HOST]) | 81 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 80 | case "$host_os" in | 82 | case "$host_os" in |
| 81 | mingw*) | 83 | mingw* | windows*) |
| 82 | AC_CHECK_HEADERS([sdkddkver.h]) | 84 | AC_CHECK_HEADERS([sdkddkver.h]) |
| 83 | ;; | 85 | ;; |
| 84 | esac | 86 | esac |
diff --git a/gl/m4/std-gnu11.m4 b/gl/m4/std-gnu11.m4 index 4179470e..762764e0 100644 --- a/gl/m4/std-gnu11.m4 +++ b/gl/m4/std-gnu11.m4 | |||
| @@ -1,19 +1,27 @@ | |||
| 1 | # std-gnu11.m4 | ||
| 2 | # serial 3 | ||
| 3 | |||
| 1 | # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- | 4 | # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- |
| 2 | 5 | ||
| 6 | # The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us. | ||
| 7 | m4_ifndef([_AC_C_C23_OPTIONS], [ | ||
| 8 | |||
| 3 | # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 | 9 | # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 |
| 4 | # commit 017d5ddd82854911f0119691d91ea8a1438824d6 | 10 | # commit 017d5ddd82854911f0119691d91ea8a1438824d6 |
| 5 | # dated Sun Apr 3 13:57:17 2016 -0700 | 11 | # dated Sun Apr 3 13:57:17 2016 -0700 |
| 12 | # with minor changes to commentary. | ||
| 6 | # This implementation will be obsolete once we can assume Autoconf 2.70 | 13 | # This implementation will be obsolete once we can assume Autoconf 2.70 |
| 7 | # or later is installed everywhere a Gnulib program might be developed. | 14 | # or later is installed everywhere a Gnulib program might be developed. |
| 8 | 15 | ||
| 9 | m4_version_prereq([2.70], [], [ | 16 | m4_version_prereq([2.70], [], [ |
| 10 | 17 | ||
| 11 | 18 | ||
| 12 | # Copyright (C) 2001-2023 Free Software Foundation, Inc. | 19 | # Copyright (C) 2001-2025 Free Software Foundation, Inc. |
| 13 | 20 | ||
| 14 | # This program is free software; you can redistribute it and/or modify | 21 | # This file is part of Autoconf. This program is free |
| 15 | # it under the terms of the GNU General Public License as published by | 22 | # software; you can redistribute it and/or modify it under the |
| 16 | # the Free Software Foundation, either version 3 of the License, or | 23 | # terms of the GNU General Public License as published by the |
| 24 | # Free Software Foundation, either version 3 of the License, or | ||
| 17 | # (at your option) any later version. | 25 | # (at your option) any later version. |
| 18 | # | 26 | # |
| 19 | # This program is distributed in the hope that it will be useful, | 27 | # This program is distributed in the hope that it will be useful, |
| @@ -21,8 +29,15 @@ m4_version_prereq([2.70], [], [ | |||
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | # GNU General Public License for more details. | 30 | # GNU General Public License for more details. |
| 23 | # | 31 | # |
| 32 | # Under Section 7 of GPL version 3, you are granted additional | ||
| 33 | # permissions described in the Autoconf Configure Script Exception, | ||
| 34 | # version 3.0, as published by the Free Software Foundation. | ||
| 35 | # | ||
| 24 | # You should have received a copy of the GNU General Public License | 36 | # You should have received a copy of the GNU General Public License |
| 25 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | 37 | # and a copy of the Autoconf Configure Script Exception along with |
| 38 | # this program; see the files COPYINGv3 and COPYING.EXCEPTION | ||
| 39 | # respectively. If not, see <https://www.gnu.org/licenses/> and | ||
| 40 | # <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;f=COPYING.EXCEPTION>. | ||
| 26 | 41 | ||
| 27 | # Written by David MacKenzie, with help from | 42 | # Written by David MacKenzie, with help from |
| 28 | # Akim Demaille, Paul Eggert, | 43 | # Akim Demaille, Paul Eggert, |
| @@ -35,7 +50,7 @@ m4_version_prereq([2.70], [], [ | |||
| 35 | # COMPILER ... is a space separated list of C compilers to search for. | 50 | # COMPILER ... is a space separated list of C compilers to search for. |
| 36 | # This just gives the user an opportunity to specify an alternative | 51 | # This just gives the user an opportunity to specify an alternative |
| 37 | # search list for the C compiler. | 52 | # search list for the C compiler. |
| 38 | AC_DEFUN_ONCE([AC_PROG_CC], | 53 | AC_DEFUN([AC_PROG_CC], |
| 39 | [AC_LANG_PUSH(C)dnl | 54 | [AC_LANG_PUSH(C)dnl |
| 40 | AC_ARG_VAR([CC], [C compiler command])dnl | 55 | AC_ARG_VAR([CC], [C compiler command])dnl |
| 41 | AC_ARG_VAR([CFLAGS], [C compiler flags])dnl | 56 | AC_ARG_VAR([CFLAGS], [C compiler flags])dnl |
| @@ -827,3 +842,4 @@ dnl with extended modes being tried first. | |||
| 827 | 842 | ||
| 828 | 843 | ||
| 829 | ])# m4_version_prereq | 844 | ])# m4_version_prereq |
| 845 | ])# !_AC_C_C23_OPTIONS | ||
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4 index dc297175..885feafd 100644 --- a/gl/m4/stdalign.m4 +++ b/gl/m4/stdalign.m4 | |||
| @@ -1,20 +1,25 @@ | |||
| 1 | # Check for alignas and alignof that conform to C23. | 1 | # stdalign.m4 |
| 2 | 2 | # serial 3 | |
| 3 | dnl Copyright 2011-2023 Free Software Foundation, Inc. | 3 | dnl Copyright 2011-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | # Check for alignas and alignof that conform to C23. | ||
| 10 | |||
| 11 | dnl Written by Paul Eggert and Bruno Haible. | ||
| 7 | 12 | ||
| 8 | # Prepare for substituting <stdalign.h> if it is not supported. | 13 | # Prepare for substituting <stdalign.h> if it is not supported. |
| 9 | 14 | ||
| 10 | AC_DEFUN([gl_STDALIGN_H], | 15 | AC_DEFUN([gl_ALIGNASOF], |
| 11 | [ | 16 | [ |
| 12 | AC_CACHE_CHECK([for alignas and alignof], | 17 | AC_CACHE_CHECK([for alignas and alignof], |
| 13 | [gl_cv_header_working_stdalign_h], | 18 | [gl_cv_header_working_stdalign_h], |
| 14 | [gl_save_CFLAGS=$CFLAGS | 19 | [gl_saved_CFLAGS=$CFLAGS |
| 15 | for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do | 20 | for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do |
| 16 | AS_CASE([$gl_working], | 21 | AS_CASE([$gl_working], |
| 17 | [*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"]) | 22 | [*stdalign.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_STDALIGN_H"]) |
| 18 | AC_COMPILE_IFELSE( | 23 | AC_COMPILE_IFELSE( |
| 19 | [AC_LANG_PROGRAM( | 24 | [AC_LANG_PROGRAM( |
| 20 | [[#include <stdint.h> | 25 | [[#include <stdint.h> |
| @@ -54,85 +59,154 @@ AC_DEFUN([gl_STDALIGN_H], | |||
| 54 | [gl_cv_header_working_stdalign_h=$gl_working], | 59 | [gl_cv_header_working_stdalign_h=$gl_working], |
| 55 | [gl_cv_header_working_stdalign_h=no]) | 60 | [gl_cv_header_working_stdalign_h=no]) |
| 56 | 61 | ||
| 57 | CFLAGS=$gl_save_CFLAGS | 62 | CFLAGS=$gl_saved_CFLAGS |
| 58 | test "$gl_cv_header_working_stdalign_h" != no && break | 63 | test "$gl_cv_header_working_stdalign_h" != no && break |
| 59 | done]) | 64 | done]) |
| 60 | 65 | ||
| 61 | GL_GENERATE_STDALIGN_H=false | ||
| 62 | AS_CASE([$gl_cv_header_working_stdalign_h], | 66 | AS_CASE([$gl_cv_header_working_stdalign_h], |
| 63 | [no], | ||
| 64 | [GL_GENERATE_STDALIGN_H=true], | ||
| 65 | [yes*keyword*], | 67 | [yes*keyword*], |
| 66 | [AC_DEFINE([HAVE_C_ALIGNASOF], [1], | 68 | [AC_DEFINE([HAVE_C_ALIGNASOF], [1], |
| 67 | [Define to 1 if the alignas and alignof keywords work.])]) | 69 | [Define to 1 if the alignas and alignof keywords work.])]) |
| 68 | 70 | ||
| 69 | AC_CHECK_HEADERS_ONCE([stdalign.h]) | ||
| 70 | |||
| 71 | dnl The "zz" puts this toward config.h's end, to avoid potential | 71 | dnl The "zz" puts this toward config.h's end, to avoid potential |
| 72 | dnl collisions with other definitions. | 72 | dnl collisions with other definitions. |
| 73 | AH_VERBATIM([zzalignas], | 73 | AH_VERBATIM([zzalignas], |
| 74 | [#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof | 74 | [#if !defined HAVE_C_ALIGNASOF \ |
| 75 | # if HAVE_STDALIGN_H | 75 | && !(defined __cplusplus && 201103 <= __cplusplus) \ |
| 76 | && !defined alignof | ||
| 77 | # if defined HAVE_STDALIGN_H | ||
| 76 | # include <stdalign.h> | 78 | # include <stdalign.h> |
| 77 | # else | 79 | # endif |
| 78 | /* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */ | 80 | |
| 79 | # ifndef _GL_STDALIGN_H | 81 | /* ISO C23 alignas and alignof for platforms that lack it. |
| 80 | # define _GL_STDALIGN_H | 82 | |
| 81 | # undef _Alignas | 83 | References: |
| 82 | # undef _Alignof | 84 | ISO C23 (latest free draft |
| 83 | # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | 85 | <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf>) |
| 84 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | 86 | sections 6.5.3.4, 6.7.5, 7.15. |
| 85 | && !defined __clang__) \ | 87 | C++11 (latest free draft |
| 86 | || (defined __clang__ && __clang_major__ < 8)) | 88 | <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) |
| 87 | # ifdef __cplusplus | 89 | section 18.10. */ |
| 88 | # if (201103 <= __cplusplus || defined _MSC_VER) | 90 | |
| 89 | # define _Alignof(type) alignof (type) | 91 | /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment |
| 90 | # else | 92 | requirement of a structure member (i.e., slot or field) that is of |
| 91 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | 93 | type TYPE, as an integer constant expression. |
| 92 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) | 94 | |
| 93 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | 95 | This differs from GCC's and clang's __alignof__ operator, which can |
| 94 | # endif | 96 | yield a better-performing alignment for an object of that type. For |
| 97 | example, on x86 with GCC and on Linux/x86 with clang, | ||
| 98 | __alignof__ (double) and __alignof__ (long long) are 8, whereas | ||
| 99 | alignof (double) and alignof (long long) are 4 unless the option | ||
| 100 | '-malign-double' is used. | ||
| 101 | |||
| 102 | The result cannot be used as a value for an 'enum' constant, if you | ||
| 103 | want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
| 104 | |||
| 105 | /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 | ||
| 106 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. | ||
| 107 | clang versions < 8.0.0 have the same bug. | ||
| 108 | IBM XL C V16.1.0 cc (non-clang) has the same bug. */ | ||
| 109 | # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | ||
| 110 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | ||
| 111 | && !defined __clang__) \ | ||
| 112 | || (defined __clang__ && __clang_major__ < 8) \ | ||
| 113 | || defined __xlC__) | ||
| 114 | # undef/**/_Alignof | ||
| 115 | # ifdef __cplusplus | ||
| 116 | # if (201103 <= __cplusplus || defined _MSC_VER) | ||
| 117 | # define _Alignof(type) alignof (type) | ||
| 95 | # else | 118 | # else |
| 119 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | ||
| 96 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ | 120 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ |
| 97 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) | 121 | # define _Alignof(type) __builtin_offsetof (__alignof_helper<type>, __b) |
| 98 | # else | 122 | # else |
| 99 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) | 123 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) |
| 100 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
| 101 | # endif | 124 | # endif |
| 125 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
| 102 | # endif | 126 | # endif |
| 103 | # endif | 127 | # else |
| 104 | # if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) | 128 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ |
| 105 | # define alignof _Alignof | 129 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) |
| 106 | # endif | 130 | # else |
| 107 | # define __alignof_is_defined 1 | 131 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) |
| 108 | # if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | 132 | # define _GL_STDALIGN_NEEDS_STDDEF 1 |
| 109 | # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) | ||
| 110 | # define _Alignas(a) alignas (a) | ||
| 111 | # elif (!defined __attribute__ \ | ||
| 112 | && ((defined __APPLE__ && defined __MACH__ \ | ||
| 113 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
| 114 | : __GNUC__ && !defined __ibmxl__) \ | ||
| 115 | || (4 <= __clang_major__) \ | ||
| 116 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
| 117 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) | ||
| 118 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) | ||
| 119 | # elif 1300 <= _MSC_VER | ||
| 120 | # define _Alignas(a) __declspec (align (a)) | ||
| 121 | # endif | 133 | # endif |
| 122 | # endif | 134 | # endif |
| 123 | # if ((defined _Alignas \ | 135 | # endif |
| 124 | && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ | 136 | # if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) |
| 125 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | 137 | # undef/**/alignof |
| 126 | # define alignas _Alignas | 138 | # define alignof _Alignof |
| 127 | # endif | 139 | # endif |
| 128 | # if (defined alignas \ | 140 | |
| 129 | || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) | 141 | /* alignas (A), also known as _Alignas (A), aligns a variable or type |
| 130 | # define __alignas_is_defined 1 | 142 | to the alignment A, where A is an integer constant expression. For |
| 131 | # endif | 143 | example: |
| 132 | # if _GL_STDALIGN_NEEDS_STDDEF | 144 | |
| 133 | # include <stddef.h> | 145 | int alignas (8) foo; |
| 134 | # endif | 146 | struct s { int a; int alignas (8) bar; }; |
| 135 | # endif /* _GL_STDALIGN_H */ | 147 | |
| 148 | aligns the address of FOO and the offset of BAR to be multiples of 8. | ||
| 149 | |||
| 150 | A should be a power of two that is at least the type's alignment | ||
| 151 | and at most the implementation's alignment limit. This limit is | ||
| 152 | 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable | ||
| 153 | to MSVC through at least version 10.0, A should be an integer | ||
| 154 | constant, as MSVC does not support expressions such as 1 << 3. | ||
| 155 | To be portable to Sun C 5.11, do not align auto variables to | ||
| 156 | anything stricter than their default alignment. | ||
| 157 | |||
| 158 | The following C23 requirements are not supported here: | ||
| 159 | |||
| 160 | - If A is zero, alignas has no effect. | ||
| 161 | - alignas can be used multiple times; the strictest one wins. | ||
| 162 | - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). | ||
| 163 | |||
| 164 | */ | ||
| 165 | # if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | ||
| 166 | # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) | ||
| 167 | # define _Alignas(a) alignas (a) | ||
| 168 | # elif (!defined __attribute__ \ | ||
| 169 | && ((defined __APPLE__ && defined __MACH__ \ | ||
| 170 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
| 171 | : __GNUC__ && !defined __ibmxl__) \ | ||
| 172 | || (4 <= __clang_major__) \ | ||
| 173 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
| 174 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) | ||
| 175 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) | ||
| 176 | # elif 1300 <= _MSC_VER | ||
| 177 | # define _Alignas(a) __declspec (align (a)) | ||
| 178 | # endif | ||
| 179 | # endif | ||
| 180 | # if !defined HAVE_STDALIGN_H | ||
| 181 | # if ((defined _Alignas \ | ||
| 182 | && !(defined __cplusplus \ | ||
| 183 | && (201103 <= __cplusplus || defined _MSC_VER))) \ | ||
| 184 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__ \ | ||
| 185 | && !defined __xlC__)) | ||
| 186 | # define alignas _Alignas | ||
| 187 | # endif | ||
| 188 | # endif | ||
| 189 | |||
| 190 | # if defined _GL_STDALIGN_NEEDS_STDDEF | ||
| 191 | # include <stddef.h> | ||
| 136 | # endif | 192 | # endif |
| 137 | #endif]) | 193 | #endif]) |
| 138 | ]) | 194 | ]) |
| 195 | |||
| 196 | AC_DEFUN([gl_STDALIGN_H], | ||
| 197 | [ | ||
| 198 | AC_REQUIRE([gl_ALIGNASOF]) | ||
| 199 | if test "$gl_cv_header_working_stdalign_h" = no; then | ||
| 200 | GL_GENERATE_STDALIGN_H=true | ||
| 201 | else | ||
| 202 | GL_GENERATE_STDALIGN_H=false | ||
| 203 | fi | ||
| 204 | |||
| 205 | gl_CHECK_NEXT_HEADERS([stdalign.h]) | ||
| 206 | if test $ac_cv_header_stdalign_h = yes; then | ||
| 207 | HAVE_STDALIGN_H=1 | ||
| 208 | else | ||
| 209 | HAVE_STDALIGN_H=0 | ||
| 210 | fi | ||
| 211 | AC_SUBST([HAVE_STDALIGN_H]) | ||
| 212 | ]) | ||
diff --git a/gl/m4/stdckdint_h.m4 b/gl/m4/stdckdint_h.m4 new file mode 100644 index 00000000..d269faa5 --- /dev/null +++ b/gl/m4/stdckdint_h.m4 | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | # stdckdint_h.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright 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 | dnl Written by Collin Funk. | ||
| 10 | |||
| 11 | AC_DEFUN_ONCE([gl_STDCKDINT_H], | ||
| 12 | [ | ||
| 13 | gl_CHECK_NEXT_HEADERS([stdckdint.h]) | ||
| 14 | if test $ac_cv_header_stdckdint_h = yes; then | ||
| 15 | HAVE_STDCKDINT_H=1 | ||
| 16 | else | ||
| 17 | HAVE_STDCKDINT_H=0 | ||
| 18 | fi | ||
| 19 | AC_SUBST([HAVE_STDCKDINT_H]) | ||
| 20 | |||
| 21 | if test $HAVE_STDCKDINT_H = 1; then | ||
| 22 | AC_CACHE_CHECK([whether stdckdint.h can be included in C], | ||
| 23 | [gl_cv_header_c_stdckdint_h], | ||
| 24 | [AC_COMPILE_IFELSE( | ||
| 25 | [AC_LANG_PROGRAM( | ||
| 26 | [[#include <stdckdint.h> | ||
| 27 | ]])], | ||
| 28 | [gl_cv_header_c_stdckdint_h=yes], | ||
| 29 | [gl_cv_header_c_stdckdint_h=no])]) | ||
| 30 | if test $gl_cv_header_c_stdckdint_h = yes; then | ||
| 31 | HAVE_C_STDCKDINT_H=1 | ||
| 32 | AC_CACHE_CHECK([checking for an ISO C23 compliant stdckdint.h in C], | ||
| 33 | [gl_cv_header_c_stdckdint_h_works], | ||
| 34 | [AC_COMPILE_IFELSE( | ||
| 35 | [AC_LANG_PROGRAM( | ||
| 36 | [[#include <stdckdint.h> | ||
| 37 | ]], | ||
| 38 | [[int r; | ||
| 39 | int a = 1; | ||
| 40 | int b = 1; | ||
| 41 | return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) | ||
| 42 | || ckd_mul (&r, a, b)); | ||
| 43 | ]])], | ||
| 44 | [gl_cv_header_c_stdckdint_h_works=yes], | ||
| 45 | [gl_cv_header_c_stdckdint_h_works=no])]) | ||
| 46 | if test $gl_cv_header_c_stdckdint_h_works = yes; then | ||
| 47 | HAVE_WORKING_C_STDCKDINT_H=1 | ||
| 48 | else | ||
| 49 | HAVE_WORKING_C_STDCKDINT_H=0 | ||
| 50 | fi | ||
| 51 | else | ||
| 52 | HAVE_C_STDCKDINT_H=0 | ||
| 53 | HAVE_WORKING_C_STDCKDINT_H=0 | ||
| 54 | fi | ||
| 55 | if test "$CXX" != no; then | ||
| 56 | AC_CACHE_CHECK([whether stdckdint.h can be included in C++], | ||
| 57 | [gl_cv_header_cxx_stdckdint_h], | ||
| 58 | [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to | ||
| 59 | dnl an autoconf bug <https://savannah.gnu.org/support/?110294>. | ||
| 60 | cat > conftest.cpp <<\EOF | ||
| 61 | #include <stdckdint.h> | ||
| 62 | EOF | ||
| 63 | gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" | ||
| 64 | if AC_TRY_EVAL([gl_command]); then | ||
| 65 | gl_cv_header_cxx_stdckdint_h=yes | ||
| 66 | else | ||
| 67 | gl_cv_header_cxx_stdckdint_h=no | ||
| 68 | fi | ||
| 69 | rm -fr conftest* | ||
| 70 | ]) | ||
| 71 | if test $gl_cv_header_cxx_stdckdint_h = yes; then | ||
| 72 | HAVE_CXX_STDCKDINT_H=1 | ||
| 73 | AC_CACHE_CHECK([checking for an ISO C++26 compliant stdckdint.h in C++], | ||
| 74 | [gl_cv_header_cxx_stdckdint_h_works], | ||
| 75 | [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to | ||
| 76 | dnl an autoconf bug <https://savannah.gnu.org/support/?110294>. | ||
| 77 | cat > conftest.cpp <<\EOF | ||
| 78 | #include <stdckdint.h> | ||
| 79 | int | ||
| 80 | main (void) | ||
| 81 | { | ||
| 82 | int r; | ||
| 83 | int a = 1; | ||
| 84 | int b = 1; | ||
| 85 | return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) || ckd_mul (&r, a, b)); | ||
| 86 | } | ||
| 87 | EOF | ||
| 88 | gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" | ||
| 89 | if AC_TRY_EVAL([gl_command]); then | ||
| 90 | gl_cv_header_cxx_stdckdint_h_works=yes | ||
| 91 | else | ||
| 92 | gl_cv_header_cxx_stdckdint_h_works=no | ||
| 93 | fi | ||
| 94 | rm -fr conftest* | ||
| 95 | ]) | ||
| 96 | if test $gl_cv_header_cxx_stdckdint_h_works = yes; then | ||
| 97 | HAVE_WORKING_CXX_STDCKDINT_H=1 | ||
| 98 | else | ||
| 99 | HAVE_WORKING_CXX_STDCKDINT_H=0 | ||
| 100 | fi | ||
| 101 | else | ||
| 102 | HAVE_CXX_STDCKDINT_H=0 | ||
| 103 | HAVE_WORKING_CXX_STDCKDINT_H=0 | ||
| 104 | fi | ||
| 105 | fi | ||
| 106 | else | ||
| 107 | HAVE_C_STDCKDINT_H=0 | ||
| 108 | HAVE_WORKING_C_STDCKDINT_H=0 | ||
| 109 | HAVE_CXX_STDCKDINT_H=0 | ||
| 110 | HAVE_WORKING_CXX_STDCKDINT_H=0 | ||
| 111 | fi | ||
| 112 | AC_SUBST([HAVE_C_STDCKDINT_H]) | ||
| 113 | AC_SUBST([HAVE_WORKING_C_STDCKDINT_H]) | ||
| 114 | AC_SUBST([HAVE_CXX_STDCKDINT_H]) | ||
| 115 | AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H]) | ||
| 116 | |||
| 117 | if test "$CXX" != no; then | ||
| 118 | dnl We might need the header for C or C++. | ||
| 119 | if test $HAVE_C_STDCKDINT_H = 1 \ | ||
| 120 | && test $HAVE_WORKING_C_STDCKDINT_H = 1 \ | ||
| 121 | && test $HAVE_CXX_STDCKDINT_H = 1 \ | ||
| 122 | && test $HAVE_WORKING_CXX_STDCKDINT_H = 1; then | ||
| 123 | GL_GENERATE_STDCKDINT_H=false | ||
| 124 | else | ||
| 125 | GL_GENERATE_STDCKDINT_H=true | ||
| 126 | fi | ||
| 127 | else | ||
| 128 | dnl We don't care about C++ here. | ||
| 129 | if test $HAVE_C_STDCKDINT_H = 1 \ | ||
| 130 | && test $HAVE_WORKING_C_STDCKDINT_H = 1; then | ||
| 131 | GL_GENERATE_STDCKDINT_H=false | ||
| 132 | else | ||
| 133 | GL_GENERATE_STDCKDINT_H=true | ||
| 134 | fi | ||
| 135 | fi | ||
| 136 | ]) | ||
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 index a2322ebb..127ec05b 100644 --- a/gl/m4/stddef_h.m4 +++ b/gl/m4/stddef_h.m4 | |||
| @@ -1,15 +1,16 @@ | |||
| 1 | # stddef_h.m4 serial 13 | 1 | # stddef_h.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 23 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl A placeholder for <stddef.h>, for platforms that have issues. | 9 | dnl A placeholder for <stddef.h>, for platforms that have issues. |
| 8 | 10 | ||
| 9 | AC_DEFUN_ONCE([gl_STDDEF_H], | 11 | AC_DEFUN_ONCE([gl_STDDEF_H], |
| 10 | [ | 12 | [ |
| 11 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) | 13 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) |
| 12 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 13 | 14 | ||
| 14 | dnl Persuade OpenBSD <stddef.h> to declare max_align_t. | 15 | dnl Persuade OpenBSD <stddef.h> to declare max_align_t. |
| 15 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 16 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| @@ -51,11 +52,6 @@ AC_DEFUN_ONCE([gl_STDDEF_H], | |||
| 51 | GL_GENERATE_STDDEF_H=true | 52 | GL_GENERATE_STDDEF_H=true |
| 52 | fi | 53 | fi |
| 53 | 54 | ||
| 54 | if test $gt_cv_c_wchar_t = no; then | ||
| 55 | HAVE_WCHAR_T=0 | ||
| 56 | GL_GENERATE_STDDEF_H=true | ||
| 57 | fi | ||
| 58 | |||
| 59 | AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], | 55 | AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], |
| 60 | [gl_cv_decl_null_works], | 56 | [gl_cv_decl_null_works], |
| 61 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> | 57 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> |
| @@ -68,6 +64,60 @@ AC_DEFUN_ONCE([gl_STDDEF_H], | |||
| 68 | GL_GENERATE_STDDEF_H=true | 64 | GL_GENERATE_STDDEF_H=true |
| 69 | fi | 65 | fi |
| 70 | 66 | ||
| 67 | AC_CACHE_CHECK([for unreachable in C], | ||
| 68 | [gl_cv_c_func_unreachable], | ||
| 69 | [AC_LINK_IFELSE( | ||
| 70 | [AC_LANG_PROGRAM( | ||
| 71 | [[#include <stddef.h> | ||
| 72 | ]], | ||
| 73 | [[unreachable (); | ||
| 74 | ]])], | ||
| 75 | [gl_cv_c_func_unreachable=yes], | ||
| 76 | [gl_cv_c_func_unreachable=no]) | ||
| 77 | ]) | ||
| 78 | if test $gl_cv_c_func_unreachable = no; then | ||
| 79 | GL_GENERATE_STDDEF_H=true | ||
| 80 | HAVE_C_UNREACHABLE=0 | ||
| 81 | else | ||
| 82 | HAVE_C_UNREACHABLE=1 | ||
| 83 | fi | ||
| 84 | AC_SUBST([HAVE_C_UNREACHABLE]) | ||
| 85 | dnl Provide gl_unreachable() unconditionally. | ||
| 86 | GL_GENERATE_STDDEF_H=true | ||
| 87 | |||
| 88 | dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869 | ||
| 89 | AC_CACHE_CHECK([whether nullptr_t needs <stddef.h>], | ||
| 90 | [gl_cv_nullptr_t_needs_stddef], | ||
| 91 | [AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[nullptr_t x;]], | ||
| 92 | [gl_cv_nullptr_t_needs_stddef=no], | ||
| 93 | [gl_cv_nullptr_t_needs_stddef=yes])]) | ||
| 94 | if test "$gl_cv_nullptr_t_needs_stddef" = no; then | ||
| 95 | NULLPTR_T_NEEDS_STDDEF=0 | ||
| 96 | GL_GENERATE_STDDEF_H=true | ||
| 97 | fi | ||
| 98 | |||
| 99 | dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 | ||
| 100 | dnl affects GCC 13.3 and 14.2. | ||
| 101 | AC_CACHE_CHECK([whether <stddef.h> is idempotent], | ||
| 102 | [gl_cv_stddef_idempotent], | ||
| 103 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE( | ||
| 104 | [[ | ||
| 105 | #if \ | ||
| 106 | ((__GNUC__ == 13 && __GNUC_MINOR__ <= 3) \ | ||
| 107 | || (__GNUC__ == 14 && __GNUC_MINOR__ <= 2)) | ||
| 108 | #error "bug 114870 is present" | ||
| 109 | #endif | ||
| 110 | ]])], | ||
| 111 | [gl_cv_stddef_idempotent="guessing yes"], | ||
| 112 | [gl_cv_stddef_idempotent="guessing no"]) | ||
| 113 | ]) | ||
| 114 | case "$gl_cv_stddef_idempotent" in | ||
| 115 | *yes) ;; | ||
| 116 | *) STDDEF_NOT_IDEMPOTENT=1 | ||
| 117 | GL_GENERATE_STDDEF_H=true | ||
| 118 | ;; | ||
| 119 | esac | ||
| 120 | |||
| 71 | if $GL_GENERATE_STDDEF_H; then | 121 | if $GL_GENERATE_STDDEF_H; then |
| 72 | gl_NEXT_HEADERS([stddef.h]) | 122 | gl_NEXT_HEADERS([stddef.h]) |
| 73 | fi | 123 | fi |
| @@ -98,7 +148,8 @@ AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], | |||
| 98 | AC_DEFUN([gl_STDDEF_H_DEFAULTS], | 148 | AC_DEFUN([gl_STDDEF_H_DEFAULTS], |
| 99 | [ | 149 | [ |
| 100 | dnl Assume proper GNU behavior unless another module says otherwise. | 150 | dnl Assume proper GNU behavior unless another module says otherwise. |
| 151 | NULLPTR_T_NEEDS_STDDEF=1; AC_SUBST([NULLPTR_T_NEEDS_STDDEF]) | ||
| 152 | STDDEF_NOT_IDEMPOTENT=0; AC_SUBST([STDDEF_NOT_IDEMPOTENT]) | ||
| 101 | REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) | 153 | REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) |
| 102 | HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) | 154 | HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) |
| 103 | HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) | ||
| 104 | ]) | 155 | ]) |
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index d6961b09..2d69088b 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # stdint.m4 serial 61 | 1 | # stdint.m4 |
| 2 | dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. | 2 | # serial 64 |
| 3 | dnl Copyright (C) 2001-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Paul Eggert and Bruno Haible. | 9 | dnl From Paul Eggert and Bruno Haible. |
| 8 | dnl Test whether <stdint.h> is supported or must be substituted. | 10 | dnl Test whether <stdint.h> is supported or must be substituted. |
| @@ -150,10 +152,13 @@ intmax_t i = INTMAX_MAX; | |||
| 150 | uintmax_t j = UINTMAX_MAX; | 152 | uintmax_t j = UINTMAX_MAX; |
| 151 | 153 | ||
| 152 | /* Check that SIZE_MAX has the correct type, if possible. */ | 154 | /* Check that SIZE_MAX has the correct type, if possible. */ |
| 153 | #if 201112 <= __STDC_VERSION__ | 155 | /* ISO C 11 mandates _Generic, but GCC versions < 4.9 lack it. */ |
| 156 | #if 201112 <= __STDC_VERSION__ \ | ||
| 157 | && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \ | ||
| 158 | || defined __clang__) | ||
| 154 | int k = _Generic (SIZE_MAX, size_t: 0); | 159 | int k = _Generic (SIZE_MAX, size_t: 0); |
| 155 | #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ | 160 | #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ |
| 156 | || (0x5110 <= __SUNPRO_C && !__STDC__)) | 161 | || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER) |
| 157 | extern size_t k; | 162 | extern size_t k; |
| 158 | extern __typeof__ (SIZE_MAX) k; | 163 | extern __typeof__ (SIZE_MAX) k; |
| 159 | #endif | 164 | #endif |
| @@ -283,10 +288,10 @@ static const char *macro_values[] = | |||
| 283 | [gl_cv_header_working_stdint_h=yes], | 288 | [gl_cv_header_working_stdint_h=yes], |
| 284 | [], | 289 | [], |
| 285 | [case "$host_os" in | 290 | [case "$host_os" in |
| 286 | # Guess yes on native Windows. | 291 | # Guess yes on native Windows. |
| 287 | mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; | 292 | mingw* | windows*) gl_cv_header_working_stdint_h="guessing yes" ;; |
| 288 | # In general, assume it works. | 293 | # In general, assume it works. |
| 289 | *) gl_cv_header_working_stdint_h="guessing yes" ;; | 294 | *) gl_cv_header_working_stdint_h="guessing yes" ;; |
| 290 | esac | 295 | esac |
| 291 | ]) | 296 | ]) |
| 292 | ]) | 297 | ]) |
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 70349f6c..d4f1acdd 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # stdint_h.m4 serial 9 | 1 | # stdint_h.m4 |
| 2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
| 3 | dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Paul Eggert. | 9 | dnl From Paul Eggert. |
| 8 | 10 | ||
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 94271e11..71d86180 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 | |||
| @@ -1,12 +1,24 @@ | |||
| 1 | # stdio_h.m4 serial 59 | 1 | # stdio_h.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 75 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_STDIO_H], | 9 | AC_DEFUN([gl_STDIO_H_EARLY], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 11 | dnl Defining __USE_MINGW_ANSI_STDIO to 1 must be done early, because |
| 12 | dnl the results of several configure tests depend on it: The tests | ||
| 13 | dnl - checking whether snprintf returns a byte count as in C99... | ||
| 14 | dnl - checking whether snprintf truncates the result as in C99... | ||
| 15 | dnl - checking whether printf supports the 'F' directive... | ||
| 16 | dnl - checking whether printf supports the grouping flag... | ||
| 17 | dnl - checking whether printf supports the zero flag correctly... | ||
| 18 | dnl - checking whether printf supports infinite 'double' arguments... | ||
| 19 | dnl - checking whether printf supports large precisions... | ||
| 20 | dnl report 'yes' if __USE_MINGW_ANSI_STDIO is 1 but 'no' if | ||
| 21 | dnl __USE_MINGW_ANSI_STDIO is not set. | ||
| 10 | AH_VERBATIM([MINGW_ANSI_STDIO], | 22 | AH_VERBATIM([MINGW_ANSI_STDIO], |
| 11 | [/* Use GNU style printf and scanf. */ | 23 | [/* Use GNU style printf and scanf. */ |
| 12 | #ifndef __USE_MINGW_ANSI_STDIO | 24 | #ifndef __USE_MINGW_ANSI_STDIO |
| @@ -14,6 +26,11 @@ AC_DEFUN_ONCE([gl_STDIO_H], | |||
| 14 | #endif | 26 | #endif |
| 15 | ]) | 27 | ]) |
| 16 | AC_DEFINE([__USE_MINGW_ANSI_STDIO]) | 28 | AC_DEFINE([__USE_MINGW_ANSI_STDIO]) |
| 29 | ]) | ||
| 30 | |||
| 31 | AC_DEFUN_ONCE([gl_STDIO_H], | ||
| 32 | [ | ||
| 33 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 17 | gl_NEXT_HEADERS([stdio.h]) | 34 | gl_NEXT_HEADERS([stdio.h]) |
| 18 | 35 | ||
| 19 | dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and | 36 | dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and |
| @@ -40,6 +57,9 @@ AC_DEFUN_ONCE([gl_STDIO_H], | |||
| 40 | attribute "__gnu_printf__" instead of "__printf__"]) | 57 | attribute "__gnu_printf__" instead of "__printf__"]) |
| 41 | fi | 58 | fi |
| 42 | 59 | ||
| 60 | dnl For defining _PRINTF_NAN_LEN_MAX. | ||
| 61 | gl_MUSL_LIBC | ||
| 62 | |||
| 43 | dnl This ifdef is an optimization, to avoid performing a configure check whose | 63 | dnl This ifdef is an optimization, to avoid performing a configure check whose |
| 44 | dnl result is not used. But it does not make the test of | 64 | dnl result is not used. But it does not make the test of |
| 45 | dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. | 65 | dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. |
| @@ -82,6 +102,16 @@ AC_DEFUN_ONCE([gl_STDIO_H], | |||
| 82 | if test $ac_cv_have_decl_fcloseall = no; then | 102 | if test $ac_cv_have_decl_fcloseall = no; then |
| 83 | HAVE_DECL_FCLOSEALL=0 | 103 | HAVE_DECL_FCLOSEALL=0 |
| 84 | fi | 104 | fi |
| 105 | |||
| 106 | AC_CHECK_DECLS_ONCE([getw]) | ||
| 107 | if test $ac_cv_have_decl_getw = no; then | ||
| 108 | HAVE_DECL_GETW=0 | ||
| 109 | fi | ||
| 110 | |||
| 111 | AC_CHECK_DECLS_ONCE([putw]) | ||
| 112 | if test $ac_cv_have_decl_putw = no; then | ||
| 113 | HAVE_DECL_PUTW=0 | ||
| 114 | fi | ||
| 85 | ]) | 115 | ]) |
| 86 | 116 | ||
| 87 | # gl_STDIO_MODULE_INDICATOR([modulename]) | 117 | # gl_STDIO_MODULE_INDICATOR([modulename]) |
| @@ -104,6 +134,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], | |||
| 104 | [ | 134 | [ |
| 105 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ | 135 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ |
| 106 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) | 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) |
| 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DZPRINTF]) | ||
| 107 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) | 138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) |
| 108 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) | 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) |
| 109 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) | 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) |
| @@ -124,12 +155,14 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], | |||
| 124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) | 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) |
| 125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) | 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) |
| 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) | 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) |
| 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF]) | ||
| 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) | 159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) |
| 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) | 160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) |
| 129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) | 161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) |
| 130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) | 162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) |
| 131 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) | 163 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) |
| 132 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) | 164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) |
| 165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_ZPRINTF]) | ||
| 133 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) | 166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) |
| 134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) | 167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) |
| 135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) | 168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) |
| @@ -143,20 +176,29 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], | |||
| 143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) | 176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) |
| 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) | 177 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) |
| 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) | 178 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) |
| 179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNZPRINTF]) | ||
| 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) | 180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) |
| 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) | 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) |
| 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) | 182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) |
| 183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF]) | ||
| 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) | 184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) |
| 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) | 185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) |
| 186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF]) | ||
| 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) | 187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) |
| 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) | 188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) |
| 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) | 189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) |
| 190 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF]) | ||
| 154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) | 191 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) |
| 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) | 192 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) |
| 193 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF]) | ||
| 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) | 194 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) |
| 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) | 195 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) |
| 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) | 196 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) |
| 197 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF]) | ||
| 159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) | 198 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) |
| 199 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF]) | ||
| 200 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF]) | ||
| 201 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF]) | ||
| 160 | dnl Support Microsoft deprecated alias function names by default. | 202 | dnl Support Microsoft deprecated alias function names by default. |
| 161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) | 203 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) |
| 162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) | 204 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) |
| @@ -178,7 +220,9 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], | |||
| 178 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) | 220 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) |
| 179 | HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) | 221 | HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) |
| 180 | HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) | 222 | HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) |
| 223 | HAVE_DECL_GETW=1; AC_SUBST([HAVE_DECL_GETW]) | ||
| 181 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) | 224 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) |
| 225 | HAVE_DECL_PUTW=1; AC_SUBST([HAVE_DECL_PUTW]) | ||
| 182 | HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) | 226 | HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) |
| 183 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) | 227 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) |
| 184 | HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) | 228 | HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) |
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index e96be22f..2d25da37 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # stdlib_h.m4 serial 66 | 1 | # stdlib_h.m4 |
| 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 84 |
| 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_STDLIB_H], | 9 | AC_DEFUN_ONCE([gl_STDLIB_H], |
| 8 | [ | 10 | [ |
| @@ -23,15 +25,65 @@ AC_DEFUN_ONCE([gl_STDLIB_H], | |||
| 23 | # include <random.h> | 25 | # include <random.h> |
| 24 | #endif | 26 | #endif |
| 25 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free | 27 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free |
| 26 | getloadavg getsubopt grantpt | 28 | getloadavg getprogname getsubopt grantpt |
| 27 | initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps | 29 | initstate initstate_r mbstowcs mbtowc mkdtemp mkostemp mkostemps mkstemp |
| 28 | posix_memalign posix_openpt ptsname ptsname_r qsort_r | 30 | mkstemps posix_memalign posix_openpt ptsname ptsname_r qsort_r |
| 29 | random random_r reallocarray realpath rpmatch secure_getenv setenv | 31 | random random_r reallocarray realpath rpmatch secure_getenv setenv |
| 30 | setstate setstate_r srandom srandom_r | 32 | setstate setstate_r srandom srandom_r |
| 31 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) | 33 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) |
| 32 | 34 | ||
| 33 | AC_REQUIRE([AC_C_RESTRICT]) | 35 | AC_REQUIRE([AC_C_RESTRICT]) |
| 34 | 36 | ||
| 37 | dnl Test whether MB_CUR_MAX needs to be overridden. | ||
| 38 | dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. | ||
| 39 | dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. | ||
| 40 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 41 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) | ||
| 42 | AC_CACHE_CHECK([whether MB_CUR_MAX is correct], | ||
| 43 | [gl_cv_macro_MB_CUR_MAX_good], | ||
| 44 | [AC_LINK_IFELSE( | ||
| 45 | [AC_LANG_PROGRAM([[#include <stdlib.h> | ||
| 46 | ]], | ||
| 47 | [[return !!MB_CUR_MAX;]]) | ||
| 48 | ], | ||
| 49 | [dnl Initial guess, used when cross-compiling or when no suitable locale | ||
| 50 | dnl is present. | ||
| 51 | # Guess no on Solaris and Haiku, yes otherwise. | ||
| 52 | AS_CASE([$host_os], | ||
| 53 | [solaris* | haiku*], | ||
| 54 | [gl_cv_macro_MB_CUR_MAX_good="guessing no"], | ||
| 55 | [gl_cv_macro_MB_CUR_MAX_good="guessing yes"]) | ||
| 56 | if test "$LOCALE_EN_UTF8" != none; then | ||
| 57 | AC_RUN_IFELSE( | ||
| 58 | [AC_LANG_SOURCE([[ | ||
| 59 | #include <locale.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | int main () | ||
| 62 | { | ||
| 63 | int result = 0; | ||
| 64 | if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) | ||
| 65 | { | ||
| 66 | if (MB_CUR_MAX < 4) | ||
| 67 | result |= 1; | ||
| 68 | } | ||
| 69 | return result; | ||
| 70 | }]])], | ||
| 71 | [gl_cv_macro_MB_CUR_MAX_good=yes], | ||
| 72 | [gl_cv_macro_MB_CUR_MAX_good=no], | ||
| 73 | [:]) | ||
| 74 | fi | ||
| 75 | ], | ||
| 76 | [gl_cv_macro_MB_CUR_MAX_good="link failed - so no"]) | ||
| 77 | ]) | ||
| 78 | AS_CASE([$gl_cv_macro_MB_CUR_MAX_good], | ||
| 79 | [*yes], | ||
| 80 | [], | ||
| 81 | ["link failed - so no"], | ||
| 82 | [# 4 suffices as a workaround in Android NDK 16, | ||
| 83 | # the only known platform with the bug. | ||
| 84 | REPLACE_MB_CUR_MAX=4], | ||
| 85 | [REPLACE_MB_CUR_MAX="(-1)"]) | ||
| 86 | |||
| 35 | AC_CHECK_DECLS_ONCE([ecvt]) | 87 | AC_CHECK_DECLS_ONCE([ecvt]) |
| 36 | if test $ac_cv_have_decl_ecvt = no; then | 88 | if test $ac_cv_have_decl_ecvt = no; then |
| 37 | HAVE_DECL_ECVT=0 | 89 | HAVE_DECL_ECVT=0 |
| @@ -66,6 +118,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
| 66 | [ | 118 | [ |
| 67 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ | 119 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ |
| 68 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) | 120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) |
| 121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ABORT_DEBUG]) | ||
| 69 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) | 122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) |
| 70 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) | 123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) |
| 71 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) | 124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) |
| @@ -73,10 +126,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
| 73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) | 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) |
| 74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) | 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) |
| 75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) | 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) |
| 129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPROGNAME]) | ||
| 76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) | 130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) |
| 77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) | 131 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) |
| 78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) | 132 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) |
| 79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) | 133 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) |
| 134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOWCS]) | ||
| 80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) | 135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) |
| 81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) | 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) |
| 82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) | 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) |
| @@ -89,16 +144,18 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
| 89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) | 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) |
| 90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) | 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) |
| 91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) | 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) |
| 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAND]) | ||
| 92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) | 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) |
| 93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) | 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) |
| 94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) | 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) |
| 95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU]) | ||
| 96 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) | 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) |
| 97 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) | 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) |
| 98 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) | 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) |
| 99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) | 154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) |
| 100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) | 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) |
| 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STACK_TRACE]) | ||
| 101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) | 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) |
| 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) | ||
| 102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) | 159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) |
| 103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) | 160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) |
| 104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) | 161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) |
| @@ -130,6 +187,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 130 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) | 187 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) |
| 131 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) | 188 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) |
| 132 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) | 189 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) |
| 190 | HAVE_DECL_PROGRAM_INVOCATION_NAME=1; AC_SUBST([HAVE_DECL_PROGRAM_INVOCATION_NAME]) | ||
| 191 | HAVE_GETPROGNAME=1; AC_SUBST([HAVE_GETPROGNAME]) | ||
| 133 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) | 192 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) |
| 134 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) | 193 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) |
| 135 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) | 194 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) |
| @@ -157,6 +216,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 157 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) | 216 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) |
| 158 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) | 217 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) |
| 159 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) | 218 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) |
| 219 | HAVE_STRTOF=1; AC_SUBST([HAVE_STRTOF]) | ||
| 160 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) | 220 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) |
| 161 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) | 221 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) |
| 162 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) | 222 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) |
| @@ -166,30 +226,41 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 166 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) | 226 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) |
| 167 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) | 227 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) |
| 168 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) | 228 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) |
| 229 | REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) | ||
| 230 | REPLACE_ABORT=0; AC_SUBST([REPLACE_ABORT]) | ||
| 169 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) | 231 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) |
| 170 | REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) | 232 | REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) |
| 171 | REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) | 233 | REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) |
| 172 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) | 234 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) |
| 173 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) | 235 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) |
| 236 | REPLACE_GETLOADAVG=0; AC_SUBST([REPLACE_GETLOADAVG]) | ||
| 237 | REPLACE_GETPROGNAME=0; AC_SUBST([REPLACE_GETPROGNAME]) | ||
| 238 | REPLACE_GETSUBOPT=0; AC_SUBST([REPLACE_GETSUBOPT]) | ||
| 174 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) | 239 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) |
| 175 | REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) | 240 | REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) |
| 176 | REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) | 241 | REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) |
| 242 | REPLACE_MB_CUR_MAX=0; AC_SUBST([REPLACE_MB_CUR_MAX]) | ||
| 243 | REPLACE_MBSTOWCS=0; AC_SUBST([REPLACE_MBSTOWCS]) | ||
| 177 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) | 244 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) |
| 245 | REPLACE_MKOSTEMP=0; AC_SUBST([REPLACE_MKOSTEMP]) | ||
| 246 | REPLACE_MKOSTEMPS=0; AC_SUBST([REPLACE_MKOSTEMPS]) | ||
| 178 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) | 247 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) |
| 179 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) | 248 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) |
| 249 | REPLACE_POSIX_OPENPT=0; AC_SUBST([REPLACE_POSIX_OPENPT]) | ||
| 180 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) | 250 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) |
| 181 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) | 251 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) |
| 182 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) | 252 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) |
| 183 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) | 253 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) |
| 254 | REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) | ||
| 184 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) | 255 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) |
| 185 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) | 256 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) |
| 186 | REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) | ||
| 187 | REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) | 257 | REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) |
| 188 | REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) | 258 | REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) |
| 189 | REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) | 259 | REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) |
| 190 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) | 260 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) |
| 191 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) | 261 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) |
| 192 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) | 262 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) |
| 263 | REPLACE_STRTOF=0; AC_SUBST([REPLACE_STRTOF]) | ||
| 193 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) | 264 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) |
| 194 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) | 265 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) |
| 195 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) | 266 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) |
| @@ -197,4 +268,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 197 | REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) | 268 | REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) |
| 198 | REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) | 269 | REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) |
| 199 | REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) | 270 | REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) |
| 271 | CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE]) | ||
| 200 | ]) | 272 | ]) |
diff --git a/gl/m4/strcasecmp.m4 b/gl/m4/strcasecmp.m4 new file mode 100644 index 00000000..eb4345d9 --- /dev/null +++ b/gl/m4/strcasecmp.m4 | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | # strcasecmp.m4 | ||
| 2 | # serial 3 | ||
| 3 | dnl Copyright (C) 2002-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_STRCASECMP], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) | ||
| 12 | AC_CHECK_FUNCS([strcasecmp]) | ||
| 13 | if test $ac_cv_func_strcasecmp = yes; then | ||
| 14 | gl_STRCASECMP_WORKS | ||
| 15 | case "$gl_cv_func_strcasecmp_works" in | ||
| 16 | *yes) ;; | ||
| 17 | *) REPLACE_STRCASECMP=1 ;; | ||
| 18 | esac | ||
| 19 | else | ||
| 20 | HAVE_STRCASECMP=0 | ||
| 21 | fi | ||
| 22 | ]) | ||
| 23 | |||
| 24 | AC_DEFUN([gl_STRCASECMP_WORKS], | ||
| 25 | [ | ||
| 26 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 27 | AC_CACHE_CHECK([whether strcasecmp works], | ||
| 28 | [gl_cv_func_strcasecmp_works], | ||
| 29 | [dnl Prepare a guess, used when cross-compiling or when specific locales | ||
| 30 | dnl are not available. | ||
| 31 | case "$host_os" in | ||
| 32 | solaris* | cygwin*) | ||
| 33 | gl_cv_func_strcasecmp_works="guessing no" ;; | ||
| 34 | *) | ||
| 35 | gl_cv_func_strcasecmp_works="guessing yes" ;; | ||
| 36 | esac | ||
| 37 | AC_RUN_IFELSE( | ||
| 38 | [AC_LANG_SOURCE([[ | ||
| 39 | #include <stdio.h> | ||
| 40 | #include <ctype.h> | ||
| 41 | #include <locale.h> | ||
| 42 | #include <strings.h> | ||
| 43 | int main () | ||
| 44 | { | ||
| 45 | if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL | ||
| 46 | || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) | ||
| 47 | { | ||
| 48 | int c1 = (unsigned char) '\311'; | ||
| 49 | int c2 = (unsigned char) '\351'; | ||
| 50 | if (tolower (c1) == c2 && toupper (c2) == c1) | ||
| 51 | return strcasecmp ("Fej\311r", "Fej\351r") != 0; | ||
| 52 | } | ||
| 53 | return 2; | ||
| 54 | }]])], | ||
| 55 | [gl_cv_func_strcasecmp_works=yes], | ||
| 56 | [if test $? = 1; then | ||
| 57 | gl_cv_func_strcasecmp_works=no | ||
| 58 | fi | ||
| 59 | ], | ||
| 60 | [:]) | ||
| 61 | ]) | ||
| 62 | ]) | ||
| 63 | |||
| 64 | # Prerequisites of lib/strcasecmp.c. | ||
| 65 | AC_DEFUN([gl_PREREQ_STRCASECMP], [ | ||
| 66 | : | ||
| 67 | ]) | ||
diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4 index 971e0b23..eb2862f1 100644 --- a/gl/m4/strcasestr.m4 +++ b/gl/m4/strcasestr.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # strcasestr.m4 serial 28 | 1 | # strcasestr.m4 |
| 2 | dnl Copyright (C) 2005, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 29 |
| 3 | dnl Copyright (C) 2005, 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Check that strcasestr is present and works. | 9 | dnl Check that strcasestr is present and works. |
| 8 | AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], | 10 | AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], |
| @@ -97,7 +99,7 @@ static void quit (int sig) { _exit (sig + 128); } | |||
| 97 | char *haystack = (char *) malloc (2 * m + 2); | 99 | char *haystack = (char *) malloc (2 * m + 2); |
| 98 | char *needle = (char *) malloc (m + 2); | 100 | char *needle = (char *) malloc (m + 2); |
| 99 | /* Failure to compile this test due to missing alarm is okay, | 101 | /* Failure to compile this test due to missing alarm is okay, |
| 100 | since all such platforms (mingw) also lack strcasestr. */ | 102 | since all such platforms (mingw, MSVC) also lack strcasestr. */ |
| 101 | signal (SIGALRM, quit); | 103 | signal (SIGALRM, quit); |
| 102 | alarm (5); | 104 | alarm (5); |
| 103 | /* Check for quadratic performance. */ | 105 | /* Check for quadratic performance. */ |
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 index 8879eb08..c8b3b207 100644 --- a/gl/m4/strerror.m4 +++ b/gl/m4/strerror.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # strerror.m4 serial 23 | 1 | # strerror.m4 |
| 2 | dnl Copyright (C) 2002, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 25 |
| 3 | dnl Copyright (C) 2002, 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_STRERROR], | 9 | AC_DEFUN([gl_FUNC_STRERROR], |
| 8 | [ | 10 | [ |
| @@ -24,12 +26,12 @@ AC_DEFUN([gl_FUNC_STRERROR], | |||
| 24 | [gl_cv_func_working_strerror=yes], | 26 | [gl_cv_func_working_strerror=yes], |
| 25 | [gl_cv_func_working_strerror=no], | 27 | [gl_cv_func_working_strerror=no], |
| 26 | [case "$host_os" in | 28 | [case "$host_os" in |
| 27 | # Guess yes on glibc systems. | 29 | # Guess yes on glibc systems. |
| 28 | *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; | 30 | *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; |
| 29 | # Guess yes on musl systems. | 31 | # Guess yes on musl systems. |
| 30 | *-musl*) gl_cv_func_working_strerror="guessing yes" ;; | 32 | *-musl* | midipix*) gl_cv_func_working_strerror="guessing yes" ;; |
| 31 | # If we don't know, obey --enable-cross-guesses. | 33 | # If we don't know, obey --enable-cross-guesses. |
| 32 | *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; | 34 | *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; |
| 33 | esac | 35 | esac |
| 34 | ]) | 36 | ]) |
| 35 | ]) | 37 | ]) |
| @@ -80,14 +82,14 @@ AC_DEFUN([gl_FUNC_STRERROR_0], | |||
| 80 | [gl_cv_func_strerror_0_works=yes], | 82 | [gl_cv_func_strerror_0_works=yes], |
| 81 | [gl_cv_func_strerror_0_works=no], | 83 | [gl_cv_func_strerror_0_works=no], |
| 82 | [case "$host_os" in | 84 | [case "$host_os" in |
| 83 | # Guess yes on glibc systems. | 85 | # Guess yes on glibc systems. |
| 84 | *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; | 86 | *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; |
| 85 | # Guess yes on musl systems. | 87 | # Guess yes on musl systems. |
| 86 | *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; | 88 | *-musl* | midipix*) gl_cv_func_strerror_0_works="guessing yes" ;; |
| 87 | # Guess yes on native Windows. | 89 | # Guess yes on native Windows. |
| 88 | mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; | 90 | mingw* | windows*) gl_cv_func_strerror_0_works="guessing yes" ;; |
| 89 | # If we don't know, obey --enable-cross-guesses. | 91 | # If we don't know, obey --enable-cross-guesses. |
| 90 | *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; | 92 | *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; |
| 91 | esac | 93 | esac |
| 92 | ]) | 94 | ]) |
| 93 | ]) | 95 | ]) |
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index 5da3cc25..fc73603a 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 | |||
| @@ -1,11 +1,12 @@ | |||
| 1 | # Configure a GNU-like replacement for <string.h>. | 1 | # string_h.m4 |
| 2 | 2 | # serial 44.1 | |
| 3 | # Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 4 | # This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | # with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 8 | ||
| 8 | # serial 35 | 9 | # Configure a GNU-like replacement for <string.h>. |
| 9 | 10 | ||
| 10 | # Written by Paul Eggert. | 11 | # Written by Paul Eggert. |
| 11 | 12 | ||
| @@ -23,8 +24,9 @@ AC_DEFUN_ONCE([gl_STRING_H], | |||
| 23 | ]], | 24 | ]], |
| 24 | [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit | 25 | [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit |
| 25 | rawmemchr stpcpy stpncpy strchrnul | 26 | rawmemchr stpcpy stpncpy strchrnul |
| 26 | strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r | 27 | strdup strncat strncpy strndup strnlen strpbrk strsep strcasestr strtok_r |
| 27 | strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) | 28 | strerror_l strerror_r strerrorname_np |
| 29 | sigabbrev_np sigdescr_np strsignal strverscmp]) | ||
| 28 | 30 | ||
| 29 | AC_REQUIRE([AC_C_RESTRICT]) | 31 | AC_REQUIRE([AC_C_RESTRICT]) |
| 30 | ]) | 32 | ]) |
| @@ -62,6 +64,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], | |||
| 62 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) | 64 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) |
| 63 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) | 65 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) |
| 64 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) | 66 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) |
| 67 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY]) | ||
| 65 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) | 68 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) |
| 66 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) | 69 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) |
| 67 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) | 70 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) |
| @@ -69,6 +72,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], | |||
| 69 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) | 72 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) |
| 70 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) | 73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) |
| 71 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) | 74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) |
| 75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH]) | ||
| 76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH]) | ||
| 72 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) | 77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) |
| 73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) | 78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) |
| 74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) | 79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) |
| @@ -83,8 +88,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], | |||
| 83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) | 88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) |
| 84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) | 89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) |
| 85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) | 90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) |
| 91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH]) | ||
| 92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH]) | ||
| 86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) | 93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) |
| 87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) | 94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) |
| 95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L]) | ||
| 88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) | 96 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) |
| 89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) | 97 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) |
| 90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) | 98 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) |
| @@ -123,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], | |||
| 123 | HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) | 131 | HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) |
| 124 | HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) | 132 | HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) |
| 125 | HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) | 133 | HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) |
| 134 | HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L]) | ||
| 126 | HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) | 135 | HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) |
| 127 | HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) | 136 | HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) |
| 128 | HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) | 137 | HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) |
| @@ -131,10 +140,14 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], | |||
| 131 | REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) | 140 | REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) |
| 132 | REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) | 141 | REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) |
| 133 | REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) | 142 | REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) |
| 143 | REPLACE_MEMPCPY=0; AC_SUBST([REPLACE_MEMPCPY]) | ||
| 144 | REPLACE_MEMSET_EXPLICIT=0; AC_SUBST([REPLACE_MEMSET_EXPLICIT]) | ||
| 145 | REPLACE_STPCPY=0; AC_SUBST([REPLACE_STPCPY]) | ||
| 134 | REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) | 146 | REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) |
| 135 | REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) | 147 | REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) |
| 136 | REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) | 148 | REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) |
| 137 | REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) | 149 | REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) |
| 150 | REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY]) | ||
| 138 | REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) | 151 | REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) |
| 139 | REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) | 152 | REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) |
| 140 | REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) | 153 | REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) |
| @@ -142,7 +155,9 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], | |||
| 142 | REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) | 155 | REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) |
| 143 | REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) | 156 | REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) |
| 144 | REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) | 157 | REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) |
| 158 | REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L]) | ||
| 145 | REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) | 159 | REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) |
| 146 | REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) | 160 | REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) |
| 161 | REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) | ||
| 147 | UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) | 162 | UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) |
| 148 | ]) | 163 | ]) |
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4 index 4c41221b..18f30d4a 100644 --- a/gl/m4/strings_h.m4 +++ b/gl/m4/strings_h.m4 | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | # Configure a replacement for <strings.h>. | 1 | # strings_h.m4 |
| 2 | # serial 9 | 2 | # serial 14 |
| 3 | dnl Copyright (C) 2007, 2009-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. | ||
| 3 | 8 | ||
| 4 | # Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 9 | # Configure a replacement for <strings.h>. |
| 5 | # This file is free software; the Free Software Foundation | ||
| 6 | # gives unlimited permission to copy and/or distribute it, | ||
| 7 | # with or without modifications, as long as this notice is preserved. | ||
| 8 | 10 | ||
| 9 | AC_DEFUN_ONCE([gl_STRINGS_H], | 11 | AC_DEFUN_ONCE([gl_STRINGS_H], |
| 10 | [ | 12 | [ |
| @@ -27,7 +29,7 @@ AC_DEFUN_ONCE([gl_STRINGS_H], | |||
| 27 | <strings.h>. */ | 29 | <strings.h>. */ |
| 28 | #include <sys/types.h> | 30 | #include <sys/types.h> |
| 29 | #include <strings.h> | 31 | #include <strings.h> |
| 30 | ]], [ffs strcasecmp strncasecmp]) | 32 | ]], [ffs strcasecmp strcasecmp_l strncasecmp strncasecmp_l]) |
| 31 | ]) | 33 | ]) |
| 32 | 34 | ||
| 33 | # gl_STRINGS_MODULE_INDICATOR([modulename]) | 35 | # gl_STRINGS_MODULE_INDICATOR([modulename]) |
| @@ -48,6 +50,10 @@ AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS], | |||
| 48 | [ | 50 | [ |
| 49 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ | 51 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ |
| 50 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) | 52 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) |
| 53 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP]) | ||
| 54 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP_L]) | ||
| 55 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP]) | ||
| 56 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP_L]) | ||
| 51 | ]) | 57 | ]) |
| 52 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) | 58 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) |
| 53 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) | 59 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
| @@ -58,5 +64,12 @@ AC_DEFUN([gl_STRINGS_H_DEFAULTS], | |||
| 58 | dnl Assume proper GNU behavior unless another module says otherwise. | 64 | dnl Assume proper GNU behavior unless another module says otherwise. |
| 59 | HAVE_FFS=1; AC_SUBST([HAVE_FFS]) | 65 | HAVE_FFS=1; AC_SUBST([HAVE_FFS]) |
| 60 | HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) | 66 | HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) |
| 67 | HAVE_STRCASECMP_L=1; AC_SUBST([HAVE_STRCASECMP_L]) | ||
| 68 | HAVE_STRNCASECMP=1; AC_SUBST([HAVE_STRNCASECMP]) | ||
| 69 | HAVE_STRNCASECMP_L=1; AC_SUBST([HAVE_STRNCASECMP_L]) | ||
| 61 | HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) | 70 | HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) |
| 71 | REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP]) | ||
| 72 | REPLACE_STRCASECMP_L=0; AC_SUBST([REPLACE_STRCASECMP_L]) | ||
| 73 | REPLACE_STRNCASECMP=0; AC_SUBST([REPLACE_STRNCASECMP]) | ||
| 74 | REPLACE_STRNCASECMP_L=0; AC_SUBST([REPLACE_STRNCASECMP_L]) | ||
| 62 | ]) | 75 | ]) |
diff --git a/gl/m4/strcase.m4 b/gl/m4/strncasecmp.m4 index 3cf740d2..c7c8b240 100644 --- a/gl/m4/strcase.m4 +++ b/gl/m4/strncasecmp.m4 | |||
| @@ -1,30 +1,22 @@ | |||
| 1 | # strcase.m4 serial 12 | 1 | # strncasecmp.m4 |
| 2 | dnl Copyright (C) 2002, 2005-2023 Free Software Foundation, Inc. | 2 | # serial 2 |
| 3 | dnl Copyright (C) 2002-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 6 | 7 | dnl This file is offered as-is, without any warranty. | |
| 7 | AC_DEFUN([gl_STRCASE], | ||
| 8 | [ | ||
| 9 | gl_FUNC_STRCASECMP | ||
| 10 | gl_FUNC_STRNCASECMP | ||
| 11 | ]) | ||
| 12 | |||
| 13 | AC_DEFUN([gl_FUNC_STRCASECMP], | ||
| 14 | [ | ||
| 15 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) | ||
| 16 | AC_CHECK_FUNCS([strcasecmp]) | ||
| 17 | if test $ac_cv_func_strcasecmp = no; then | ||
| 18 | HAVE_STRCASECMP=0 | ||
| 19 | fi | ||
| 20 | ]) | ||
| 21 | 8 | ||
| 22 | AC_DEFUN([gl_FUNC_STRNCASECMP], | 9 | AC_DEFUN([gl_FUNC_STRNCASECMP], |
| 23 | [ | 10 | [ |
| 24 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
| 25 | AC_CHECK_FUNCS([strncasecmp]) | 12 | AC_CHECK_FUNCS([strncasecmp]) |
| 26 | if test $ac_cv_func_strncasecmp = yes; then | 13 | if test $ac_cv_func_strncasecmp = yes; then |
| 27 | HAVE_STRNCASECMP=1 | 14 | dnl Assume that strncasecmp and strcasecmp share the same bugs. |
| 15 | gl_STRCASECMP_WORKS | ||
| 16 | case "$gl_cv_func_strcasecmp_works" in | ||
| 17 | *yes) ;; | ||
| 18 | *) REPLACE_STRNCASECMP=1 ;; | ||
| 19 | esac | ||
| 28 | else | 20 | else |
| 29 | HAVE_STRNCASECMP=0 | 21 | HAVE_STRNCASECMP=0 |
| 30 | fi | 22 | fi |
| @@ -34,11 +26,6 @@ AC_DEFUN([gl_FUNC_STRNCASECMP], | |||
| 34 | fi | 26 | fi |
| 35 | ]) | 27 | ]) |
| 36 | 28 | ||
| 37 | # Prerequisites of lib/strcasecmp.c. | ||
| 38 | AC_DEFUN([gl_PREREQ_STRCASECMP], [ | ||
| 39 | : | ||
| 40 | ]) | ||
| 41 | |||
| 42 | # Prerequisites of lib/strncasecmp.c. | 29 | # Prerequisites of lib/strncasecmp.c. |
| 43 | AC_DEFUN([gl_PREREQ_STRNCASECMP], [ | 30 | AC_DEFUN([gl_PREREQ_STRNCASECMP], [ |
| 44 | : | 31 | : |
diff --git a/gl/m4/strncpy.m4 b/gl/m4/strncpy.m4 new file mode 100644 index 00000000..57876171 --- /dev/null +++ b/gl/m4/strncpy.m4 | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | # strncpy.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2002-2004, 2009-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_ONCE([gl_FUNC_STRNCPY], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([AC_PROG_CC]) | ||
| 13 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 14 | |||
| 15 | dnl Check for prerequisites for memory fence checks. | ||
| 16 | gl_FUNC_MMAP_ANON | ||
| 17 | AC_CHECK_HEADERS_ONCE([sys/mman.h]) | ||
| 18 | AC_CHECK_FUNCS_ONCE([mprotect]) | ||
| 19 | |||
| 20 | dnl Detect bug in FreeBSD 15.0 on x86_64: | ||
| 21 | dnl strncpy should not dereference more than n bytes, but always dereferences | ||
| 22 | dnl n+1 bytes if the first n bytes don't contain a NUL byte. | ||
| 23 | dnl Assume that strncpy works on platforms that lack mprotect. | ||
| 24 | AC_CACHE_CHECK([whether strncpy works], [gl_cv_func_strncpy_works], | ||
| 25 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
| 26 | #include <string.h> | ||
| 27 | #if HAVE_SYS_MMAN_H | ||
| 28 | # include <fcntl.h> | ||
| 29 | # include <unistd.h> | ||
| 30 | # include <sys/types.h> | ||
| 31 | # include <sys/mman.h> | ||
| 32 | #endif | ||
| 33 | ]GL_MDA_DEFINES], | ||
| 34 | [[ | ||
| 35 | char *fence = NULL; | ||
| 36 | #if HAVE_SYS_MMAN_H && HAVE_MPROTECT | ||
| 37 | { | ||
| 38 | long int pagesize = sysconf (_SC_PAGESIZE); | ||
| 39 | char *two_pages = | ||
| 40 | (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, | ||
| 41 | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); | ||
| 42 | if (two_pages != (char *)(-1) | ||
| 43 | && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) | ||
| 44 | fence = two_pages + pagesize; | ||
| 45 | } | ||
| 46 | #endif | ||
| 47 | if (fence) | ||
| 48 | { | ||
| 49 | char dest[8]; | ||
| 50 | |||
| 51 | dest[0] = 'a'; | ||
| 52 | dest[1] = 'b'; | ||
| 53 | dest[2] = 'c'; | ||
| 54 | dest[3] = 'd'; | ||
| 55 | dest[4] = 'e'; | ||
| 56 | dest[5] = 'f'; | ||
| 57 | dest[6] = 'g'; | ||
| 58 | |||
| 59 | *(fence - 3) = '7'; | ||
| 60 | *(fence - 2) = '2'; | ||
| 61 | *(fence - 1) = '9'; | ||
| 62 | |||
| 63 | if (strncpy (dest + 1, fence - 3, 3) != dest + 1) | ||
| 64 | return 1; | ||
| 65 | if (dest[0] != 'a') | ||
| 66 | return 2; | ||
| 67 | if (dest[1] != '7' || dest[2] != '2' || dest[3] != '9') | ||
| 68 | return 3; | ||
| 69 | if (dest[4] != 'e') | ||
| 70 | return 4; | ||
| 71 | } | ||
| 72 | return 0; | ||
| 73 | ]])], [gl_cv_func_strncpy_works=yes], [gl_cv_func_strncpy_works=no], | ||
| 74 | [ | ||
| 75 | case "$host_os" in | ||
| 76 | # Guess no on FreeBSD. | ||
| 77 | freebsd* | dragonfly*) gl_cv_func_strncpy_works="guessing no" ;; | ||
| 78 | # Guess yes on native Windows. | ||
| 79 | mingw* | windows*) gl_cv_func_strncpy_works="guessing yes" ;; | ||
| 80 | # Guess yes otherwise. | ||
| 81 | *) gl_cv_func_strncpy_works="guessing yes" ;; | ||
| 82 | esac | ||
| 83 | ]) | ||
| 84 | ]) | ||
| 85 | case "$gl_cv_func_strncpy_works" in | ||
| 86 | *yes) ;; | ||
| 87 | *) REPLACE_STRNCPY=1 ;; | ||
| 88 | esac | ||
| 89 | ]) | ||
| 90 | |||
| 91 | # Prerequisites of lib/strncpy.c. | ||
| 92 | AC_DEFUN([gl_PREREQ_STRNCPY], [ | ||
| 93 | : | ||
| 94 | ]) | ||
diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4 index e0da09a3..b018ff88 100644 --- a/gl/m4/strsep.m4 +++ b/gl/m4/strsep.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # strsep.m4 serial 11 | 1 | # strsep.m4 |
| 2 | dnl Copyright (C) 2002-2004, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
| 3 | dnl Copyright (C) 2002-2004, 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_STRSEP], | 9 | AC_DEFUN([gl_FUNC_STRSEP], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4 index 7de203a7..1b5ef6c1 100644 --- a/gl/m4/strstr.m4 +++ b/gl/m4/strstr.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # strstr.m4 serial 24 | 1 | # strstr.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 25 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Check that strstr works. | 9 | dnl Check that strstr works. |
| 8 | AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], | 10 | AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], |
| @@ -94,7 +96,7 @@ static void quit (int sig) { _exit (sig + 128); } | |||
| 94 | char *haystack = (char *) malloc (2 * m + 2); | 96 | char *haystack = (char *) malloc (2 * m + 2); |
| 95 | char *needle = (char *) malloc (m + 2); | 97 | char *needle = (char *) malloc (m + 2); |
| 96 | /* Failure to compile this test due to missing alarm is okay, | 98 | /* Failure to compile this test due to missing alarm is okay, |
| 97 | since all such platforms (mingw) also have quadratic strstr. */ | 99 | since all such platforms (mingw, MSVC) also have quadratic strstr. */ |
| 98 | signal (SIGALRM, quit); | 100 | signal (SIGALRM, quit); |
| 99 | alarm (5); | 101 | alarm (5); |
| 100 | /* Check for quadratic performance. */ | 102 | /* Check for quadratic performance. */ |
diff --git a/gl/m4/sys_cdefs_h.m4 b/gl/m4/sys_cdefs_h.m4 new file mode 100644 index 00000000..d72796ca --- /dev/null +++ b/gl/m4/sys_cdefs_h.m4 | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # sys_cdefs_h.m4 - Is <sys/cdefs.h> compatible enough with glibc? | ||
| 2 | # serial 2 | ||
| 3 | dnl Copyright 2024-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 | dnl Written by Paul Eggert. | ||
| 10 | |||
| 11 | AC_DEFUN_ONCE([gl_CHECK_HEADER_SYS_CDEFS_H], | ||
| 12 | [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h], | ||
| 13 | [gl_cv_header_sys_cdefs_h], | ||
| 14 | [AC_COMPILE_IFELSE( | ||
| 15 | [AC_LANG_DEFINES_PROVIDED | ||
| 16 | [#include <sys/cdefs.h> | ||
| 17 | enum { foo = __GNUC_PREREQ (14, 1) } bar; | ||
| 18 | ]], | ||
| 19 | [gl_cv_header_sys_cdefs_h=yes], | ||
| 20 | [gl_cv_header_sys_cdefs_h=no])]) | ||
| 21 | if test "$gl_cv_header_sys_cdefs_h" = yes; then | ||
| 22 | HAVE_SYS_CDEFS_H=1 | ||
| 23 | else | ||
| 24 | HAVE_SYS_CDEFS_H=0 | ||
| 25 | fi | ||
| 26 | AC_SUBST([HAVE_SYS_CDEFS_H])]) | ||
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 98a10416..fb69209b 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sys_socket_h.m4 serial 29 | 1 | # sys_socket_h.m4 |
| 2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | # serial 31 |
| 3 | dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Simon Josefsson. | 9 | dnl From Simon Josefsson. |
| 8 | 10 | ||
| @@ -51,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H], | |||
| 51 | fi | 53 | fi |
| 52 | # We need to check for ws2tcpip.h now. | 54 | # We need to check for ws2tcpip.h now. |
| 53 | gl_PREREQ_SYS_H_SOCKET | 55 | gl_PREREQ_SYS_H_SOCKET |
| 54 | AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ | 56 | gl_PREREQ_SYS_SA_FAMILY |
| 55 | /* sys/types.h is not needed according to POSIX, but the | ||
| 56 | sys/socket.h in i386-unknown-freebsd4.10 and | ||
| 57 | powerpc-apple-darwin5.5 required it. */ | ||
| 58 | #include <sys/types.h> | ||
| 59 | #ifdef HAVE_SYS_SOCKET_H | ||
| 60 | #include <sys/socket.h> | ||
| 61 | #endif | ||
| 62 | #ifdef HAVE_WS2TCPIP_H | ||
| 63 | #include <ws2tcpip.h> | ||
| 64 | #endif | ||
| 65 | ]) | ||
| 66 | if test $ac_cv_type_struct_sockaddr_storage = no; then | 57 | if test $ac_cv_type_struct_sockaddr_storage = no; then |
| 67 | HAVE_STRUCT_SOCKADDR_STORAGE=0 | 58 | HAVE_STRUCT_SOCKADDR_STORAGE=0 |
| 68 | fi | 59 | fi |
| 69 | if test $ac_cv_type_sa_family_t = no; then | ||
| 70 | HAVE_SA_FAMILY_T=0 | ||
| 71 | fi | ||
| 72 | if test $ac_cv_type_struct_sockaddr_storage != no; then | 60 | if test $ac_cv_type_struct_sockaddr_storage != no; then |
| 73 | AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], | 61 | AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], |
| 74 | [], | 62 | [], |
| @@ -157,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], | |||
| 157 | AC_SUBST([HAVE_WS2TCPIP_H]) | 145 | AC_SUBST([HAVE_WS2TCPIP_H]) |
| 158 | ]) | 146 | ]) |
| 159 | 147 | ||
| 148 | # Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h> | ||
| 149 | # replacement. | ||
| 150 | # Sets and substitutes HAVE_SA_FAMILY_T. | ||
| 151 | AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY], | ||
| 152 | [ | ||
| 153 | AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) | ||
| 154 | AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ | ||
| 155 | /* sys/types.h is not needed according to POSIX, but the | ||
| 156 | sys/socket.h in i386-unknown-freebsd4.10 and | ||
| 157 | powerpc-apple-darwin5.5 required it. */ | ||
| 158 | #include <sys/types.h> | ||
| 159 | #ifdef HAVE_SYS_SOCKET_H | ||
| 160 | #include <sys/socket.h> | ||
| 161 | #endif | ||
| 162 | #ifdef HAVE_WS2TCPIP_H | ||
| 163 | #include <ws2tcpip.h> | ||
| 164 | #endif | ||
| 165 | ]) | ||
| 166 | if test $ac_cv_type_sa_family_t = yes; then | ||
| 167 | HAVE_SA_FAMILY_T=1 | ||
| 168 | else | ||
| 169 | HAVE_SA_FAMILY_T=0 | ||
| 170 | fi | ||
| 171 | AC_SUBST([HAVE_SA_FAMILY_T]) | ||
| 172 | ]) | ||
| 173 | |||
| 160 | # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) | 174 | # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) |
| 161 | # sets the shell variable that indicates the presence of the given module | 175 | # sets the shell variable that indicates the presence of the given module |
| 162 | # to a C preprocessor expression that will evaluate to 1. | 176 | # to a C preprocessor expression that will evaluate to 1. |
| @@ -201,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], | |||
| 201 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) | 215 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) |
| 202 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; | 216 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; |
| 203 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) | 217 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) |
| 204 | HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) | ||
| 205 | HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) | 218 | HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) |
| 206 | ]) | 219 | ]) |
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 index ca57398a..fdcc8954 100644 --- a/gl/m4/sys_stat_h.m4 +++ b/gl/m4/sys_stat_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sys_stat_h.m4 serial 42 -*- Autoconf -*- | 1 | # sys_stat_h.m4 |
| 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 42 -*- Autoconf -*- |
| 3 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Eric Blake. | 9 | dnl From Eric Blake. |
| 8 | dnl Provide a GNU-like <sys/stat.h>. | 10 | dnl Provide a GNU-like <sys/stat.h>. |
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4 index 627671fb..e99fdcc6 100644 --- a/gl/m4/sys_types_h.m4 +++ b/gl/m4/sys_types_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sys_types_h.m4 serial 13 | 1 | # sys_types_h.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_SYS_TYPES_H], | 9 | AC_DEFUN_ONCE([gl_SYS_TYPES_H], |
| 8 | [ | 10 | [ |
| @@ -22,6 +24,9 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], | |||
| 22 | dnl Whether to override the 'off_t' type. | 24 | dnl Whether to override the 'off_t' type. |
| 23 | AC_REQUIRE([gl_TYPE_OFF_T]) | 25 | AC_REQUIRE([gl_TYPE_OFF_T]) |
| 24 | 26 | ||
| 27 | dnl Whether to define the 'off64_t' type. | ||
| 28 | AC_REQUIRE([gl_TYPE_OFF64_T]) | ||
| 29 | |||
| 25 | dnl Whether to override the 'dev_t' and 'ino_t' types. | 30 | dnl Whether to override the 'dev_t' and 'ino_t' types. |
| 26 | m4_ifdef([gl_WINDOWS_STAT_INODES], [ | 31 | m4_ifdef([gl_WINDOWS_STAT_INODES], [ |
| 27 | AC_REQUIRE([gl_WINDOWS_STAT_INODES]) | 32 | AC_REQUIRE([gl_WINDOWS_STAT_INODES]) |
| @@ -29,6 +34,14 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], | |||
| 29 | WINDOWS_STAT_INODES=0 | 34 | WINDOWS_STAT_INODES=0 |
| 30 | ]) | 35 | ]) |
| 31 | AC_SUBST([WINDOWS_STAT_INODES]) | 36 | AC_SUBST([WINDOWS_STAT_INODES]) |
| 37 | |||
| 38 | dnl Test whether the 'blksize_t' type is defined. | ||
| 39 | AC_CHECK_TYPE([blksize_t], [HAVE_BLKSIZE_T=1], [HAVE_BLKSIZE_T=0]) | ||
| 40 | AC_SUBST([HAVE_BLKSIZE_T]) | ||
| 41 | |||
| 42 | dnl Test whether the 'blkcnt_t' type is defined. | ||
| 43 | AC_CHECK_TYPE([blkcnt_t], [HAVE_BLKCNT_T=1], [HAVE_BLKCNT_T=0]) | ||
| 44 | AC_SUBST([HAVE_BLKCNT_T]) | ||
| 32 | ]) | 45 | ]) |
| 33 | 46 | ||
| 34 | # Initializes the default values for AC_SUBSTed shell variables. | 47 | # Initializes the default values for AC_SUBSTed shell variables. |
diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4 index 93a65d26..eb0e8424 100644 --- a/gl/m4/sys_uio_h.m4 +++ b/gl/m4/sys_uio_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # sys_uio_h.m4 serial 3 | 1 | # sys_uio_h.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 3 |
| 3 | dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_SYS_UIO_H], | 9 | AC_DEFUN_ONCE([gl_SYS_UIO_H], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4 index b536b047..333c8fe0 100644 --- a/gl/m4/threadlib.m4 +++ b/gl/m4/threadlib.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # threadlib.m4 serial 32a | 1 | # threadlib.m4 |
| 2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. | 2 | # serial 45.1 |
| 3 | dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
| @@ -55,24 +57,22 @@ AC_DEFUN([gl_ANYTHREADLIB_EARLY], | |||
| 55 | [ | 57 | [ |
| 56 | AC_REQUIRE([AC_CANONICAL_HOST]) | 58 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 57 | if test -z "$gl_anythreadlib_early_done"; then | 59 | if test -z "$gl_anythreadlib_early_done"; then |
| 58 | case "$host_os" in | 60 | AS_CASE([$host_os], |
| 59 | osf*) | 61 | [osf*], |
| 60 | # On OSF/1, the compiler needs the flag -D_REENTRANT so that it | 62 | [# On OSF/1, the compiler needs the flag -D_REENTRANT so that it |
| 61 | # groks <pthread.h>. cc also understands the flag -pthread, but | 63 | # groks <pthread.h>. cc also understands the flag -pthread, but |
| 62 | # we don't use it because 1. gcc-2.95 doesn't understand -pthread, | 64 | # we do not use it because 1. gcc-2.95 does not understand -pthread, |
| 63 | # 2. putting a flag into CPPFLAGS that has an effect on the linker | 65 | # 2. putting a flag into CPPFLAGS that has an effect on the linker |
| 64 | # causes the AC_LINK_IFELSE test below to succeed unexpectedly, | 66 | # causes the AC_LINK_IFELSE test below to succeed unexpectedly, |
| 65 | # leading to wrong values of LIBTHREAD and LTLIBTHREAD. | 67 | # leading to wrong values of LIBTHREAD and LTLIBTHREAD. |
| 66 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" | 68 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" |
| 67 | ;; | 69 | ]) |
| 68 | esac | ||
| 69 | # Some systems optimize for single-threaded programs by default, and | 70 | # Some systems optimize for single-threaded programs by default, and |
| 70 | # need special flags to disable these optimizations. For example, the | 71 | # need special flags to disable these optimizations. For example, the |
| 71 | # definition of 'errno' in <errno.h>. | 72 | # definition of errno in <errno.h>. |
| 72 | case "$host_os" in | 73 | AS_CASE([$host_os], |
| 73 | aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; | 74 | [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"], |
| 74 | solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; | 75 | [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"]) |
| 75 | esac | ||
| 76 | gl_anythreadlib_early_done=done | 76 | gl_anythreadlib_early_done=done |
| 77 | fi | 77 | fi |
| 78 | ]) | 78 | ]) |
| @@ -84,23 +84,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS], | |||
| 84 | AC_REQUIRE([AC_CANONICAL_HOST]) | 84 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 85 | AC_CACHE_CHECK([whether imported symbols can be declared weak], | 85 | AC_CACHE_CHECK([whether imported symbols can be declared weak], |
| 86 | [gl_cv_have_weak], | 86 | [gl_cv_have_weak], |
| 87 | [case "$host_os" in | 87 | [AS_CASE([$host_os], |
| 88 | cygwin*) | 88 | [cygwin* | mingw* | windows*], |
| 89 | dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but | 89 | [ |
| 90 | dnl programs that use pthread_in_use() with weak symbol references | 90 | dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with |
| 91 | dnl crash miserably at runtime. | 91 | dnl gcc 11.3, the test below would succeed, but programs that use |
| 92 | dnl pthread_in_use() with weak symbol references crash miserably at | ||
| 93 | dnl runtime. | ||
| 92 | gl_cv_have_weak="guessing no" | 94 | gl_cv_have_weak="guessing no" |
| 93 | ;; | 95 | ], |
| 94 | *) | 96 | [ |
| 95 | gl_cv_have_weak=no | 97 | gl_cv_have_weak=no |
| 96 | dnl First, test whether the compiler accepts it syntactically. | 98 | dnl First, test whether the compiler accepts it syntactically. |
| 97 | AC_LINK_IFELSE( | 99 | AC_LINK_IFELSE( |
| 98 | [AC_LANG_PROGRAM( | 100 | [AC_LANG_PROGRAM( |
| 99 | [[extern void xyzzy (); | 101 | [[extern void xyzzy (); |
| 100 | #pragma weak xyzzy]], | 102 | #pragma weak xyzzy |
| 103 | ]], | ||
| 101 | [[xyzzy();]])], | 104 | [[xyzzy();]])], |
| 102 | [gl_cv_have_weak=maybe]) | 105 | [gl_cv_have_weak=maybe]) |
| 103 | if test $gl_cv_have_weak = maybe; then | 106 | AS_IF([test $gl_cv_have_weak = maybe], [ |
| 104 | dnl Second, test whether it actually works. On Cygwin 1.7.2, with | 107 | dnl Second, test whether it actually works. On Cygwin 1.7.2, with |
| 105 | dnl gcc 4.3, symbols declared weak always evaluate to the address 0. | 108 | dnl gcc 4.3, symbols declared weak always evaluate to the address 0. |
| 106 | AC_RUN_IFELSE( | 109 | AC_RUN_IFELSE( |
| @@ -123,20 +126,19 @@ int main () | |||
| 123 | [gl_cv_have_weak="guessing yes"], | 126 | [gl_cv_have_weak="guessing yes"], |
| 124 | [gl_cv_have_weak="guessing no"]) | 127 | [gl_cv_have_weak="guessing no"]) |
| 125 | ]) | 128 | ]) |
| 126 | fi | 129 | ]) |
| 127 | ;; | 130 | ]) |
| 128 | esac | 131 | dnl But when linking statically, weak symbols do not work. |
| 129 | dnl But when linking statically, weak symbols don't work. | 132 | AS_CASE([" $LDFLAGS "], |
| 130 | case " $LDFLAGS " in | 133 | [*" -static "*], [gl_cv_have_weak=no]) |
| 131 | *" -static "*) gl_cv_have_weak=no ;; | ||
| 132 | esac | ||
| 133 | dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak | 134 | dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak |
| 134 | dnl symbol and linking against a shared library that has a dependency on | 135 | dnl symbol and linking against a shared library that has a dependency on |
| 135 | dnl the shared library that defines the symbol. | 136 | dnl the shared library that defines the symbol. |
| 136 | case "$gl_cv_have_weak" in | 137 | AS_CASE([$gl_cv_have_weak], |
| 137 | *yes) | 138 | [*yes], |
| 138 | case "$host_os" in | 139 | [AS_CASE([$host_os], |
| 139 | freebsd* | dragonfly* | midnightbsd*) | 140 | [freebsd* | dragonfly* | midnightbsd*], |
| 141 | [ | ||
| 140 | : > conftest1.c | 142 | : > conftest1.c |
| 141 | $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 | 143 | $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 |
| 142 | cat <<EOF > conftest2.c | 144 | cat <<EOF > conftest2.c |
| @@ -150,17 +152,15 @@ EOF | |||
| 150 | $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ | 152 | $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ |
| 151 | || gl_cv_have_weak=no | 153 | || gl_cv_have_weak=no |
| 152 | rm -f conftest1.c libempty.so conftest2.c conftest | 154 | rm -f conftest1.c libempty.so conftest2.c conftest |
| 153 | ;; | 155 | ]) |
| 154 | esac | 156 | ]) |
| 155 | ;; | ||
| 156 | esac | ||
| 157 | ]) | 157 | ]) |
| 158 | case "$gl_cv_have_weak" in | 158 | AS_CASE([$gl_cv_have_weak], |
| 159 | *yes) | 159 | [*yes], |
| 160 | [ | ||
| 160 | AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], | 161 | AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], |
| 161 | [Define to 1 if the compiler and linker support weak declarations of symbols.]) | 162 | [Define to 1 if the compiler and linker support weak declarations of symbols.]) |
| 162 | ;; | 163 | ]) |
| 163 | esac | ||
| 164 | ]) | 164 | ]) |
| 165 | 165 | ||
| 166 | dnl ============================================================================ | 166 | dnl ============================================================================ |
| @@ -174,7 +174,7 @@ dnl Sets the variable LIBPMULTITHREAD, for programs that really need | |||
| 174 | dnl multithread functionality. The difference between LIBPTHREAD and | 174 | dnl multithread functionality. The difference between LIBPTHREAD and |
| 175 | dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically | 175 | dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically |
| 176 | dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. | 176 | dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. |
| 177 | dnl Sets the variable LIB_SCHED_YIELD to the linker options needed to use the | 177 | dnl Sets the variable SCHED_YIELD_LIB to the linker options needed to use the |
| 178 | dnl sched_yield() function. | 178 | dnl sched_yield() function. |
| 179 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for | 179 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for |
| 180 | dnl multithread-safe programs. | 180 | dnl multithread-safe programs. |
| @@ -186,15 +186,15 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. | |||
| 186 | AC_DEFUN([gl_PTHREADLIB_BODY], | 186 | AC_DEFUN([gl_PTHREADLIB_BODY], |
| 187 | [ | 187 | [ |
| 188 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) | 188 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) |
| 189 | if test -z "$gl_pthreadlib_body_done"; then | 189 | AS_IF([test -z "$gl_pthreadlib_body_done"], [ |
| 190 | gl_pthread_api=no | 190 | gl_pthread_api=no |
| 191 | LIBPTHREAD= | 191 | LIBPTHREAD= |
| 192 | LIBPMULTITHREAD= | 192 | LIBPMULTITHREAD= |
| 193 | # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that | 193 | # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that |
| 194 | # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. | 194 | # it groks <pthread.h>. It is added above, in gl_ANYTHREADLIB_EARLY. |
| 195 | AC_CHECK_HEADER([pthread.h], | 195 | AC_CHECK_HEADER([pthread.h], |
| 196 | [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) | 196 | [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) |
| 197 | if test "$gl_have_pthread_h" = yes; then | 197 | AS_IF([test "$gl_have_pthread_h" = yes], [ |
| 198 | # Other possible tests: | 198 | # Other possible tests: |
| 199 | # -lpthreads (FSU threads, PCthreads) | 199 | # -lpthreads (FSU threads, PCthreads) |
| 200 | # -lgthreads | 200 | # -lgthreads |
| @@ -205,8 +205,8 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
| 205 | # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 | 205 | # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 |
| 206 | # needs -pthread for some reason. See: | 206 | # needs -pthread for some reason. See: |
| 207 | # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html | 207 | # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html |
| 208 | save_LIBS=$LIBS | 208 | saved_LIBS="$LIBS" |
| 209 | for gl_pthread in '' '-pthread'; do | 209 | for gl_pthread in "" "-pthread"; do |
| 210 | LIBS="$LIBS $gl_pthread" | 210 | LIBS="$LIBS $gl_pthread" |
| 211 | AC_LINK_IFELSE( | 211 | AC_LINK_IFELSE( |
| 212 | [AC_LANG_PROGRAM( | 212 | [AC_LANG_PROGRAM( |
| @@ -219,7 +219,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
| 219 | [gl_pthread_api=yes | 219 | [gl_pthread_api=yes |
| 220 | LIBPTHREAD=$gl_pthread | 220 | LIBPTHREAD=$gl_pthread |
| 221 | LIBPMULTITHREAD=$gl_pthread]) | 221 | LIBPMULTITHREAD=$gl_pthread]) |
| 222 | LIBS=$save_LIBS | 222 | LIBS="$saved_LIBS" |
| 223 | test $gl_pthread_api = yes && break | 223 | test $gl_pthread_api = yes && break |
| 224 | done | 224 | done |
| 225 | echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD | 225 | echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD |
| @@ -228,8 +228,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
| 228 | gl_pthread_in_glibc=no | 228 | gl_pthread_in_glibc=no |
| 229 | # On Linux with glibc >= 2.34, libc contains the fully functional | 229 | # On Linux with glibc >= 2.34, libc contains the fully functional |
| 230 | # pthread functions. | 230 | # pthread functions. |
| 231 | case "$host_os" in | 231 | AS_CASE([$host_os], |
| 232 | linux*) | 232 | [linux*], |
| 233 | [ | ||
| 233 | AC_EGREP_CPP([Lucky user], | 234 | AC_EGREP_CPP([Lucky user], |
| 234 | [#include <features.h> | 235 | [#include <features.h> |
| 235 | #ifdef __GNU_LIBRARY__ | 236 | #ifdef __GNU_LIBRARY__ |
| @@ -240,19 +241,18 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
| 240 | ], | 241 | ], |
| 241 | [gl_pthread_in_glibc=yes], | 242 | [gl_pthread_in_glibc=yes], |
| 242 | []) | 243 | []) |
| 243 | ;; | 244 | ]) |
| 244 | esac | ||
| 245 | echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD | 245 | echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD |
| 246 | 246 | ||
| 247 | # Test for libpthread by looking for pthread_kill. (Not pthread_self, | 247 | # Test for libpthread by looking for pthread_kill. (Not pthread_self, |
| 248 | # since it is defined as a macro on OSF/1.) | 248 | # since it is defined as a macro on OSF/1.) |
| 249 | if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then | 249 | AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [ |
| 250 | # The program links fine without libpthread. But it may actually | 250 | # The program links fine without libpthread. But it may actually |
| 251 | # need to link with libpthread in order to create multiple threads. | 251 | # need to link with libpthread in order to create multiple threads. |
| 252 | AC_CHECK_LIB([pthread], [pthread_kill], | 252 | AC_CHECK_LIB([pthread], [pthread_kill], |
| 253 | [if test $gl_pthread_in_glibc = yes; then | 253 | [AS_IF([test $gl_pthread_in_glibc = yes], [ |
| 254 | LIBPMULTITHREAD= | 254 | LIBPMULTITHREAD= |
| 255 | else | 255 | ], [ |
| 256 | LIBPMULTITHREAD=-lpthread | 256 | LIBPMULTITHREAD=-lpthread |
| 257 | # On Solaris and HP-UX, most pthread functions exist also in libc. | 257 | # On Solaris and HP-UX, most pthread functions exist also in libc. |
| 258 | # Therefore pthread_in_use() needs to actually try to create a | 258 | # Therefore pthread_in_use() needs to actually try to create a |
| @@ -260,56 +260,68 @@ AC_DEFUN([gl_PTHREADLIB_BODY], | |||
| 260 | # pthread_create will actually create a thread. | 260 | # pthread_create will actually create a thread. |
| 261 | # On Solaris 10 or newer, this test is no longer needed, because | 261 | # On Solaris 10 or newer, this test is no longer needed, because |
| 262 | # libc contains the fully functional pthread functions. | 262 | # libc contains the fully functional pthread functions. |
| 263 | case "$host_os" in | 263 | AS_CASE([$host_os], |
| 264 | changequote(,)dnl | 264 | [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]], |
| 265 | solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) | 265 | [ |
| 266 | changequote([,])dnl | 266 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], |
| 267 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], | 267 | [Define if the pthread_in_use() detection is hard.]) |
| 268 | [Define if the pthread_in_use() detection is hard.]) | 268 | ]) |
| 269 | esac | 269 | ]) |
| 270 | fi | 270 | ], |
| 271 | [dnl This is needed on FreeBSD 5.2.1. | ||
| 272 | AC_CHECK_LIB([thr], [pthread_kill], | ||
| 273 | [if test $gl_pthread_in_glibc = yes; then | ||
| 274 | LIBPMULTITHREAD= | ||
| 275 | else | ||
| 276 | LIBPMULTITHREAD=-lthr | ||
| 277 | fi | ||
| 278 | ]) | ||
| 271 | ]) | 279 | ]) |
| 272 | elif test $gl_pthread_api != yes; then | 280 | ], [test $gl_pthread_api != yes], [ |
| 273 | # Some library is needed. Try libpthread and libc_r. | 281 | # Some library is needed. Try libpthread and libc_r. |
| 274 | AC_CHECK_LIB([pthread], [pthread_kill], | 282 | AC_CHECK_LIB([pthread], [pthread_kill], |
| 275 | [gl_pthread_api=yes | 283 | [gl_pthread_api=yes |
| 276 | LIBPTHREAD=-lpthread | 284 | LIBPTHREAD=-lpthread |
| 277 | LIBPMULTITHREAD=-lpthread]) | 285 | LIBPMULTITHREAD=-lpthread]) |
| 278 | if test $gl_pthread_api != yes; then | 286 | AS_IF([test $gl_pthread_api != yes], [ |
| 279 | # For FreeBSD 4. | 287 | # For FreeBSD 4. |
| 280 | AC_CHECK_LIB([c_r], [pthread_kill], | 288 | AC_CHECK_LIB([c_r], [pthread_kill], |
| 281 | [gl_pthread_api=yes | 289 | [gl_pthread_api=yes |
| 282 | LIBPTHREAD=-lc_r | 290 | LIBPTHREAD=-lc_r |
| 283 | LIBPMULTITHREAD=-lc_r]) | 291 | LIBPMULTITHREAD=-lc_r]) |
| 284 | fi | 292 | ]) |
| 285 | fi | 293 | ]) |
| 286 | echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD | 294 | echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD |
| 287 | fi | 295 | ]) |
| 288 | AC_MSG_CHECKING([whether POSIX threads API is available]) | 296 | AC_MSG_CHECKING([whether POSIX threads API is available]) |
| 289 | AC_MSG_RESULT([$gl_pthread_api]) | 297 | AC_MSG_RESULT([$gl_pthread_api]) |
| 290 | AC_SUBST([LIBPTHREAD]) | 298 | AC_SUBST([LIBPTHREAD]) |
| 291 | AC_SUBST([LIBPMULTITHREAD]) | 299 | AC_SUBST([LIBPMULTITHREAD]) |
| 292 | if test $gl_pthread_api = yes; then | 300 | AS_IF([test $gl_pthread_api = yes], [ |
| 293 | AC_DEFINE([HAVE_PTHREAD_API], [1], | 301 | AC_DEFINE([HAVE_PTHREAD_API], [1], |
| 294 | [Define if you have the <pthread.h> header and the POSIX threads API.]) | 302 | [Define if you have the <pthread.h> header and the POSIX threads API.]) |
| 295 | fi | 303 | ]) |
| 296 | 304 | ||
| 297 | dnl On some systems, sched_yield is in librt, rather than in libpthread. | 305 | dnl On some systems, sched_yield is in librt, rather than in libpthread. |
| 298 | AC_LINK_IFELSE( | 306 | AC_LINK_IFELSE( |
| 299 | [AC_LANG_PROGRAM( | 307 | [AC_LANG_PROGRAM( |
| 300 | [[#include <sched.h>]], | 308 | [[#include <sched.h> |
| 309 | ]], | ||
| 301 | [[sched_yield ();]])], | 310 | [[sched_yield ();]])], |
| 302 | [LIB_SCHED_YIELD= | 311 | [SCHED_YIELD_LIB= |
| 303 | ], | 312 | ], |
| 304 | [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. | 313 | [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. |
| 305 | AC_CHECK_LIB([rt], [sched_yield], [LIB_SCHED_YIELD=-lrt], | 314 | AC_CHECK_LIB([rt], [sched_yield], [SCHED_YIELD_LIB=-lrt], |
| 306 | [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. | 315 | [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. |
| 307 | AC_CHECK_LIB([posix4], [sched_yield], [LIB_SCHED_YIELD=-lposix4])]) | 316 | AC_CHECK_LIB([posix4], [sched_yield], [SCHED_YIELD_LIB=-lposix4])]) |
| 308 | ]) | 317 | ]) |
| 318 | AC_SUBST([SCHED_YIELD_LIB]) | ||
| 319 | dnl For backward compatibility. | ||
| 320 | LIB_SCHED_YIELD="$SCHED_YIELD_LIB" | ||
| 309 | AC_SUBST([LIB_SCHED_YIELD]) | 321 | AC_SUBST([LIB_SCHED_YIELD]) |
| 310 | 322 | ||
| 311 | gl_pthreadlib_body_done=done | 323 | gl_pthreadlib_body_done=done |
| 312 | fi | 324 | ]) |
| 313 | ]) | 325 | ]) |
| 314 | 326 | ||
| 315 | AC_DEFUN([gl_PTHREADLIB], | 327 | AC_DEFUN([gl_PTHREADLIB], |
| @@ -336,44 +348,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], | |||
| 336 | [ | 348 | [ |
| 337 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) | 349 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) |
| 338 | AC_REQUIRE([AC_CANONICAL_HOST]) | 350 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 339 | if test -z "$gl_stdthreadlib_body_done"; then | 351 | AS_IF([test -z "$gl_stdthreadlib_body_done"], [ |
| 340 | AC_CHECK_HEADERS_ONCE([threads.h]) | 352 | AC_CHECK_HEADERS_ONCE([threads.h]) |
| 341 | 353 | ||
| 342 | case "$host_os" in | 354 | AS_CASE([$host_os], |
| 343 | mingw*) | 355 | [mingw* | windows*], |
| 356 | [ | ||
| 344 | LIBSTDTHREAD= | 357 | LIBSTDTHREAD= |
| 345 | ;; | 358 | ], |
| 346 | *) | 359 | [ |
| 347 | gl_PTHREADLIB_BODY | 360 | gl_PTHREADLIB_BODY |
| 348 | if test $ac_cv_header_threads_h = yes; then | 361 | AS_IF([test $ac_cv_header_threads_h = yes], [ |
| 349 | dnl glibc >= 2.29 has thrd_create in libpthread. | 362 | dnl glibc >= 2.29 has thrd_create in libpthread. |
| 350 | dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends | 363 | dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends |
| 351 | dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). | 364 | dnl on libpthread (for the symbol pthread_mutexattr_gettype). |
| 352 | dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in | 365 | dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in |
| 353 | dnl libc. | 366 | dnl libc. |
| 354 | AC_CHECK_FUNCS([thrd_create]) | 367 | gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h> |
| 355 | if test $ac_cv_func_thrd_create = yes; then | 368 | ]]) |
| 369 | AS_IF([test $ac_cv_func_thrd_create = yes], [ | ||
| 356 | LIBSTDTHREAD= | 370 | LIBSTDTHREAD= |
| 357 | else | 371 | ], [ |
| 358 | AC_CHECK_LIB([stdthreads], [thrd_create], [ | 372 | AC_CHECK_LIB([stdthreads], [thrd_create], [ |
| 359 | LIBSTDTHREAD='-lstdthreads -lpthread' | 373 | LIBSTDTHREAD="-lstdthreads -lpthread" |
| 360 | ], [ | 374 | ], [ |
| 361 | dnl Guess that thrd_create is in libpthread. | 375 | dnl Guess that thrd_create is in libpthread. |
| 362 | LIBSTDTHREAD="$LIBPMULTITHREAD" | 376 | LIBSTDTHREAD="$LIBPMULTITHREAD" |
| 363 | ]) | 377 | ]) |
| 364 | fi | 378 | ]) |
| 365 | else | 379 | ], [ |
| 366 | dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. | 380 | dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. |
| 367 | LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" | 381 | LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" |
| 368 | fi | 382 | ]) |
| 369 | ;; | 383 | ]) |
| 370 | esac | ||
| 371 | AC_SUBST([LIBSTDTHREAD]) | 384 | AC_SUBST([LIBSTDTHREAD]) |
| 372 | 385 | ||
| 373 | AC_MSG_CHECKING([whether ISO C threads API is available]) | 386 | AC_MSG_CHECKING([whether ISO C threads API is available]) |
| 374 | AC_MSG_RESULT([$ac_cv_header_threads_h]) | 387 | AC_MSG_RESULT([$ac_cv_header_threads_h]) |
| 375 | gl_stdthreadlib_body_done=done | 388 | gl_stdthreadlib_body_done=done |
| 376 | fi | 389 | ]) |
| 377 | ]) | 390 | ]) |
| 378 | 391 | ||
| 379 | AC_DEFUN([gl_STDTHREADLIB], | 392 | AC_DEFUN([gl_STDTHREADLIB], |
| @@ -390,7 +403,7 @@ dnl ------------ | |||
| 390 | dnl Tests for a multithreading library to be used. | 403 | dnl Tests for a multithreading library to be used. |
| 391 | dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO | 404 | dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO |
| 392 | dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the | 405 | dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the |
| 393 | dnl default is 'no', otherwise it is system dependent. In both cases, the user | 406 | dnl default is "no", otherwise it is system dependent. In both cases, the user |
| 394 | dnl can change the choice through the options --enable-threads=choice or | 407 | dnl can change the choice through the options --enable-threads=choice or |
| 395 | dnl --disable-threads. | 408 | dnl --disable-threads. |
| 396 | dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, | 409 | dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, |
| @@ -435,49 +448,45 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], | |||
| 435 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], | 448 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], |
| 436 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], | 449 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], |
| 437 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) | 450 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) |
| 438 | m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) | 451 | dnl gl_use_winpthreads_default defaults to "no", because in mingw 10, like |
| 452 | dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash. | ||
| 453 | m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) | ||
| 439 | AC_ARG_ENABLE([threads], | 454 | AC_ARG_ENABLE([threads], |
| 440 | AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ | 455 | AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ |
| 441 | AS_HELP_STRING([--disable-threads], [build without multithread safety])]), | 456 | AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), |
| 442 | [gl_use_threads=$enableval], | 457 | [gl_use_threads=$enableval], |
| 443 | [if test -n "$gl_use_threads_default"; then | 458 | [if test -n "$gl_use_threads_default"; then |
| 444 | gl_use_threads="$gl_use_threads_default" | 459 | gl_use_threads="$gl_use_threads_default" |
| 445 | else | 460 | else |
| 446 | changequote(,)dnl | 461 | AS_CASE([$host_os], |
| 447 | case "$host_os" in | ||
| 448 | dnl Disable multithreading by default on OSF/1, because it interferes | 462 | dnl Disable multithreading by default on OSF/1, because it interferes |
| 449 | dnl with fork()/exec(): When msgexec is linked with -lpthread, its | 463 | dnl with fork()/exec(): When msgexec is linked with -lpthread, its |
| 450 | dnl child process gets an endless segmentation fault inside execvp(). | 464 | dnl child process gets an endless segmentation fault inside execvp(). |
| 451 | osf*) gl_use_threads=no ;; | 465 | [osf*], [gl_use_threads=no], |
| 452 | dnl Disable multithreading by default on Cygwin 1.5.x, because it has | 466 | dnl Disable multithreading by default on Cygwin 1.5.x, because it has |
| 453 | dnl bugs that lead to endless loops or crashes. See | 467 | dnl bugs that lead to endless loops or crashes. See |
| 454 | dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. | 468 | dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. |
| 455 | cygwin*) | 469 | [cygwin*], |
| 456 | case `uname -r` in | 470 | [AS_CASE([$(uname -r)], |
| 457 | 1.[0-5].*) gl_use_threads=no ;; | 471 | [[1.[0-5].*]], [gl_use_threads=no], |
| 458 | *) gl_use_threads=yes ;; | 472 | [gl_use_threads=yes]) |
| 459 | esac | 473 | ], |
| 460 | ;; | ||
| 461 | dnl Obey gl_AVOID_WINPTHREAD on mingw. | 474 | dnl Obey gl_AVOID_WINPTHREAD on mingw. |
| 462 | mingw*) | 475 | [mingw* | windows*], |
| 463 | case "$gl_use_winpthreads_default" in | 476 | [AS_CASE([$gl_use_winpthreads_default], |
| 464 | yes) gl_use_threads=posix ;; | 477 | [yes], [gl_use_threads=posix], |
| 465 | no) gl_use_threads=windows ;; | 478 | [no], [gl_use_threads=windows], |
| 466 | *) gl_use_threads=yes ;; | 479 | [gl_use_threads=yes]) |
| 467 | esac | 480 | ], |
| 468 | ;; | 481 | [gl_use_threads=yes]) |
| 469 | *) gl_use_threads=yes ;; | ||
| 470 | esac | ||
| 471 | changequote([,])dnl | ||
| 472 | fi | 482 | fi |
| 473 | ]) | 483 | ]) |
| 474 | if test "$gl_use_threads" = yes \ | 484 | AS_CASE([$gl_use_threads], |
| 475 | || test "$gl_use_threads" = isoc \ | 485 | [yes | isoc | posix | isoc+posix], |
| 476 | || test "$gl_use_threads" = posix \ | 486 | [ |
| 477 | || test "$gl_use_threads" = isoc+posix; then | 487 | # For using <threads.h> or <pthread.h>: |
| 478 | # For using <threads.h> or <pthread.h>: | 488 | gl_ANYTHREADLIB_EARLY |
| 479 | gl_ANYTHREADLIB_EARLY | 489 | ]) |
| 480 | fi | ||
| 481 | ]) | 490 | ]) |
| 482 | 491 | ||
| 483 | dnl The guts of gl_THREADLIB. Needs to be expanded only once. | 492 | dnl The guts of gl_THREADLIB. Needs to be expanded only once. |
| @@ -490,86 +499,95 @@ AC_DEFUN([gl_THREADLIB_BODY], | |||
| 490 | LTLIBTHREAD= | 499 | LTLIBTHREAD= |
| 491 | LIBMULTITHREAD= | 500 | LIBMULTITHREAD= |
| 492 | LTLIBMULTITHREAD= | 501 | LTLIBMULTITHREAD= |
| 493 | if test "$gl_use_threads" != no; then | 502 | AS_IF([test "$gl_use_threads" = no], |
| 503 | [AC_DEFINE([AVOID_ANY_THREADS], [1], | ||
| 504 | [Define if no multithread safety and no multithreading is desired.])], | ||
| 505 | [ | ||
| 494 | dnl Check whether the compiler and linker support weak declarations. | 506 | dnl Check whether the compiler and linker support weak declarations. |
| 495 | gl_WEAK_SYMBOLS | 507 | gl_WEAK_SYMBOLS |
| 496 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | 508 | AS_CASE([$gl_cv_have_weak], |
| 497 | dnl If we use weak symbols to implement pthread_in_use / pth_in_use / | 509 | [*yes], |
| 498 | dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create | 510 | [ |
| 499 | dnl facility is in use. | 511 | dnl If we use weak symbols to implement pthread_in_use / pth_in_use / |
| 500 | AC_CHECK_HEADERS_ONCE([threads.h]) | 512 | dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create |
| 501 | : | 513 | dnl facility is in use. |
| 502 | fi | 514 | AC_CHECK_HEADERS_ONCE([threads.h]) |
| 503 | if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then | 515 | : |
| 504 | AC_CHECK_HEADERS_ONCE([threads.h]) | 516 | ]) |
| 505 | gl_have_isoc_threads="$ac_cv_header_threads_h" | 517 | AS_CASE([$gl_use_threads], |
| 506 | fi | 518 | [isoc | isoc+posix], |
| 507 | if test "$gl_use_threads" = yes \ | 519 | [ |
| 508 | || test "$gl_use_threads" = posix \ | 520 | AC_CHECK_HEADERS_ONCE([threads.h]) |
| 509 | || test "$gl_use_threads" = isoc+posix; then | 521 | gl_have_isoc_threads="$ac_cv_header_threads_h" |
| 510 | gl_PTHREADLIB_BODY | 522 | ]) |
| 511 | LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD | 523 | AS_CASE([$gl_use_threads], |
| 512 | LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD | 524 | [yes | posix | isoc+posix], |
| 513 | if test $gl_pthread_api = yes; then | 525 | [ |
| 514 | if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then | 526 | gl_PTHREADLIB_BODY |
| 515 | gl_threads_api='isoc+posix' | 527 | LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD |
| 516 | AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], | 528 | LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD |
| 517 | [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) | 529 | AS_IF([test $gl_pthread_api = yes], [ |
| 518 | LIBTHREAD= LTLIBTHREAD= | 530 | AS_IF([test "$gl_use_threads" = isoc+posix && |
| 519 | else | 531 | test "$gl_have_isoc_threads" = yes], [ |
| 520 | gl_threads_api=posix | 532 | gl_threads_api="isoc+posix" |
| 521 | AC_DEFINE([USE_POSIX_THREADS], [1], | 533 | AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], |
| 522 | [Define if the POSIX multithreading library can be used.]) | 534 | [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) |
| 523 | if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then | 535 | LIBTHREAD= LTLIBTHREAD= |
| 524 | AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], | 536 | ], [ |
| 525 | [Define if references to the POSIX multithreading library are satisfied by libc.]) | 537 | gl_threads_api=posix |
| 526 | else | 538 | AC_DEFINE([USE_POSIX_THREADS], [1], |
| 527 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | 539 | [Define if the POSIX multithreading library can be used.]) |
| 528 | AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], | 540 | AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [ |
| 529 | [Define if references to the POSIX multithreading library should be made weak.]) | 541 | AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], |
| 530 | LIBTHREAD= LTLIBTHREAD= | 542 | [Define if references to the POSIX multithreading library are satisfied by libc.]) |
| 531 | else | 543 | ], [ |
| 532 | case "$host_os" in | 544 | AS_CASE([$gl_cv_have_weak], |
| 533 | freebsd* | dragonfly* | midnightbsd*) | 545 | [*yes], |
| 534 | if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then | 546 | [ |
| 535 | dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() | 547 | AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], |
| 536 | dnl etc. will succeed, we need a runtime test. | 548 | [Define if references to the POSIX multithreading library should be made weak.]) |
| 537 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], | 549 | LIBTHREAD= LTLIBTHREAD= |
| 538 | [Define if the pthread_in_use() detection is hard.]) | 550 | ], |
| 539 | fi | 551 | [AS_CASE([$host_os], |
| 540 | ;; | 552 | [freebsd* | dragonfly* | midnightbsd*], |
| 541 | esac | 553 | [ |
| 542 | fi | 554 | AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [ |
| 543 | fi | 555 | dnl If weak symbols cannot tell whether |
| 544 | fi | 556 | dnl pthread_create(), dnl pthread_key_create() |
| 545 | fi | 557 | dnl etc. will succeed, we need a runtime test. |
| 546 | fi | 558 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], |
| 547 | if test $gl_threads_api = none; then | 559 | [Define if the pthread_in_use() detection is hard.]) |
| 548 | if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then | 560 | ]) |
| 561 | ]) | ||
| 562 | ]) | ||
| 563 | ]) | ||
| 564 | ]) | ||
| 565 | ]) | ||
| 566 | ]) | ||
| 567 | AS_IF([test $gl_threads_api = none], [ | ||
| 568 | AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [ | ||
| 549 | gl_STDTHREADLIB_BODY | 569 | gl_STDTHREADLIB_BODY |
| 550 | LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD | 570 | LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD |
| 551 | LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD | 571 | LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD |
| 552 | gl_threads_api=isoc | 572 | gl_threads_api=isoc |
| 553 | AC_DEFINE([USE_ISOC_THREADS], [1], | 573 | AC_DEFINE([USE_ISOC_THREADS], [1], |
| 554 | [Define if the ISO C multithreading library can be used.]) | 574 | [Define if the ISO C multithreading library can be used.]) |
| 555 | fi | 575 | ]) |
| 556 | fi | 576 | ]) |
| 557 | if test $gl_threads_api = none; then | 577 | AS_IF([test $gl_threads_api = none], [ |
| 558 | case "$gl_use_threads" in | 578 | # The "win32" is for backward compatibility. |
| 559 | yes | windows | win32) # The 'win32' is for backward compatibility. | 579 | AS_CASE([$gl_use_threads], |
| 560 | if { case "$host_os" in | 580 | [yes | windows | win32], |
| 561 | mingw*) true;; | 581 | [AS_CASE([$host_os], |
| 562 | *) false;; | 582 | [mingw* | windows*], |
| 563 | esac | 583 | [ |
| 564 | }; then | 584 | gl_threads_api=windows |
| 565 | gl_threads_api=windows | 585 | AC_DEFINE([USE_WINDOWS_THREADS], [1], |
| 566 | AC_DEFINE([USE_WINDOWS_THREADS], [1], | 586 | [Define if the native Windows multithreading API can be used.]) |
| 567 | [Define if the native Windows multithreading API can be used.]) | 587 | ]) |
| 568 | fi | 588 | ]) |
| 569 | ;; | 589 | ]) |
| 570 | esac | 590 | ]) |
| 571 | fi | ||
| 572 | fi | ||
| 573 | AC_MSG_CHECKING([for multithread API to use]) | 591 | AC_MSG_CHECKING([for multithread API to use]) |
| 574 | AC_MSG_RESULT([$gl_threads_api]) | 592 | AC_MSG_RESULT([$gl_threads_api]) |
| 575 | AC_SUBST([LIBTHREAD]) | 593 | AC_SUBST([LIBTHREAD]) |
| @@ -589,7 +607,7 @@ dnl gl_DISABLE_THREADS | |||
| 589 | dnl ------------------ | 607 | dnl ------------------ |
| 590 | dnl Sets the gl_THREADLIB default so that threads are not used by default. | 608 | dnl Sets the gl_THREADLIB default so that threads are not used by default. |
| 591 | dnl The user can still override it at installation time, by using the | 609 | dnl The user can still override it at installation time, by using the |
| 592 | dnl configure option '--enable-threads'. | 610 | dnl configure option "--enable-threads". |
| 593 | 611 | ||
| 594 | AC_DEFUN([gl_DISABLE_THREADS], [ | 612 | AC_DEFUN([gl_DISABLE_THREADS], [ |
| 595 | m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) | 613 | m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) |
| @@ -601,7 +619,8 @@ dnl ------------------- | |||
| 601 | dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the | 619 | dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the |
| 602 | dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. | 620 | dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. |
| 603 | dnl The user can still override it at installation time, by using the | 621 | dnl The user can still override it at installation time, by using the |
| 604 | dnl configure option '--enable-threads'. | 622 | dnl configure option "--enable-threads=posix". |
| 623 | dnl As of 2023, this is now the default. | ||
| 605 | 624 | ||
| 606 | AC_DEFUN([gl_AVOID_WINPTHREAD], [ | 625 | AC_DEFUN([gl_AVOID_WINPTHREAD], [ |
| 607 | m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) | 626 | m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) |
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index f6bf3a4f..f4d8e20f 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | # Configure a more-standard replacement for <time.h>. | 1 | # time_h.m4 |
| 2 | 2 | # serial 27 | |
| 3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2000-2001, 2003-2007, 2009-2025 Free Software Foundation, |
| 4 | 4 | dnl Inc. | |
| 5 | # serial 20 | 5 | dnl This file is free software; the Free Software Foundation |
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 9 | ||
| 7 | # This file is free software; the Free Software Foundation | 10 | # Configure a more-standard replacement for <time.h>. |
| 8 | # gives unlimited permission to copy and/or distribute it, | ||
| 9 | # with or without modifications, as long as this notice is preserved. | ||
| 10 | 11 | ||
| 11 | # Written by Paul Eggert and Jim Meyering. | 12 | # Written by Paul Eggert and Jim Meyering. |
| 12 | 13 | ||
| @@ -23,7 +24,10 @@ AC_DEFUN_ONCE([gl_TIME_H], | |||
| 23 | dnl corresponding gnulib module is not in use. | 24 | dnl corresponding gnulib module is not in use. |
| 24 | gl_WARN_ON_USE_PREPARE([[ | 25 | gl_WARN_ON_USE_PREPARE([[ |
| 25 | #include <time.h> | 26 | #include <time.h> |
| 26 | ]], [asctime_r ctime_r]) | 27 | ]], [ |
| 28 | asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime | ||
| 29 | nanosleep strftime strptime time timegm timespec_get timespec_getres tzset | ||
| 30 | ]) | ||
| 27 | 31 | ||
| 28 | AC_REQUIRE([AC_C_RESTRICT]) | 32 | AC_REQUIRE([AC_C_RESTRICT]) |
| 29 | 33 | ||
| @@ -137,11 +141,13 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], | |||
| 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) | 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) |
| 138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) | 142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) |
| 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) | 143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) |
| 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME]) | ||
| 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) | 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) |
| 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) | 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) |
| 142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) | 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) |
| 143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) | 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) |
| 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) | 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) |
| 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZNAME]) | ||
| 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) | 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) |
| 146 | dnl Support Microsoft deprecated alias function names by default. | 152 | dnl Support Microsoft deprecated alias function names by default. |
| 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) | 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) |
| @@ -159,25 +165,21 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], | |||
| 159 | HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) | 165 | HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) |
| 160 | HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) | 166 | HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) |
| 161 | HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) | 167 | HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) |
| 162 | dnl Even GNU libc does not have timezone_t yet. | 168 | dnl Even GNU libc does not have timezone_t and tzalloc() yet. |
| 163 | HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) | 169 | HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) |
| 164 | dnl If another module says to replace or to not replace, do that. | 170 | HAVE_TZALLOC=0; AC_SUBST([HAVE_TZALLOC]) |
| 165 | dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; | 171 | REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) |
| 166 | dnl this lets maintainers check for portability. | ||
| 167 | REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) | ||
| 168 | REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) | ||
| 169 | REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) | ||
| 170 | REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) | ||
| 171 | REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) | ||
| 172 | REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) | ||
| 173 | REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) | ||
| 174 | |||
| 175 | dnl Hack so that the time module doesn't depend on the sys_time module. | ||
| 176 | dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. | ||
| 177 | : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) | ||
| 178 | dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME | ||
| 179 | dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier | ||
| 180 | dnl is no longer a big deal. | ||
| 181 | REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) | 172 | REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) |
| 182 | REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) | 173 | REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) |
| 174 | REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) | ||
| 175 | REPLACE_LOCALTIME_RZ=0; AC_SUBST([REPLACE_LOCALTIME_RZ]) | ||
| 176 | REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) | ||
| 177 | REPLACE_MKTIME_Z=0; AC_SUBST([REPLACE_MKTIME_Z]) | ||
| 178 | REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) | ||
| 179 | REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) | ||
| 180 | REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) | ||
| 181 | REPLACE_TIMEGM=0; AC_SUBST([REPLACE_TIMEGM]) | ||
| 182 | REPLACE_TIMESPEC_GET=0; AC_SUBST([REPLACE_TIMESPEC_GET]) | ||
| 183 | REPLACE_TIMESPEC_GETRES=0; AC_SUBST([REPLACE_TIMESPEC_GETRES]) | ||
| 184 | REPLACE_TZSET=0; AC_SUBST([REPLACE_TZSET]) | ||
| 183 | ]) | 185 | ]) |
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4 index adce438a..96f5c5b5 100644 --- a/gl/m4/time_r.m4 +++ b/gl/m4/time_r.m4 | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | dnl Reentrant time functions: localtime_r, gmtime_r. | 1 | # time_r.m4 |
| 2 | 2 | # serial 1 | |
| 3 | dnl Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 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 | dnl Reentrant time functions: localtime_r, gmtime_r. | ||
| 7 | 10 | ||
| 8 | dnl Written by Paul Eggert. | 11 | dnl Written by Paul Eggert. |
| 9 | 12 | ||
| @@ -57,9 +60,7 @@ AC_DEFUN([gl_TIME_R], | |||
| 57 | [gl_cv_time_r_posix=yes], | 60 | [gl_cv_time_r_posix=yes], |
| 58 | [gl_cv_time_r_posix=no]) | 61 | [gl_cv_time_r_posix=no]) |
| 59 | ]) | 62 | ]) |
| 60 | if test $gl_cv_time_r_posix = yes; then | 63 | if test $gl_cv_time_r_posix != yes; then |
| 61 | REPLACE_LOCALTIME_R=0 | ||
| 62 | else | ||
| 63 | REPLACE_LOCALTIME_R=1 | 64 | REPLACE_LOCALTIME_R=1 |
| 64 | fi | 65 | fi |
| 65 | else | 66 | else |
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4 index 6079f1a3..cb6da6da 100644 --- a/gl/m4/timegm.m4 +++ b/gl/m4/timegm.m4 | |||
| @@ -1,15 +1,16 @@ | |||
| 1 | # timegm.m4 serial 13 | 1 | # timegm.m4 |
| 2 | dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 16 |
| 3 | dnl Copyright (C) 2003, 2007, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_TIMEGM], | 9 | AC_DEFUN([gl_FUNC_TIMEGM], |
| 8 | [ | 10 | [ |
| 9 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) |
| 10 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) | 12 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) |
| 11 | REPLACE_TIMEGM=0 | 13 | gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]]) |
| 12 | AC_CHECK_FUNCS_ONCE([timegm]) | ||
| 13 | if test $ac_cv_func_timegm = yes; then | 14 | if test $ac_cv_func_timegm = yes; then |
| 14 | if test "$gl_cv_func_working_mktime" != yes; then | 15 | if test "$gl_cv_func_working_mktime" != yes; then |
| 15 | # Assume that timegm is buggy if mktime is. | 16 | # Assume that timegm is buggy if mktime is. |
| @@ -17,6 +18,9 @@ AC_DEFUN([gl_FUNC_TIMEGM], | |||
| 17 | fi | 18 | fi |
| 18 | else | 19 | else |
| 19 | HAVE_TIMEGM=0 | 20 | HAVE_TIMEGM=0 |
| 21 | case "$gl_cv_onwards_func_timegm" in | ||
| 22 | future*) REPLACE_TIMEGM=1 ;; | ||
| 23 | esac | ||
| 20 | fi | 24 | fi |
| 21 | ]) | 25 | ]) |
| 22 | 26 | ||
diff --git a/gl/m4/uchar_h.m4 b/gl/m4/uchar_h.m4 new file mode 100644 index 00000000..b2309385 --- /dev/null +++ b/gl/m4/uchar_h.m4 | |||
| @@ -0,0 +1,279 @@ | |||
| 1 | # uchar_h.m4 | ||
| 2 | # serial 32 | ||
| 3 | dnl Copyright (C) 2019-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 | dnl From Bruno Haible. | ||
| 10 | dnl Prepare the overridden <uchar.h>. | ||
| 11 | |||
| 12 | AC_DEFUN_ONCE([gl_UCHAR_H], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) | ||
| 15 | |||
| 16 | gl_CHECK_NEXT_HEADERS([uchar.h]) | ||
| 17 | if test $ac_cv_header_uchar_h = yes; then | ||
| 18 | HAVE_UCHAR_H=1 | ||
| 19 | else | ||
| 20 | HAVE_UCHAR_H=0 | ||
| 21 | fi | ||
| 22 | AC_SUBST([HAVE_UCHAR_H]) | ||
| 23 | |||
| 24 | dnl On macOS 15, in C mode, <uchar.h> does not exist. But in C++ mode, | ||
| 25 | dnl it exists, and we need to #include_next it, otherwise we get an error | ||
| 26 | dnl "<cuchar> tried including <uchar.h> but didn't find libc++'s <uchar.h> | ||
| 27 | dnl header." | ||
| 28 | m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) | ||
| 29 | CXX_HAVE_UCHAR_H=0 | ||
| 30 | if test "$CXX" != no; then | ||
| 31 | AC_CACHE_CHECK([whether the C++ compiler has <uchar.h>], | ||
| 32 | [gl_cv_cxx_have_uchar_h], | ||
| 33 | [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to | ||
| 34 | dnl an autoconf bug <https://savannah.gnu.org/support/?110294>. | ||
| 35 | cat > conftest.cpp <<\EOF | ||
| 36 | #include <uchar.h> | ||
| 37 | EOF | ||
| 38 | gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" | ||
| 39 | if AC_TRY_EVAL([gl_command]); then | ||
| 40 | gl_cv_cxx_have_uchar_h=yes | ||
| 41 | else | ||
| 42 | gl_cv_cxx_have_uchar_h=no | ||
| 43 | fi | ||
| 44 | rm -fr conftest* | ||
| 45 | ]) | ||
| 46 | if test $gl_cv_cxx_have_uchar_h = yes; then | ||
| 47 | CXX_HAVE_UCHAR_H=1 | ||
| 48 | fi | ||
| 49 | fi | ||
| 50 | AC_SUBST([CXX_HAVE_UCHAR_H]) | ||
| 51 | |||
| 52 | gl_TYPE_CHAR8_T | ||
| 53 | gl_TYPE_CHAR16_T | ||
| 54 | gl_TYPE_CHAR32_T | ||
| 55 | |||
| 56 | dnl In C++ mode, clang defines 'char16_t' and 'char32_t' as built-in types | ||
| 57 | dnl on some platforms (e.g. OpenBSD 6.7), and as types defined by many | ||
| 58 | dnl header files (<limits.h>, <stddef.h>, <stdint.h>, <stdio.h>, <stdlib.h> | ||
| 59 | dnl and others) on some platforms (e.g. Mac OS X 10.13). | ||
| 60 | dnl The same thing may also happen for 'char8_t'; so, be prepared for it. | ||
| 61 | m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) | ||
| 62 | CXX_HAS_UCHAR_TYPES=0 | ||
| 63 | if test $HAVE_UCHAR_H = 0; then | ||
| 64 | if test "$CXX" != no; then | ||
| 65 | AC_CACHE_CHECK([whether the C++ compiler predefines the <uchar.h> types], | ||
| 66 | [gl_cv_cxx_has_uchar_types], | ||
| 67 | [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to | ||
| 68 | dnl an autoconf bug <https://savannah.gnu.org/support/?110294>. | ||
| 69 | cat > conftest.cpp <<\EOF | ||
| 70 | #include <stddef.h> | ||
| 71 | char16_t a; | ||
| 72 | char32_t b; | ||
| 73 | EOF | ||
| 74 | gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" | ||
| 75 | if AC_TRY_EVAL([gl_command]); then | ||
| 76 | gl_cv_cxx_has_uchar_types=yes | ||
| 77 | else | ||
| 78 | gl_cv_cxx_has_uchar_types=no | ||
| 79 | fi | ||
| 80 | rm -fr conftest* | ||
| 81 | ]) | ||
| 82 | if test $gl_cv_cxx_has_uchar_types = yes; then | ||
| 83 | CXX_HAS_UCHAR_TYPES=1 | ||
| 84 | fi | ||
| 85 | fi | ||
| 86 | fi | ||
| 87 | AC_SUBST([CXX_HAS_UCHAR_TYPES]) | ||
| 88 | CXX_HAS_CHAR8_TYPE=0 | ||
| 89 | if test $HAVE_UCHAR_H = 0; then | ||
| 90 | if test "$CXX" != no; then | ||
| 91 | AC_CACHE_CHECK([whether the C++ compiler predefines the char8_t type], | ||
| 92 | [gl_cv_cxx_has_char8_type], | ||
| 93 | [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to | ||
| 94 | dnl an autoconf bug <https://savannah.gnu.org/support/?110294>. | ||
| 95 | cat > conftest.cpp <<\EOF | ||
| 96 | #include <stddef.h> | ||
| 97 | char8_t a; | ||
| 98 | EOF | ||
| 99 | gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" | ||
| 100 | if AC_TRY_EVAL([gl_command]); then | ||
| 101 | gl_cv_cxx_has_char8_type=yes | ||
| 102 | else | ||
| 103 | gl_cv_cxx_has_char8_type=no | ||
| 104 | fi | ||
| 105 | rm -fr conftest* | ||
| 106 | ]) | ||
| 107 | if test $gl_cv_cxx_has_char8_type = yes; then | ||
| 108 | CXX_HAS_CHAR8_TYPE=1 | ||
| 109 | fi | ||
| 110 | fi | ||
| 111 | fi | ||
| 112 | AC_SUBST([CXX_HAS_CHAR8_TYPE]) | ||
| 113 | |||
| 114 | dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'. | ||
| 115 | gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES]) | ||
| 116 | if test $BITSIZEOF_WCHAR_T -lt 32; then | ||
| 117 | SMALL_WCHAR_T=1 | ||
| 118 | else | ||
| 119 | SMALL_WCHAR_T=0 | ||
| 120 | fi | ||
| 121 | dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows. | ||
| 122 | AC_SUBST([SMALL_WCHAR_T]) | ||
| 123 | |||
| 124 | dnl Check for declarations of anything we want to poison if the | ||
| 125 | dnl corresponding gnulib module is not in use, and which is not | ||
| 126 | dnl guaranteed by C11. | ||
| 127 | gl_WARN_ON_USE_PREPARE([[ | ||
| 128 | #ifdef __HAIKU__ | ||
| 129 | #include <stdint.h> | ||
| 130 | #endif | ||
| 131 | #include <uchar.h> | ||
| 132 | ]], [c32rtomb mbrtoc16 mbrtoc32]) | ||
| 133 | ]) | ||
| 134 | |||
| 135 | AC_DEFUN_ONCE([gl_TYPE_CHAR8_T], | ||
| 136 | [ | ||
| 137 | dnl Determine whether gnulib's <uchar.h> would, if present, override char8_t. | ||
| 138 | AC_CACHE_CHECK([whether char8_t is correctly defined], | ||
| 139 | [gl_cv_type_char8_t_works], | ||
| 140 | [AC_COMPILE_IFELSE( | ||
| 141 | [AC_LANG_PROGRAM([[ | ||
| 142 | #ifdef __HAIKU__ | ||
| 143 | #include <stdint.h> | ||
| 144 | #endif | ||
| 145 | #include <uchar.h> | ||
| 146 | int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1]; | ||
| 147 | ]]) | ||
| 148 | ], | ||
| 149 | [gl_cv_type_char8_t_works=yes], | ||
| 150 | [gl_cv_type_char8_t_works=no]) | ||
| 151 | ]) | ||
| 152 | if test $gl_cv_type_char8_t_works = no; then | ||
| 153 | GNULIBHEADERS_OVERRIDE_CHAR8_T=1 | ||
| 154 | else | ||
| 155 | GNULIBHEADERS_OVERRIDE_CHAR8_T=0 | ||
| 156 | fi | ||
| 157 | AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR8_T]) | ||
| 158 | ]) | ||
| 159 | |||
| 160 | dnl On Haiku 2020, char16_t and char32_t are incorrectly defined. | ||
| 161 | dnl See <https://dev.haiku-os.org/ticket/15990>. | ||
| 162 | AC_DEFUN_ONCE([gl_TYPE_CHAR16_T], | ||
| 163 | [ | ||
| 164 | dnl Determine whether gnulib's <uchar.h> would, if present, override char16_t. | ||
| 165 | AC_CACHE_CHECK([whether char16_t is correctly defined], | ||
| 166 | [gl_cv_type_char16_t_works], | ||
| 167 | [AC_COMPILE_IFELSE( | ||
| 168 | [AC_LANG_PROGRAM([[ | ||
| 169 | #ifdef __HAIKU__ | ||
| 170 | #include <stdint.h> | ||
| 171 | #endif | ||
| 172 | #include <uchar.h> | ||
| 173 | /* For simplicity, assume that uint16_least_t is equivalent to | ||
| 174 | 'unsigned short'. */ | ||
| 175 | int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1]; | ||
| 176 | ]]) | ||
| 177 | ], | ||
| 178 | [gl_cv_type_char16_t_works=yes], | ||
| 179 | [gl_cv_type_char16_t_works=no]) | ||
| 180 | ]) | ||
| 181 | if test $gl_cv_type_char16_t_works = no; then | ||
| 182 | GNULIBHEADERS_OVERRIDE_CHAR16_T=1 | ||
| 183 | else | ||
| 184 | GNULIBHEADERS_OVERRIDE_CHAR16_T=0 | ||
| 185 | fi | ||
| 186 | AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR16_T]) | ||
| 187 | ]) | ||
| 188 | AC_DEFUN_ONCE([gl_TYPE_CHAR32_T], | ||
| 189 | [ | ||
| 190 | dnl Determine whether gnulib's <uchar.h> would, if present, override char32_t. | ||
| 191 | AC_CACHE_CHECK([whether char32_t is correctly defined], | ||
| 192 | [gl_cv_type_char32_t_works], | ||
| 193 | [AC_COMPILE_IFELSE( | ||
| 194 | [AC_LANG_PROGRAM([[ | ||
| 195 | #ifdef __HAIKU__ | ||
| 196 | #include <stdint.h> | ||
| 197 | #endif | ||
| 198 | #include <uchar.h> | ||
| 199 | /* For simplicity, assume that uint32_least_t is equivalent to | ||
| 200 | 'unsigned int'. */ | ||
| 201 | int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1]; | ||
| 202 | ]]) | ||
| 203 | ], | ||
| 204 | [gl_cv_type_char32_t_works=yes], | ||
| 205 | [gl_cv_type_char32_t_works=no]) | ||
| 206 | ]) | ||
| 207 | if test $gl_cv_type_char32_t_works = no; then | ||
| 208 | GNULIBHEADERS_OVERRIDE_CHAR32_T=1 | ||
| 209 | else | ||
| 210 | GNULIBHEADERS_OVERRIDE_CHAR32_T=0 | ||
| 211 | fi | ||
| 212 | AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR32_T]) | ||
| 213 | ]) | ||
| 214 | |||
| 215 | # gl_UCHAR_MODULE_INDICATOR([modulename]) | ||
| 216 | # sets the shell variable that indicates the presence of the given module | ||
| 217 | # to a C preprocessor expression that will evaluate to 1. | ||
| 218 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 219 | AC_DEFUN([gl_UCHAR_MODULE_INDICATOR], | ||
| 220 | [ | ||
| 221 | dnl Ensure to expand the default settings once only. | ||
| 222 | gl_UCHAR_H_REQUIRE_DEFAULTS | ||
| 223 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 224 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 225 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 226 | ]) | ||
| 227 | |||
| 228 | # Initializes the default values for AC_SUBSTed shell variables. | ||
| 229 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
| 230 | # outside of macros or in macros that are not AC_REQUIREd. | ||
| 231 | AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS], | ||
| 232 | [ | ||
| 233 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS], [ | ||
| 234 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOC32]) | ||
| 235 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALNUM]) | ||
| 236 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALPHA]) | ||
| 237 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISBLANK]) | ||
| 238 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISCNTRL]) | ||
| 239 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISDIGIT]) | ||
| 240 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISGRAPH]) | ||
| 241 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISLOWER]) | ||
| 242 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPRINT]) | ||
| 243 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPUNCT]) | ||
| 244 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISSPACE]) | ||
| 245 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISUPPER]) | ||
| 246 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISXDIGIT]) | ||
| 247 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOLOWER]) | ||
| 248 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOUPPER]) | ||
| 249 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32WIDTH]) | ||
| 250 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32RTOMB]) | ||
| 251 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SNRTOMBS]) | ||
| 252 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SRTOMBS]) | ||
| 253 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS]) | ||
| 254 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH]) | ||
| 255 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB]) | ||
| 256 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_MAPPING]) | ||
| 257 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST]) | ||
| 258 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_MAPPING]) | ||
| 259 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST]) | ||
| 260 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16]) | ||
| 261 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32]) | ||
| 262 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S]) | ||
| 263 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOC32S]) | ||
| 264 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOC32S]) | ||
| 265 | ]) | ||
| 266 | m4_require(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS]) | ||
| 267 | AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) | ||
| 268 | ]) | ||
| 269 | |||
| 270 | AC_DEFUN([gl_UCHAR_H_DEFAULTS], | ||
| 271 | [ | ||
| 272 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 273 | HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB]) | ||
| 274 | HAVE_MBRTOC16=1; AC_SUBST([HAVE_MBRTOC16]) | ||
| 275 | HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32]) | ||
| 276 | REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB]) | ||
| 277 | REPLACE_MBRTOC16=0; AC_SUBST([REPLACE_MBRTOC16]) | ||
| 278 | REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32]) | ||
| 279 | ]) | ||
diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 index 8977a346..969b60e8 100644 --- a/gl/m4/ungetc.m4 +++ b/gl/m4/ungetc.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # ungetc.m4 serial 10 | 1 | # ungetc.m4 |
| 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. | 2 | # serial 12 |
| 3 | dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], | 9 | AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], |
| 8 | [ | 10 | [ |
| @@ -42,16 +44,16 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], | |||
| 42 | ]])], | 44 | ]])], |
| 43 | [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], | 45 | [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], |
| 44 | [case "$host_os" in | 46 | [case "$host_os" in |
| 45 | # Guess yes on glibc systems. | 47 | # Guess yes on glibc systems. |
| 46 | *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; | 48 | *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; |
| 47 | # Guess yes on musl systems. | 49 | # Guess yes on musl systems. |
| 48 | *-musl*) gl_cv_func_ungetc_works="guessing yes" ;; | 50 | *-musl* | midipix*) gl_cv_func_ungetc_works="guessing yes" ;; |
| 49 | # Guess yes on bionic systems. | 51 | # Guess yes on bionic systems. |
| 50 | *-android*) gl_cv_func_ungetc_works="guessing yes" ;; | 52 | *-android*) gl_cv_func_ungetc_works="guessing yes" ;; |
| 51 | # Guess yes on native Windows. | 53 | # Guess yes on native Windows. |
| 52 | mingw*) gl_cv_func_ungetc_works="guessing yes" ;; | 54 | mingw* | windows*) gl_cv_func_ungetc_works="guessing yes" ;; |
| 53 | # If we don't know, obey --enable-cross-guesses. | 55 | # If we don't know, obey --enable-cross-guesses. |
| 54 | *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; | 56 | *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; |
| 55 | esac | 57 | esac |
| 56 | ]) | 58 | ]) |
| 57 | ]) | 59 | ]) |
diff --git a/gl/m4/unicase_h.m4 b/gl/m4/unicase_h.m4 new file mode 100644 index 00000000..bf5d4c2e --- /dev/null +++ b/gl/m4/unicase_h.m4 | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | # unicase_h.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2023-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_ONCE([gl_UNICASE_H], | ||
| 10 | [ | ||
| 11 | dnl Ensure to expand the default settings once only, before all statements | ||
| 12 | dnl that occur in other macros. | ||
| 13 | AC_REQUIRE([gl_UNICASE_H_DEFAULTS]) | ||
| 14 | ]) | ||
| 15 | |||
| 16 | # gl_UNICASE_MODULE_INDICATOR([modulename]) | ||
| 17 | # sets the shell variable that indicates the presence of the given module | ||
| 18 | # to a C preprocessor expression that will evaluate to 1. | ||
| 19 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 20 | AC_DEFUN([gl_UNICASE_MODULE_INDICATOR], | ||
| 21 | [ | ||
| 22 | dnl Ensure to expand the default settings once only. | ||
| 23 | gl_UNICASE_H_REQUIRE_DEFAULTS | ||
| 24 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 25 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 26 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 27 | ]) | ||
| 28 | |||
| 29 | # Initializes the default values for AC_SUBSTed shell variables. | ||
| 30 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
| 31 | # outside of macros or in macros that are not AC_REQUIREd. | ||
| 32 | AC_DEFUN([gl_UNICASE_H_REQUIRE_DEFAULTS], | ||
| 33 | [ | ||
| 34 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS], [ | ||
| 35 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 36 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 37 | ]) | ||
| 38 | m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS]) | ||
| 39 | AC_REQUIRE([gl_UNICASE_H_DEFAULTS]) | ||
| 40 | ]) | ||
| 41 | |||
| 42 | AC_DEFUN([gl_UNICASE_H_DEFAULTS], | ||
| 43 | [ | ||
| 44 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 45 | ]) | ||
diff --git a/gl/m4/unictype_h.m4 b/gl/m4/unictype_h.m4 new file mode 100644 index 00000000..68ddaf6c --- /dev/null +++ b/gl/m4/unictype_h.m4 | |||
| @@ -0,0 +1,179 @@ | |||
| 1 | # unictype_h.m4 | ||
| 2 | # serial 4 | ||
| 3 | dnl Copyright (C) 2023-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_ONCE([gl_UNICTYPE_H], | ||
| 10 | [ | ||
| 11 | dnl Ensure to expand the default settings once only, before all statements | ||
| 12 | dnl that occur in other macros. | ||
| 13 | AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS]) | ||
| 14 | ]) | ||
| 15 | |||
| 16 | # gl_UNICTYPE_MODULE_INDICATOR([modulename]) | ||
| 17 | # sets the shell variable that indicates the presence of the given module | ||
| 18 | # to a C preprocessor expression that will evaluate to 1. | ||
| 19 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 20 | AC_DEFUN([gl_UNICTYPE_MODULE_INDICATOR], | ||
| 21 | [ | ||
| 22 | dnl Ensure to expand the default settings once only. | ||
| 23 | gl_UNICTYPE_H_REQUIRE_DEFAULTS | ||
| 24 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 25 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 26 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 27 | ]) | ||
| 28 | |||
| 29 | # Initializes the default values for AC_SUBSTed shell variables. | ||
| 30 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
| 31 | # outside of macros or in macros that are not AC_REQUIREd. | ||
| 32 | AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS], | ||
| 33 | [ | ||
| 34 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS], [ | ||
| 35 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 36 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 37 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 38 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 39 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 40 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 41 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 42 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 43 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 44 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 45 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 46 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 47 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 48 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 49 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 50 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 51 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 52 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 53 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 54 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 55 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 56 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 57 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 58 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 59 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 60 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 61 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 62 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 63 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 64 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 65 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 66 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 67 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 68 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 69 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 70 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 71 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 72 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 96 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 97 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 98 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 105 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 106 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 107 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 108 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 109 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 110 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 111 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 112 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 119 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 131 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 132 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 133 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 163 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 170 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 171 | ]) | ||
| 172 | m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS]) | ||
| 173 | AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS]) | ||
| 174 | ]) | ||
| 175 | |||
| 176 | AC_DEFUN([gl_UNICTYPE_H_DEFAULTS], | ||
| 177 | [ | ||
| 178 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 179 | ]) | ||
diff --git a/gl/m4/uninorm_h.m4 b/gl/m4/uninorm_h.m4 new file mode 100644 index 00000000..d416f73b --- /dev/null +++ b/gl/m4/uninorm_h.m4 | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | # uninorm_h.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2023-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_ONCE([gl_UNINORM_H], | ||
| 10 | [ | ||
| 11 | dnl Ensure to expand the default settings once only, before all statements | ||
| 12 | dnl that occur in other macros. | ||
| 13 | AC_REQUIRE([gl_UNINORM_H_DEFAULTS]) | ||
| 14 | ]) | ||
| 15 | |||
| 16 | # gl_UNINORM_MODULE_INDICATOR([modulename]) | ||
| 17 | # sets the shell variable that indicates the presence of the given module | ||
| 18 | # to a C preprocessor expression that will evaluate to 1. | ||
| 19 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
| 20 | AC_DEFUN([gl_UNINORM_MODULE_INDICATOR], | ||
| 21 | [ | ||
| 22 | dnl Ensure to expand the default settings once only. | ||
| 23 | gl_UNINORM_H_REQUIRE_DEFAULTS | ||
| 24 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 25 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 26 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 27 | ]) | ||
| 28 | |||
| 29 | # Initializes the default values for AC_SUBSTed shell variables. | ||
| 30 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
| 31 | # outside of macros or in macros that are not AC_REQUIREd. | ||
| 32 | AC_DEFUN([gl_UNINORM_H_REQUIRE_DEFAULTS], | ||
| 33 | [ | ||
| 34 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS], [ | ||
| 35 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 36 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 37 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 38 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) | ||
| 39 | ]) | ||
| 40 | m4_require(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS]) | ||
| 41 | AC_REQUIRE([gl_UNINORM_H_DEFAULTS]) | ||
| 42 | ]) | ||
| 43 | |||
| 44 | AC_DEFUN([gl_UNINORM_H_DEFAULTS], | ||
| 45 | [ | ||
| 46 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 47 | ]) | ||
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index f4384027..6ec16286 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # unistd_h.m4 serial 90 | 1 | # unistd_h.m4 |
| 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 2 | # serial 97 |
| 3 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Written by Simon Josefsson, Bruno Haible. | 9 | dnl Written by Simon Josefsson, Bruno Haible. |
| 8 | 10 | ||
| @@ -225,6 +227,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
| 225 | REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE]) | 227 | REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE]) |
| 226 | REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) | 228 | REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) |
| 227 | REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) | 229 | REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) |
| 230 | REPLACE_DUP3=0; AC_SUBST([REPLACE_DUP3]) | ||
| 228 | REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) | 231 | REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) |
| 229 | REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) | 232 | REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) |
| 230 | REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) | 233 | REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) |
| @@ -233,27 +236,34 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
| 233 | REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) | 236 | REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) |
| 234 | REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) | 237 | REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) |
| 235 | REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) | 238 | REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) |
| 239 | REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) | ||
| 236 | REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) | 240 | REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) |
| 241 | REPLACE_FDATASYNC=0; AC_SUBST([REPLACE_FDATASYNC]) | ||
| 237 | REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) | 242 | REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) |
| 238 | REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) | 243 | REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) |
| 239 | REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) | 244 | REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) |
| 240 | REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) | 245 | REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) |
| 246 | REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) | ||
| 247 | REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN]) | ||
| 241 | REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) | 248 | REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) |
| 242 | REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) | 249 | REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) |
| 243 | REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) | 250 | REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) |
| 244 | REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) | 251 | REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) |
| 245 | REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) | 252 | REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) |
| 253 | REPLACE_GETUSERSHELL=0; AC_SUBST([REPLACE_GETUSERSHELL]) | ||
| 246 | REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) | 254 | REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) |
| 247 | REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) | 255 | REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) |
| 248 | REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) | 256 | REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) |
| 249 | REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) | 257 | REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) |
| 250 | REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) | 258 | REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) |
| 259 | REPLACE_PIPE2=0; AC_SUBST([REPLACE_PIPE2]) | ||
| 251 | REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) | 260 | REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) |
| 252 | REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) | 261 | REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) |
| 253 | REPLACE_READ=0; AC_SUBST([REPLACE_READ]) | 262 | REPLACE_READ=0; AC_SUBST([REPLACE_READ]) |
| 254 | REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) | 263 | REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) |
| 255 | REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) | 264 | REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) |
| 256 | REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) | 265 | REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) |
| 266 | REPLACE_SETHOSTNAME=0; AC_SUBST([REPLACE_SETHOSTNAME]) | ||
| 257 | REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) | 267 | REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) |
| 258 | REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) | 268 | REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) |
| 259 | REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) | 269 | REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) |
diff --git a/gl/m4/unitypes_h.m4 b/gl/m4/unitypes_h.m4 new file mode 100644 index 00000000..264e61be --- /dev/null +++ b/gl/m4/unitypes_h.m4 | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # unitypes_h.m4 | ||
| 2 | # serial 1 | ||
| 3 | dnl Copyright (C) 2021-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_ONCE([gl_UNITYPES_H], | ||
| 10 | [ | ||
| 11 | AH_VERBATIM([unitypes_restrict], [ | ||
| 12 | /* This definition is a duplicate of the one in unitypes.h. | ||
| 13 | It is here so that we can cope with an older version of unitypes.h | ||
| 14 | that does not contain this definition and that is pre-installed among | ||
| 15 | the public header files. */ | ||
| 16 | # if defined __restrict \ | ||
| 17 | || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ | ||
| 18 | || __clang_major__ >= 3 | ||
| 19 | # define _UC_RESTRICT __restrict | ||
| 20 | # elif 199901L <= __STDC_VERSION__ || defined restrict | ||
| 21 | # define _UC_RESTRICT restrict | ||
| 22 | # else | ||
| 23 | # define _UC_RESTRICT | ||
| 24 | # endif | ||
| 25 | ]) | ||
| 26 | ]) | ||
diff --git a/gl/m4/unlocked-io.m4 b/gl/m4/unlocked-io.m4 index 407c0bac..97f43f4b 100644 --- a/gl/m4/unlocked-io.m4 +++ b/gl/m4/unlocked-io.m4 | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | # unlocked-io.m4 serial 16 | 1 | # unlocked-io.m4 |
| 2 | 2 | # serial 16 | |
| 3 | # Copyright (C) 1998-2006, 2009-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 1998-2006, 2009-2025 Free Software Foundation, Inc. |
| 4 | # | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | # This file is free software; the Free Software Foundation | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | # gives unlimited permission to copy and/or distribute it, | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | # with or without modifications, as long as this notice is preserved. | 7 | dnl This file is offered as-is, without any warranty. |
| 8 | 8 | ||
| 9 | dnl From Jim Meyering. | 9 | dnl From Jim Meyering. |
| 10 | dnl | 10 | dnl |
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4 index fd6230c2..086e409f 100644 --- a/gl/m4/vararrays.m4 +++ b/gl/m4/vararrays.m4 | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | # Check for variable-length arrays. | 1 | # vararrays.m4 |
| 2 | |||
| 3 | # serial 6 | 2 | # serial 6 |
| 3 | dnl Copyright (C) 2001, 2009-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. | ||
| 4 | 8 | ||
| 5 | # From Paul Eggert | 9 | # Check for variable-length arrays. |
| 6 | 10 | ||
| 7 | # Copyright (C) 2001, 2009-2023 Free Software Foundation, Inc. | 11 | # From Paul Eggert |
| 8 | # This file is free software; the Free Software Foundation | ||
| 9 | # gives unlimited permission to copy and/or distribute it, | ||
| 10 | # with or without modifications, as long as this notice is preserved. | ||
| 11 | 12 | ||
| 12 | m4_version_prereq([2.70], [], [ | 13 | m4_version_prereq([2.70], [], [ |
| 13 | 14 | ||
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 6361c843..1d040d6e 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 | |||
| @@ -1,13 +1,47 @@ | |||
| 1 | # vasnprintf.m4 serial 38 | 1 | # vasnprintf.m4 |
| 2 | dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc. | 2 | # serial 56 |
| 3 | dnl Copyright (C) 2002-2004, 2006-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_VASNPRINTF], | 9 | AC_DEFUN([gl_FUNC_VASNPRINTF], |
| 8 | [ | 10 | [ |
| 11 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 9 | AC_CHECK_FUNCS_ONCE([vasnprintf]) | 12 | AC_CHECK_FUNCS_ONCE([vasnprintf]) |
| 10 | if test $ac_cv_func_vasnprintf = no; then | 13 | if test $ac_cv_func_vasnprintf = yes; then |
| 14 | dnl On Cygwin, in directives with a huge width, the width is ignored, and | ||
| 15 | dnl the function returns a wrong result. | ||
| 16 | AC_CACHE_CHECK([whether vasnprintf works], | ||
| 17 | [gl_cv_func_vasnprintf_works], | ||
| 18 | [AC_RUN_IFELSE( | ||
| 19 | [AC_LANG_SOURCE( | ||
| 20 | [[#include <stdio.h> | ||
| 21 | ]], | ||
| 22 | [[size_t len; | ||
| 23 | char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17); | ||
| 24 | /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */ | ||
| 25 | return (res != NULL && len < 10); | ||
| 26 | ]]) | ||
| 27 | ], | ||
| 28 | [gl_cv_func_vasnprintf_works=yes], | ||
| 29 | [gl_cv_func_vasnprintf_works=no], | ||
| 30 | [case "$host_os" in | ||
| 31 | # Guess no on Cygwin. | ||
| 32 | cygwin*) gl_cv_func_vasnprintf_works="guessing no";; | ||
| 33 | # If we don't know, obey --enable-cross-guesses. | ||
| 34 | *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";; | ||
| 35 | esac | ||
| 36 | ]) | ||
| 37 | ]) | ||
| 38 | fi | ||
| 39 | if test $ac_cv_func_vasnprintf != yes \ | ||
| 40 | || case "$gl_cv_func_vasnprintf_works" in | ||
| 41 | *yes) false;; | ||
| 42 | *) true;; | ||
| 43 | esac | ||
| 44 | then | ||
| 11 | gl_REPLACE_VASNPRINTF | 45 | gl_REPLACE_VASNPRINTF |
| 12 | fi | 46 | fi |
| 13 | ]) | 47 | ]) |
| @@ -29,18 +63,26 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], | |||
| 29 | gl_PREREQ_ASNPRINTF | 63 | gl_PREREQ_ASNPRINTF |
| 30 | ]) | 64 | ]) |
| 31 | 65 | ||
| 66 | AC_DEFUN([gl_FUNC_VASNWPRINTF], | ||
| 67 | [ | ||
| 68 | AC_LIBOBJ([printf-args]) | ||
| 69 | gl_PREREQ_PRINTF_ARGS | ||
| 70 | gl_PREREQ_PRINTF_PARSE | ||
| 71 | gl_PREREQ_VASNWPRINTF | ||
| 72 | gl_PREREQ_ASNPRINTF | ||
| 73 | ]) | ||
| 74 | |||
| 32 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. | 75 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. |
| 33 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | 76 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], |
| 34 | [ | 77 | [ |
| 35 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 36 | AC_REQUIRE([gt_TYPE_WINT_T]) | 78 | AC_REQUIRE([gt_TYPE_WINT_T]) |
| 37 | ]) | 79 | ]) |
| 38 | 80 | ||
| 39 | # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. | 81 | # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. |
| 82 | # Prerequisites of lib/wprintf-parse.h, lib/wprintf-parse.c. | ||
| 40 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | 83 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], |
| 41 | [ | 84 | [ |
| 42 | AC_REQUIRE([gl_FEATURES_H]) | 85 | AC_REQUIRE([gl_FEATURES_H]) |
| 43 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 44 | AC_REQUIRE([gt_TYPE_WINT_T]) | 86 | AC_REQUIRE([gt_TYPE_WINT_T]) |
| 45 | AC_REQUIRE([AC_TYPE_SIZE_T]) | 87 | AC_REQUIRE([AC_TYPE_SIZE_T]) |
| 46 | AC_CHECK_TYPE([ptrdiff_t], , | 88 | AC_CHECK_TYPE([ptrdiff_t], , |
| @@ -50,19 +92,13 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | |||
| 50 | AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) | 92 | AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) |
| 51 | ]) | 93 | ]) |
| 52 | 94 | ||
| 53 | # Prerequisites of lib/vasnprintf.c. | 95 | # Prerequisites of lib/vasnprintf.c if !WIDE_CHAR_VERSION. |
| 54 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | 96 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], |
| 55 | [ | 97 | [ |
| 56 | AC_REQUIRE([AC_FUNC_ALLOCA]) | 98 | AC_CHECK_FUNCS([snprintf strnlen wcrtomb]) |
| 57 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 58 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 59 | AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) | ||
| 60 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | 99 | dnl Use the _snprintf function only if it is declared (because on NetBSD it |
| 61 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | 100 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). |
| 62 | AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) | 101 | AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) |
| 63 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization | ||
| 64 | dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. | ||
| 65 | AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) | ||
| 66 | dnl We can avoid a lot of code by assuming that snprintf's return value | 102 | dnl We can avoid a lot of code by assuming that snprintf's return value |
| 67 | dnl conforms to ISO C99. So check that. | 103 | dnl conforms to ISO C99. So check that. |
| 68 | AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) | 104 | AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) |
| @@ -84,6 +120,107 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | |||
| 84 | terminated.]) | 120 | terminated.]) |
| 85 | ;; | 121 | ;; |
| 86 | esac | 122 | esac |
| 123 | gl_PREREQ_VASNXPRINTF | ||
| 124 | ]) | ||
| 125 | |||
| 126 | # Prerequisites of lib/vasnwprintf.c. | ||
| 127 | AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF], | ||
| 128 | [ | ||
| 129 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 130 | AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc]) | ||
| 131 | AC_CHECK_DECLS([_snwprintf], , , [[#include <stdio.h>]]) | ||
| 132 | AC_CHECK_DECLS([wcsnlen], , , [[#include <wchar.h>]]) | ||
| 133 | gl_SWPRINTF_WORKS | ||
| 134 | case "$gl_cv_func_swprintf_works" in | ||
| 135 | *yes) | ||
| 136 | AC_DEFINE([HAVE_WORKING_SWPRINTF], [1], | ||
| 137 | [Define if the swprintf function works correctly when it produces output | ||
| 138 | that contains null wide characters.]) | ||
| 139 | ;; | ||
| 140 | esac | ||
| 141 | gl_MBRTOWC_C_LOCALE | ||
| 142 | case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
| 143 | *yes) | ||
| 144 | AC_CACHE_CHECK([whether swprintf in the C locale is free of encoding errors], | ||
| 145 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ], | ||
| 146 | [ | ||
| 147 | AC_RUN_IFELSE( | ||
| 148 | [AC_LANG_SOURCE([[ | ||
| 149 | #ifndef __USE_MINGW_ANSI_STDIO | ||
| 150 | # define __USE_MINGW_ANSI_STDIO 1 | ||
| 151 | #endif | ||
| 152 | #include <stdio.h> | ||
| 153 | #include <wchar.h> | ||
| 154 | int main() | ||
| 155 | { | ||
| 156 | int result = 0; | ||
| 157 | { /* This test fails on glibc 2.35, musl libc 1.2.4, FreeBSD 13.2, NetBSD 9.3, | ||
| 158 | OpenBSD 7.2, Cygwin 2.9.0. | ||
| 159 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/2>. */ | ||
| 160 | wchar_t buf[12]; | ||
| 161 | int ret = swprintf (buf, 12, L"%c", '\377'); | ||
| 162 | if (ret < 0) | ||
| 163 | result |= 1; | ||
| 164 | } | ||
| 165 | return result; | ||
| 166 | }]])], | ||
| 167 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ=yes], | ||
| 168 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ=no], | ||
| 169 | [case "$host_os" in | ||
| 170 | # Guess no on glibc systems. | ||
| 171 | *-gnu* | gnu*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing yes";; | ||
| 172 | # Guess no on musl systems. | ||
| 173 | *-musl* | midipix*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing no";; | ||
| 174 | # If we don't know, obey --enable-cross-guesses. | ||
| 175 | *) gl_cv_func_swprintf_C_locale_sans_EILSEQ="$gl_cross_guess_normal";; | ||
| 176 | esac | ||
| 177 | ]) | ||
| 178 | ]) | ||
| 179 | ;; | ||
| 180 | esac | ||
| 181 | if case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
| 182 | *yes) false ;; | ||
| 183 | *) true ;; | ||
| 184 | esac \ | ||
| 185 | || case "$gl_cv_func_swprintf_C_locale_sans_EILSEQ" in | ||
| 186 | *yes) false ;; | ||
| 187 | *) true ;; | ||
| 188 | esac; then | ||
| 189 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_C], [1], | ||
| 190 | [Define if the vasnwprintf implementation needs special code for | ||
| 191 | the 'c' directive.]) | ||
| 192 | fi | ||
| 193 | gl_SWPRINTF_DIRECTIVE_LA | ||
| 194 | case "$gl_cv_func_swprintf_directive_la" in | ||
| 195 | *yes) ;; | ||
| 196 | *) | ||
| 197 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LA], [1], | ||
| 198 | [Define if the vasnwprintf implementation needs special code for | ||
| 199 | the 'a' directive with 'long double' arguments.]) | ||
| 200 | ;; | ||
| 201 | esac | ||
| 202 | gl_SWPRINTF_DIRECTIVE_LC | ||
| 203 | case "$gl_cv_func_swprintf_directive_lc" in | ||
| 204 | *yes) ;; | ||
| 205 | *) | ||
| 206 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LC], [1], | ||
| 207 | [Define if the vasnwprintf implementation needs special code for | ||
| 208 | the 'lc' directive.]) | ||
| 209 | ;; | ||
| 210 | esac | ||
| 211 | gl_MUSL_LIBC | ||
| 212 | gl_PREREQ_VASNXPRINTF | ||
| 213 | ]) | ||
| 214 | |||
| 215 | # Common prerequisites of lib/vasnprintf.c and lib/vasnwprintf.c. | ||
| 216 | AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], | ||
| 217 | [ | ||
| 218 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
| 219 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 220 | AC_CHECK_FUNCS([wcslen]) | ||
| 221 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization | ||
| 222 | dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. | ||
| 223 | AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) | ||
| 87 | ]) | 224 | ]) |
| 88 | 225 | ||
| 89 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' | 226 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' |
| @@ -152,7 +289,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], | |||
| 152 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], | 289 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], |
| 153 | [Define if the vasnprintf implementation needs special code for | 290 | [Define if the vasnprintf implementation needs special code for |
| 154 | the 'a' and 'A' directives.]) | 291 | the 'a' and 'A' directives.]) |
| 155 | AC_CHECK_FUNCS([nl_langinfo]) | 292 | gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]]) |
| 293 | ;; | ||
| 294 | esac | ||
| 295 | ]) | ||
| 296 | |||
| 297 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'b' directive. | ||
| 298 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_B], | ||
| 299 | [ | ||
| 300 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_B]) | ||
| 301 | case "$gl_cv_func_printf_directive_b" in | ||
| 302 | *yes) | ||
| 303 | ;; | ||
| 304 | *) | ||
| 305 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_B], [1], | ||
| 306 | [Define if the vasnprintf implementation needs special code for | ||
| 307 | the 'b' directive.]) | ||
| 156 | ;; | 308 | ;; |
| 157 | esac | 309 | esac |
| 158 | ]) | 310 | ]) |
| @@ -187,18 +339,57 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], | |||
| 187 | esac | 339 | esac |
| 188 | ]) | 340 | ]) |
| 189 | 341 | ||
| 190 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. | 342 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'lc' directive. |
| 191 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], | 343 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], |
| 192 | [ | 344 | [ |
| 193 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) | 345 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC]) |
| 194 | case "$gl_cv_func_printf_flag_grouping" in | 346 | case "$gl_cv_func_printf_directive_lc" in |
| 195 | *yes) | 347 | *yes) |
| 196 | ;; | 348 | ;; |
| 197 | *) | 349 | *) |
| 350 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_LC], [1], | ||
| 351 | [Define if the vasnprintf implementation needs special code for | ||
| 352 | the 'lc' directive.]) | ||
| 353 | ;; | ||
| 354 | esac | ||
| 355 | ]) | ||
| 356 | |||
| 357 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. | ||
| 358 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], | ||
| 359 | [ | ||
| 360 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 361 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) | ||
| 362 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION]) | ||
| 363 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE]) | ||
| 364 | case "$host_os" in | ||
| 365 | mingw* | windows*) | ||
| 366 | dnl MSVC does not support the ' flag at all. | ||
| 367 | dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined. | ||
| 368 | dnl mingw also has other bugs regarding the ' flag. | ||
| 198 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], | 369 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], |
| 199 | [Define if the vasnprintf implementation needs special code for the | 370 | [Define if the vasnprintf implementation needs special code for the |
| 200 | ' flag.]) | 371 | ' flag.]) |
| 201 | ;; | 372 | ;; |
| 373 | *) | ||
| 374 | case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in | ||
| 375 | *yes,*yes) | ||
| 376 | case "$gl_cv_func_printf_flag_grouping_int_precision" in | ||
| 377 | *yes) | ||
| 378 | ;; | ||
| 379 | *) | ||
| 380 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1], | ||
| 381 | [Define if the vasnprintf implementation needs special code for the | ||
| 382 | ' flag, for integer directives only.]) | ||
| 383 | ;; | ||
| 384 | esac | ||
| 385 | ;; | ||
| 386 | *) | ||
| 387 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], | ||
| 388 | [Define if the vasnprintf implementation needs special code for the | ||
| 389 | ' flag.]) | ||
| 390 | ;; | ||
| 391 | esac | ||
| 392 | ;; | ||
| 202 | esac | 393 | esac |
| 203 | ]) | 394 | ]) |
| 204 | 395 | ||
| @@ -232,6 +423,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], | |||
| 232 | esac | 423 | esac |
| 233 | ]) | 424 | ]) |
| 234 | 425 | ||
| 426 | # Extra prerequisites of lib/vasnprintf.c for supporting the # flag with a | ||
| 427 | # zero precision and a zero value in the 'x' and 'X' directives. | ||
| 428 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO], | ||
| 429 | [ | ||
| 430 | AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO]) | ||
| 431 | case "$gl_cv_func_printf_flag_alt_precision_zero" in | ||
| 432 | *yes) | ||
| 433 | ;; | ||
| 434 | *) | ||
| 435 | AC_DEFINE([NEED_PRINTF_FLAG_ALT_PRECISION_ZERO], [1], | ||
| 436 | [Define if the vasnprintf implementation needs special code for the | ||
| 437 | # flag with a zero precision and a zero value in the 'x' and 'X' directives.]) | ||
| 438 | ;; | ||
| 439 | esac | ||
| 440 | ]) | ||
| 441 | |||
| 235 | # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. | 442 | # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. |
| 236 | AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], | 443 | AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], |
| 237 | [ | 444 | [ |
| @@ -276,23 +483,53 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], | |||
| 276 | ]) | 483 | ]) |
| 277 | 484 | ||
| 278 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. | 485 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. |
| 279 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], | 486 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS], |
| 280 | [ | 487 | [ |
| 281 | AC_REQUIRE([gl_PREREQ_VASNPRINTF]) | 488 | AC_REQUIRE([gl_PREREQ_VASNPRINTF]) |
| 282 | gl_PREREQ_VASNPRINTF_LONG_DOUBLE | 489 | gl_PREREQ_VASNPRINTF_LONG_DOUBLE |
| 283 | gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE | 490 | gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE |
| 284 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE | 491 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE |
| 285 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A | 492 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A |
| 493 | gl_PREREQ_VASNPRINTF_DIRECTIVE_B | ||
| 286 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F | 494 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F |
| 287 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LS | 495 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LS |
| 496 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LC | ||
| 288 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING | 497 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING |
| 289 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST | 498 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST |
| 290 | gl_PREREQ_VASNPRINTF_FLAG_ZERO | 499 | gl_PREREQ_VASNPRINTF_FLAG_ZERO |
| 500 | gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO | ||
| 291 | gl_PREREQ_VASNPRINTF_PRECISION | 501 | gl_PREREQ_VASNPRINTF_PRECISION |
| 292 | gl_PREREQ_VASNPRINTF_ENOMEM | 502 | gl_PREREQ_VASNPRINTF_ENOMEM |
| 293 | ]) | 503 | ]) |
| 294 | 504 | ||
| 505 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'B' directive. | ||
| 506 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B], | ||
| 507 | [ | ||
| 508 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B]) | ||
| 509 | case "$gl_cv_func_printf_directive_uppercase_b" in | ||
| 510 | *yes) | ||
| 511 | ;; | ||
| 512 | *) | ||
| 513 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_UPPERCASE_B], [1], | ||
| 514 | [Define if the vasnprintf implementation needs special code for | ||
| 515 | the 'B' directive.]) | ||
| 516 | ;; | ||
| 517 | esac | ||
| 518 | ]) | ||
| 519 | |||
| 520 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance | ||
| 521 | # and GNU compatibility. | ||
| 522 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS], | ||
| 523 | [ | ||
| 524 | gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS | ||
| 525 | AC_DEFINE([SUPPORT_GNU_PRINTF_DIRECTIVES], [1], | ||
| 526 | [Define if the vasnprintf implementation should support GNU compatible | ||
| 527 | printf directives.]) | ||
| 528 | gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B | ||
| 529 | ]) | ||
| 530 | |||
| 295 | # Prerequisites of lib/asnprintf.c. | 531 | # Prerequisites of lib/asnprintf.c. |
| 532 | # Prerequisites of lib/asnwprintf.c. | ||
| 296 | AC_DEFUN([gl_PREREQ_ASNPRINTF], | 533 | AC_DEFUN([gl_PREREQ_ASNPRINTF], |
| 297 | [ | 534 | [ |
| 298 | ]) | 535 | ]) |
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index 6e6156a7..6ea602bd 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # vasprintf.m4 serial 6 | 1 | # vasprintf.m4 |
| 2 | dnl Copyright (C) 2002-2003, 2006-2007, 2009-2023 Free Software Foundation, | 2 | # serial 6 |
| 3 | dnl Copyright (C) 2002-2003, 2006-2007, 2009-2025 Free Software Foundation, | ||
| 3 | dnl Inc. | 4 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 5 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 6 | 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 with or without modifications, as long as this notice is preserved. |
| 8 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 9 | ||
| 8 | AC_DEFUN([gl_FUNC_VASPRINTF], | 10 | AC_DEFUN([gl_FUNC_VASPRINTF], |
| 9 | [ | 11 | [ |
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4 index f0468e89..c2cd38d0 100644 --- a/gl/m4/visibility.m4 +++ b/gl/m4/visibility.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # visibility.m4 serial 8 | 1 | # visibility.m4 |
| 2 | dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 9 |
| 3 | dnl Copyright (C) 2005, 2008, 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | 10 | ||
| @@ -31,18 +33,18 @@ AC_DEFUN([gl_VISIBILITY], | |||
| 31 | dnl user has put into $CC $CFLAGS $CPPFLAGS. | 33 | dnl user has put into $CC $CFLAGS $CPPFLAGS. |
| 32 | AC_CACHE_CHECK([whether the -Werror option is usable], | 34 | AC_CACHE_CHECK([whether the -Werror option is usable], |
| 33 | [gl_cv_cc_vis_werror], | 35 | [gl_cv_cc_vis_werror], |
| 34 | [gl_save_CFLAGS="$CFLAGS" | 36 | [gl_saved_CFLAGS="$CFLAGS" |
| 35 | CFLAGS="$CFLAGS -Werror" | 37 | CFLAGS="$CFLAGS -Werror" |
| 36 | AC_COMPILE_IFELSE( | 38 | AC_COMPILE_IFELSE( |
| 37 | [AC_LANG_PROGRAM([[]], [[]])], | 39 | [AC_LANG_PROGRAM([[]], [[]])], |
| 38 | [gl_cv_cc_vis_werror=yes], | 40 | [gl_cv_cc_vis_werror=yes], |
| 39 | [gl_cv_cc_vis_werror=no]) | 41 | [gl_cv_cc_vis_werror=no]) |
| 40 | CFLAGS="$gl_save_CFLAGS" | 42 | CFLAGS="$gl_saved_CFLAGS" |
| 41 | ]) | 43 | ]) |
| 42 | dnl Now check whether visibility declarations are supported. | 44 | dnl Now check whether visibility declarations are supported. |
| 43 | AC_CACHE_CHECK([for simple visibility declarations], | 45 | AC_CACHE_CHECK([for simple visibility declarations], |
| 44 | [gl_cv_cc_visibility], | 46 | [gl_cv_cc_visibility], |
| 45 | [gl_save_CFLAGS="$CFLAGS" | 47 | [gl_saved_CFLAGS="$CFLAGS" |
| 46 | CFLAGS="$CFLAGS -fvisibility=hidden" | 48 | CFLAGS="$CFLAGS -fvisibility=hidden" |
| 47 | dnl We use the option -Werror and a function dummyfunc, because on some | 49 | dnl We use the option -Werror and a function dummyfunc, because on some |
| 48 | dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning | 50 | dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning |
| @@ -68,7 +70,7 @@ AC_DEFUN([gl_VISIBILITY], | |||
| 68 | [[]])], | 70 | [[]])], |
| 69 | [gl_cv_cc_visibility=yes], | 71 | [gl_cv_cc_visibility=yes], |
| 70 | [gl_cv_cc_visibility=no]) | 72 | [gl_cv_cc_visibility=no]) |
| 71 | CFLAGS="$gl_save_CFLAGS" | 73 | CFLAGS="$gl_saved_CFLAGS" |
| 72 | ]) | 74 | ]) |
| 73 | if test $gl_cv_cc_visibility = yes; then | 75 | if test $gl_cv_cc_visibility = yes; then |
| 74 | CFLAG_VISIBILITY="-fvisibility=hidden" | 76 | CFLAG_VISIBILITY="-fvisibility=hidden" |
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index 7fbb11c4..68ab757d 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # vsnprintf.m4 serial 7 | 1 | # vsnprintf.m4 |
| 2 | dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 7 |
| 3 | dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, | 9 | dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, |
| 8 | dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib | 10 | dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib |
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 index 10649c5c..73cf16fb 100644 --- a/gl/m4/warn-on-use.m4 +++ b/gl/m4/warn-on-use.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # warn-on-use.m4 serial 10 | 1 | # warn-on-use.m4 |
| 2 | dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
| 3 | dnl Copyright (C) 2010-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) | 9 | # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) |
| 8 | # --------------------------------------- | 10 | # --------------------------------------- |
| @@ -36,7 +38,7 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], | |||
| 36 | dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead | 38 | dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead |
| 37 | dnl of ac_compile. If, for whatever reason, the override of AC_PROG_CC | 39 | dnl of ac_compile. If, for whatever reason, the override of AC_PROG_CC |
| 38 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. | 40 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. |
| 39 | ac_save_ac_compile="$ac_compile" | 41 | ac_saved_ac_compile="$ac_compile" |
| 40 | if test -n "$ac_compile_for_check_decl"; then | 42 | if test -n "$ac_compile_for_check_decl"; then |
| 41 | ac_compile="$ac_compile_for_check_decl" | 43 | ac_compile="$ac_compile_for_check_decl" |
| 42 | fi | 44 | fi |
| @@ -46,7 +48,7 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], | |||
| 46 | [[#undef $gl_func | 48 | [[#undef $gl_func |
| 47 | (void) $gl_func;]])], | 49 | (void) $gl_func;]])], |
| 48 | [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) | 50 | [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) |
| 49 | ac_compile="$ac_save_ac_compile" | 51 | ac_compile="$ac_saved_ac_compile" |
| 50 | AS_VAR_IF([gl_Symbol], [yes], | 52 | AS_VAR_IF([gl_Symbol], [yes], |
| 51 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) | 53 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) |
| 52 | dnl Shortcut for an AC_CHECK_DECL invocation that may come later: | 54 | dnl Shortcut for an AC_CHECK_DECL invocation that may come later: |
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4 index 8ec66193..722fcfc2 100644 --- a/gl/m4/wchar_h.m4 +++ b/gl/m4/wchar_h.m4 | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. | 1 | # wchar_h.m4 |
| 2 | 2 | # serial 65 | |
| 3 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 8 | ||
| 8 | dnl Written by Eric Blake. | 9 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. |
| 9 | 10 | ||
| 10 | # wchar_h.m4 serial 55 | 11 | dnl Written by Eric Blake. |
| 11 | 12 | ||
| 12 | AC_DEFUN_ONCE([gl_WCHAR_H], | 13 | AC_DEFUN_ONCE([gl_WCHAR_H], |
| 13 | [ | 14 | [ |
| @@ -86,8 +87,8 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], | |||
| 86 | dnl z/OS when using the XPLINK object format (due to duplicate | 87 | dnl z/OS when using the XPLINK object format (due to duplicate |
| 87 | dnl CSECT names). Instead, temporarily redefine $ac_compile so | 88 | dnl CSECT names). Instead, temporarily redefine $ac_compile so |
| 88 | dnl that the object file has the latter name from the start. | 89 | dnl that the object file has the latter name from the start. |
| 89 | save_ac_compile="$ac_compile" | 90 | saved_ac_compile="$ac_compile" |
| 90 | ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` | 91 | ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest1/` |
| 91 | if echo '#include "conftest.c"' >conftest1.c \ | 92 | if echo '#include "conftest.c"' >conftest1.c \ |
| 92 | && AC_TRY_EVAL([ac_compile]); then | 93 | && AC_TRY_EVAL([ac_compile]); then |
| 93 | AC_LANG_CONFTEST([ | 94 | AC_LANG_CONFTEST([ |
| @@ -97,7 +98,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], | |||
| 97 | int zero (void) { return 0; } | 98 | int zero (void) { return 0; } |
| 98 | ]])]) | 99 | ]])]) |
| 99 | dnl See note above about renaming object files. | 100 | dnl See note above about renaming object files. |
| 100 | ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` | 101 | ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest2/` |
| 101 | if echo '#include "conftest.c"' >conftest2.c \ | 102 | if echo '#include "conftest.c"' >conftest2.c \ |
| 102 | && AC_TRY_EVAL([ac_compile]); then | 103 | && AC_TRY_EVAL([ac_compile]); then |
| 103 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then | 104 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then |
| @@ -107,7 +108,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], | |||
| 107 | fi | 108 | fi |
| 108 | fi | 109 | fi |
| 109 | fi | 110 | fi |
| 110 | ac_compile="$save_ac_compile" | 111 | ac_compile="$saved_ac_compile" |
| 111 | rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext | 112 | rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext |
| 112 | ;; | 113 | ;; |
| 113 | esac | 114 | esac |
| @@ -147,6 +148,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], | |||
| 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) | 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) |
| 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) | 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) |
| 149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) | 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) |
| 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSZERO]) | ||
| 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) | 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) |
| 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) | 153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) |
| 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) | 154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) |
| @@ -185,6 +187,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], | |||
| 185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) | 187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) |
| 186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) | 188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) |
| 187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) | 189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) |
| 190 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WGETCWD]) | ||
| 188 | dnl Support Microsoft deprecated alias function names by default. | 191 | dnl Support Microsoft deprecated alias function names by default. |
| 189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) | 192 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) |
| 190 | ]) | 193 | ]) |
| @@ -253,5 +256,11 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], | |||
| 253 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) | 256 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) |
| 254 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) | 257 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) |
| 255 | REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) | 258 | REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) |
| 259 | REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) | ||
| 260 | REPLACE_WCSNCAT=0; AC_SUBST([REPLACE_WCSNCAT]) | ||
| 261 | REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) | ||
| 262 | REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) | ||
| 256 | REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) | 263 | REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) |
| 264 | REPLACE_WMEMCMP=0; AC_SUBST([REPLACE_WMEMCMP]) | ||
| 265 | REPLACE_WMEMPCPY=0; AC_SUBST([REPLACE_WMEMPCPY]) | ||
| 257 | ]) | 266 | ]) |
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 deleted file mode 100644 index 50bde08a..00000000 --- a/gl/m4/wchar_t.m4 +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | # wchar_t.m4 serial 4 (gettext-0.18.2) | ||
| 2 | dnl Copyright (C) 2002-2003, 2008-2023 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. | ||
| 6 | |||
| 7 | dnl From Bruno Haible. | ||
| 8 | dnl Test whether <stddef.h> has the 'wchar_t' type. | ||
| 9 | dnl Prerequisite: AC_PROG_CC | ||
| 10 | |||
| 11 | AC_DEFUN([gt_TYPE_WCHAR_T], | ||
| 12 | [ | ||
| 13 | AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], | ||
| 14 | [AC_COMPILE_IFELSE( | ||
| 15 | [AC_LANG_PROGRAM( | ||
| 16 | [[#include <stddef.h> | ||
| 17 | wchar_t foo = (wchar_t)'\0';]], | ||
| 18 | [[]])], | ||
| 19 | [gt_cv_c_wchar_t=yes], | ||
| 20 | [gt_cv_c_wchar_t=no])]) | ||
| 21 | if test $gt_cv_c_wchar_t = yes; then | ||
| 22 | AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) | ||
| 23 | fi | ||
| 24 | ]) | ||
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index d51b36e1..91530176 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # wcrtomb.m4 serial 17 | 1 | # wcrtomb.m4 |
| 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. | 2 | # serial 21 |
| 3 | dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_FUNC_WCRTOMB], | 9 | AC_DEFUN([gl_FUNC_WCRTOMB], |
| 8 | [ | 10 | [ |
| @@ -35,7 +37,7 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
| 35 | dnl sometimes returns 0 instead of 1. | 37 | dnl sometimes returns 0 instead of 1. |
| 36 | AC_REQUIRE([AC_PROG_CC]) | 38 | AC_REQUIRE([AC_PROG_CC]) |
| 37 | AC_REQUIRE([gt_LOCALE_FR]) | 39 | AC_REQUIRE([gt_LOCALE_FR]) |
| 38 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 40 | AC_REQUIRE([gt_LOCALE_EN_UTF8]) |
| 39 | AC_REQUIRE([gt_LOCALE_JA]) | 41 | AC_REQUIRE([gt_LOCALE_JA]) |
| 40 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | 42 | AC_REQUIRE([gt_LOCALE_ZH_CN]) |
| 41 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 43 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| @@ -82,12 +84,14 @@ int main () | |||
| 82 | changequote(,)dnl | 84 | changequote(,)dnl |
| 83 | case "$host_os" in | 85 | case "$host_os" in |
| 84 | # Guess no on AIX 4, OSF/1, Solaris, native Windows. | 86 | # Guess no on AIX 4, OSF/1, Solaris, native Windows. |
| 85 | aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; | 87 | aix4* | osf* | solaris* | mingw* | windows*) |
| 88 | gl_cv_func_wcrtomb_retval="guessing no" ;; | ||
| 86 | # Guess yes otherwise. | 89 | # Guess yes otherwise. |
| 87 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; | 90 | *) |
| 91 | gl_cv_func_wcrtomb_retval="guessing yes" ;; | ||
| 88 | esac | 92 | esac |
| 89 | changequote([,])dnl | 93 | changequote([,])dnl |
| 90 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then | 94 | if test $LOCALE_FR != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then |
| 91 | AC_RUN_IFELSE( | 95 | AC_RUN_IFELSE( |
| 92 | [AC_LANG_SOURCE([[ | 96 | [AC_LANG_SOURCE([[ |
| 93 | #include <locale.h> | 97 | #include <locale.h> |
| @@ -97,12 +101,14 @@ changequote([,])dnl | |||
| 97 | int main () | 101 | int main () |
| 98 | { | 102 | { |
| 99 | int result = 0; | 103 | int result = 0; |
| 100 | if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) | 104 | if (strcmp ("$LOCALE_FR", "none") != 0 |
| 105 | && setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
| 101 | { | 106 | { |
| 102 | if (wcrtomb (NULL, 0, NULL) != 1) | 107 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 103 | result |= 1; | 108 | result |= 1; |
| 104 | } | 109 | } |
| 105 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 110 | if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 |
| 111 | && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) | ||
| 106 | { | 112 | { |
| 107 | if (wcrtomb (NULL, 0, NULL) != 1) | 113 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 108 | result |= 2; | 114 | result |= 2; |
| @@ -113,12 +119,14 @@ int main () | |||
| 113 | result |= 2; | 119 | result |= 2; |
| 114 | } | 120 | } |
| 115 | } | 121 | } |
| 116 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 122 | if (strcmp ("$LOCALE_JA", "none") != 0 |
| 123 | && setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
| 117 | { | 124 | { |
| 118 | if (wcrtomb (NULL, 0, NULL) != 1) | 125 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 119 | result |= 4; | 126 | result |= 4; |
| 120 | } | 127 | } |
| 121 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | 128 | if (strcmp ("$LOCALE_ZH_CN", "none") != 0 |
| 129 | && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
| 122 | { | 130 | { |
| 123 | if (wcrtomb (NULL, 0, NULL) != 1) | 131 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 124 | result |= 8; | 132 | result |= 8; |
diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4 new file mode 100644 index 00000000..56593cd5 --- /dev/null +++ b/gl/m4/wctype.m4 | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | # wctype.m4 | ||
| 2 | # serial 6 | ||
| 3 | dnl Copyright (C) 2011-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_ONCE([gl_FUNC_WCTYPE], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_WCTYPE_H]) | ||
| 13 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 14 | HAVE_WCTYPE=$HAVE_WCTYPE_T | ||
| 15 | if test $HAVE_WCTYPE = 1; then | ||
| 16 | AC_CACHE_CHECK([whether wctype supports the "blank" and "punct" character classes], | ||
| 17 | [gl_cv_func_wctype_works], | ||
| 18 | [AC_RUN_IFELSE( | ||
| 19 | [AC_LANG_SOURCE([[ | ||
| 20 | #include <ctype.h> | ||
| 21 | #include <wchar.h> | ||
| 22 | #include <wctype.h> | ||
| 23 | int main () | ||
| 24 | { | ||
| 25 | /* This test fails on mingw. */ | ||
| 26 | if (wctype ("blank") == (wctype_t)0) | ||
| 27 | return 1; | ||
| 28 | /* This test fails on MSVC 14. */ | ||
| 29 | if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t'))) | ||
| 30 | return 2; | ||
| 31 | /* This test fails on Android 11. */ | ||
| 32 | if ((! iswctype ('\`', wctype ("punct"))) != (! ispunct ('\`'))) | ||
| 33 | return 4; | ||
| 34 | return 0; | ||
| 35 | } | ||
| 36 | ]])], | ||
| 37 | [gl_cv_func_wctype_works=yes], [gl_cv_func_wctype_works=no], | ||
| 38 | [case "$host_os" in | ||
| 39 | # Guess no on native Windows. | ||
| 40 | mingw* | windows*) gl_cv_func_wctype_works="guessing no" ;; | ||
| 41 | # Guess no on Android. | ||
| 42 | android*) gl_cv_func_wctype_works="guessing no" ;; | ||
| 43 | # Guess yes otherwise. | ||
| 44 | *) gl_cv_func_wctype_works="guessing yes" ;; | ||
| 45 | esac | ||
| 46 | ]) | ||
| 47 | ]) | ||
| 48 | case "$gl_cv_func_wctype_works" in | ||
| 49 | *yes) ;; | ||
| 50 | *) REPLACE_WCTYPE=1 ;; | ||
| 51 | esac | ||
| 52 | fi | ||
| 53 | ]) | ||
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 index 6856a735..8e54678d 100644 --- a/gl/m4/wctype_h.m4 +++ b/gl/m4/wctype_h.m4 | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | # wctype_h.m4 serial 30 | 1 | # wctype_h.m4 |
| 2 | # serial 33 | ||
| 2 | 3 | ||
| 3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. | 4 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. |
| 4 | 5 | ||
| 5 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. | 6 | dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. |
| 6 | dnl This file is free software; the Free Software Foundation | 7 | dnl This file is free software; the Free Software Foundation |
| 7 | dnl gives unlimited permission to copy and/or distribute it, | 8 | dnl gives unlimited permission to copy and/or distribute it, |
| 8 | dnl with or without modifications, as long as this notice is preserved. | 9 | dnl with or without modifications, as long as this notice is preserved. |
| 10 | dnl This file is offered as-is, without any warranty. | ||
| 9 | 11 | ||
| 10 | dnl Written by Paul Eggert. | 12 | dnl Written by Paul Eggert. |
| 11 | 13 | ||
| @@ -178,6 +180,7 @@ AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], | |||
| 178 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ | 180 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ |
| 179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) | 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) |
| 180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) | 182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) |
| 183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWPUNCT]) | ||
| 181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) | 184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) |
| 182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) | 185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) |
| 183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) | 186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) |
| @@ -196,5 +199,8 @@ AC_DEFUN([gl_WCTYPE_H_DEFAULTS], | |||
| 196 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) | 199 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) |
| 197 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) | 200 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) |
| 198 | REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) | 201 | REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) |
| 202 | REPLACE_ISWPUNCT=0; AC_SUBST([REPLACE_ISWPUNCT]) | ||
| 199 | REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) | 203 | REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) |
| 204 | REPLACE_WCTRANS=0; AC_SUBST([REPLACE_WCTRANS]) | ||
| 205 | REPLACE_WCTYPE=0; AC_SUBST([REPLACE_WCTYPE]) | ||
| 200 | ]) | 206 | ]) |
diff --git a/gl/m4/wcwidth.m4 b/gl/m4/wcwidth.m4 new file mode 100644 index 00000000..2cc6ebb1 --- /dev/null +++ b/gl/m4/wcwidth.m4 | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | # wcwidth.m4 | ||
| 2 | # serial 38 | ||
| 3 | dnl Copyright (C) 2006-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_WCWIDTH], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 13 | |||
| 14 | dnl Persuade glibc <wchar.h> to declare wcwidth(). | ||
| 15 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 16 | |||
| 17 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 18 | |||
| 19 | AC_CHECK_HEADERS_ONCE([wchar.h]) | ||
| 20 | AC_CHECK_FUNCS_ONCE([wcwidth]) | ||
| 21 | |||
| 22 | AC_CHECK_DECLS([wcwidth], [], [], [[ | ||
| 23 | #include <wchar.h> | ||
| 24 | ]]) | ||
| 25 | if test $ac_cv_have_decl_wcwidth != yes; then | ||
| 26 | HAVE_DECL_WCWIDTH=0 | ||
| 27 | fi | ||
| 28 | |||
| 29 | if test $ac_cv_func_wcwidth != yes; then | ||
| 30 | AC_CACHE_CHECK([whether wcwidth is a macro], | ||
| 31 | [gl_cv_func_wcwidth_macro], | ||
| 32 | [AC_EGREP_CPP([wchar_header_defines_wcwidth], [ | ||
| 33 | #include <wchar.h> | ||
| 34 | #ifdef wcwidth | ||
| 35 | wchar_header_defines_wcwidth | ||
| 36 | #endif], | ||
| 37 | [gl_cv_func_wcwidth_macro=yes], | ||
| 38 | [gl_cv_func_wcwidth_macro=no]) | ||
| 39 | ]) | ||
| 40 | fi | ||
| 41 | |||
| 42 | if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then | ||
| 43 | HAVE_WCWIDTH=1 | ||
| 44 | dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. | ||
| 45 | dnl On macOS 12.5, NetBSD 9.3, OpenBSD 5.0, MidnightBSD 1.1, | ||
| 46 | dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. | ||
| 47 | dnl On macOS 12.5, NetBSD 9.3, MidnightBSD 1.1, OSF/1 5.1, | ||
| 48 | dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. | ||
| 49 | dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0. | ||
| 50 | dnl This leads to bugs in 'ls' (coreutils). | ||
| 51 | dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2, | ||
| 52 | dnl even in Western locales. | ||
| 53 | AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], | ||
| 54 | [gl_cv_func_wcwidth_works], | ||
| 55 | [ | ||
| 56 | AC_RUN_IFELSE( | ||
| 57 | [AC_LANG_SOURCE([[ | ||
| 58 | #include <locale.h> | ||
| 59 | #include <wchar.h> | ||
| 60 | #if !HAVE_DECL_WCWIDTH | ||
| 61 | extern | ||
| 62 | # ifdef __cplusplus | ||
| 63 | "C" | ||
| 64 | # endif | ||
| 65 | int wcwidth (int); | ||
| 66 | #endif | ||
| 67 | int main () | ||
| 68 | { | ||
| 69 | int result = 0; | ||
| 70 | if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) | ||
| 71 | { | ||
| 72 | if (wcwidth (0x0301) > 0) | ||
| 73 | result |= 1; | ||
| 74 | if (wcwidth (0x05B0) > 0) | ||
| 75 | result |= 2; | ||
| 76 | if (wcwidth (0x200B) > 0) | ||
| 77 | result |= 4; | ||
| 78 | if (wcwidth (0xFF1A) == 0) | ||
| 79 | result |= 8; | ||
| 80 | if (wcwidth (0x2202) > 1) | ||
| 81 | result |= 16; | ||
| 82 | } | ||
| 83 | return result; | ||
| 84 | }]])], | ||
| 85 | [gl_cv_func_wcwidth_works=yes], | ||
| 86 | [gl_cv_func_wcwidth_works=no], | ||
| 87 | [ | ||
| 88 | changequote(,)dnl | ||
| 89 | case "$host_os" in | ||
| 90 | # Guess yes on glibc systems. | ||
| 91 | *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; | ||
| 92 | # Guess yes on musl systems. | ||
| 93 | *-musl* | midipix*) gl_cv_func_wcwidth_works="guessing yes";; | ||
| 94 | # Guess yes on AIX 7 systems. | ||
| 95 | aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; | ||
| 96 | *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; | ||
| 97 | esac | ||
| 98 | changequote([,])dnl | ||
| 99 | ]) | ||
| 100 | ]) | ||
| 101 | case "$gl_cv_func_wcwidth_works" in | ||
| 102 | *yes) ;; | ||
| 103 | *no) REPLACE_WCWIDTH=1 ;; | ||
| 104 | esac | ||
| 105 | else | ||
| 106 | HAVE_WCWIDTH=0 | ||
| 107 | fi | ||
| 108 | dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not | ||
| 109 | dnl have the wcwidth function, then it does not declare it. | ||
| 110 | ]) | ||
| 111 | |||
| 112 | # Prerequisites of lib/wcwidth.c. | ||
| 113 | AC_DEFUN([gl_PREREQ_WCWIDTH], [ | ||
| 114 | AC_REQUIRE([AC_C_INLINE]) | ||
| 115 | : | ||
| 116 | ]) | ||
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index dfd743b3..8a3c7944 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # wint_t.m4 serial 11 | 1 | # wint_t.m4 |
| 2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 11 |
| 3 | dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl From Bruno Haible. | 9 | dnl From Bruno Haible. |
| 8 | dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's | 10 | dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's |
diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4 index fc56f59a..c10c4189 100644 --- a/gl/m4/xalloc.m4 +++ b/gl/m4/xalloc.m4 | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | # xalloc.m4 serial 18 | 1 | # xalloc.m4 |
| 2 | dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 18 |
| 3 | dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_XALLOC], [:]) | 9 | AC_DEFUN([gl_XALLOC], [:]) |
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index 649db9c5..157d635c 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # xsize.m4 serial 5 | 1 | # xsize.m4 |
| 2 | dnl Copyright (C) 2003-2004, 2008-2023 Free Software Foundation, Inc. | 2 | # serial 5 |
| 3 | dnl Copyright (C) 2003-2004, 2008-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | AC_DEFUN([gl_XSIZE], | 9 | AC_DEFUN([gl_XSIZE], |
| 8 | [ | 10 | [ |
diff --git a/gl/m4/zzgnulib.m4 b/gl/m4/zzgnulib.m4 index 362102b6..343bda5c 100644 --- a/gl/m4/zzgnulib.m4 +++ b/gl/m4/zzgnulib.m4 | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | # zzgnulib.m4 serial 1 | 1 | # zzgnulib.m4 |
| 2 | dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 6 | 8 | ||
| 7 | dnl This file must be named something that sorts after all other | 9 | dnl This file must be named something that sorts after all other |
| 8 | dnl package- or gnulib-provided .m4 files - at least for those packages | 10 | dnl package- or gnulib-provided .m4 files - at least for those packages |
