diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 13:46:01 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 13:46:01 (GMT) |
commit | e8bd88d1fcded01ccd066572eeaae1b507989cb3 (patch) | |
tree | c8e7be6c07c6f635f6e803e6a6ba9e7a95fee7c0 /gl/m4 | |
parent | 2ad962c13473607ca0d974bfaa516a0ed53ec73d (diff) | |
download | monitoring-plugins-e8bd88d1fcded01ccd066572eeaae1b507989cb3.tar.gz |
Sync with the latest Gnulib code 668c0b8ffa
Diffstat (limited to 'gl/m4')
187 files changed, 12551 insertions, 4870 deletions
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index d4ad759..7fe03e0 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 | |||
@@ -1,27 +1,82 @@ | |||
1 | # 00gnulib.m4 serial 2 | 1 | # 00gnulib.m4 serial 8 |
2 | dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl This file must be named something that sorts before all other | 7 | dnl This file must be named something that sorts before all other |
8 | dnl gnulib-provided .m4 files. It is needed until such time as we can | 8 | dnl gnulib-provided .m4 files. It is needed until the clang fix has |
9 | dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. | 9 | dnl been included in Autoconf. |
10 | 10 | ||
11 | # AC_DEFUN_ONCE([NAME], VALUE) | 11 | # The following definitions arrange to use a compiler option |
12 | # ---------------------------- | 12 | # -Werror=implicit-function-declaration in AC_CHECK_DECL, when the |
13 | # Define NAME to expand to VALUE on the first use (whether by direct | 13 | # compiler is clang. Without it, clang implicitly declares "known" |
14 | # expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. | 14 | # library functions in C mode, but not in C++ mode, which would cause |
15 | # Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This | 15 | # Gnulib to omit a declaration and thus later produce an error in C++ |
16 | # definition is slower than the version in Autoconf 2.64, because it | 16 | # mode. As of clang 9.0, these "known" functions are identified through |
17 | # can only use interfaces that existed since 2.59; but it achieves the | 17 | # LIBBUILTIN invocations in the LLVM source file |
18 | # same effect. Quoting is necessary to avoid confusing Automake. | 18 | # llvm/tools/clang/include/clang/Basic/Builtins.def. |
19 | m4_version_prereq([2.63.263], [], | 19 | # It's not possible to AC_REQUIRE the extra tests from AC_CHECK_DECL, |
20 | [m4_define([AC][_DEFUN_ONCE], | 20 | # because AC_CHECK_DECL, like other Autoconf built-ins, is not supposed |
21 | [AC][_DEFUN([$1], | 21 | # to AC_REQUIRE anything: some configure.ac files have their first |
22 | [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], | 22 | # AC_CHECK_DECL executed conditionally. Therefore append the extra tests |
23 | [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl | 23 | # to AC_PROG_CC. |
24 | [AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) | 24 | AC_DEFUN([gl_COMPILER_CLANG], |
25 | [ | ||
26 | dnl AC_REQUIRE([AC_PROG_CC]) | ||
27 | AC_CACHE_CHECK([whether the compiler is clang], | ||
28 | [gl_cv_compiler_clang], | ||
29 | [dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error | ||
30 | dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has | ||
31 | dnl not yet been invoked. | ||
32 | _AC_COMPILE_IFELSE( | ||
33 | [AC_LANG_PROGRAM([[ | ||
34 | #ifdef __clang__ | ||
35 | barfbarf | ||
36 | #endif | ||
37 | ]],[[]]) | ||
38 | ], | ||
39 | [gl_cv_compiler_clang=no], | ||
40 | [gl_cv_compiler_clang=yes]) | ||
41 | ]) | ||
42 | ]) | ||
43 | AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL], | ||
44 | [ | ||
45 | dnl AC_REQUIRE([AC_PROG_CC]) | ||
46 | dnl AC_REQUIRE([gl_COMPILER_CLANG]) | ||
47 | AC_CACHE_CHECK([for compiler option needed when checking for declarations], | ||
48 | [gl_cv_compiler_check_decl_option], | ||
49 | [if test $gl_cv_compiler_clang = yes; then | ||
50 | dnl Test whether the compiler supports the option | ||
51 | dnl '-Werror=implicit-function-declaration'. | ||
52 | save_ac_compile="$ac_compile" | ||
53 | ac_compile="$ac_compile -Werror=implicit-function-declaration" | ||
54 | 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". | ||
56 | _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], | ||
57 | [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], | ||
58 | [gl_cv_compiler_check_decl_option=none]) | ||
59 | ac_compile="$save_ac_compile" | ||
60 | else | ||
61 | gl_cv_compiler_check_decl_option=none | ||
62 | fi | ||
63 | ]) | ||
64 | if test "x$gl_cv_compiler_check_decl_option" != xnone; then | ||
65 | ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" | ||
66 | else | ||
67 | ac_compile_for_check_decl="$ac_compile" | ||
68 | fi | ||
69 | ]) | ||
70 | 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 | ||
72 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. | ||
73 | m4_define([_AC_CHECK_DECL_BODY], | ||
74 | [ ac_save_ac_compile="$ac_compile" | ||
75 | if test -n "$ac_compile_for_check_decl"; then | ||
76 | ac_compile="$ac_compile_for_check_decl" | ||
77 | fi] | ||
78 | m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" | ||
79 | ]) | ||
25 | 80 | ||
26 | # gl_00GNULIB | 81 | # gl_00GNULIB |
27 | # ----------- | 82 | # ----------- |
diff --git a/gl/m4/__inline.m4 b/gl/m4/__inline.m4 new file mode 100644 index 0000000..acf8668 --- /dev/null +++ b/gl/m4/__inline.m4 | |||
@@ -0,0 +1,22 @@ | |||
1 | # Test for __inline keyword | ||
2 | dnl Copyright 2017-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___INLINE], | ||
8 | [ | ||
9 | AC_CACHE_CHECK([whether the compiler supports the __inline keyword], | ||
10 | [gl_cv_c___inline], | ||
11 | [AC_COMPILE_IFELSE( | ||
12 | [AC_LANG_PROGRAM( | ||
13 | [[typedef int foo_t; | ||
14 | static __inline foo_t foo (void) { return 0; }]], | ||
15 | [[return foo ();]])], | ||
16 | [gl_cv_c___inline=yes], | ||
17 | [gl_cv_c___inline=no])]) | ||
18 | if test $gl_cv_c___inline = yes; then | ||
19 | AC_DEFINE([HAVE___INLINE], [1], | ||
20 | [Define to 1 if the compiler supports the keyword '__inline'.]) | ||
21 | fi | ||
22 | ]) | ||
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4 new file mode 100644 index 0000000..e794764 --- /dev/null +++ b/gl/m4/absolute-header.m4 | |||
@@ -0,0 +1,100 @@ | |||
1 | # absolute-header.m4 serial 17 | ||
2 | dnl Copyright (C) 2006-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 Derek Price. | ||
8 | |||
9 | # gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...) | ||
10 | # --------------------------------------- | ||
11 | # Find the absolute name of a header file, testing first if the header exists. | ||
12 | # If the header were sys/inttypes.h, this macro would define | ||
13 | # ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h | ||
14 | # in config.h | ||
15 | # (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"'). | ||
16 | # The three "///" are to pacify Sun C 5.8, which otherwise would say | ||
17 | # "warning: #include of /usr/include/... may be non-portable". | ||
18 | # Use '""', not '<>', so that the /// cannot be confused with a C99 comment. | ||
19 | # Note: This macro assumes that the header file is not empty after | ||
20 | # preprocessing, i.e. it does not only define preprocessor macros but also | ||
21 | # provides some type/enum definitions or function/variable declarations. | ||
22 | AC_DEFUN([gl_ABSOLUTE_HEADER], | ||
23 | [AC_REQUIRE([AC_CANONICAL_HOST]) | ||
24 | AC_LANG_PREPROC_REQUIRE()dnl | ||
25 | m4_foreach_w([gl_HEADER_NAME], [$1], | ||
26 | [AS_VAR_PUSHDEF([gl_absolute_header], | ||
27 | [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl | ||
28 | AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>], | ||
29 | [gl_absolute_header], | ||
30 | [AS_VAR_PUSHDEF([ac_header_exists], | ||
31 | [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl | ||
32 | AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl | ||
33 | if test AS_VAR_GET([ac_header_exists]) = yes; then | ||
34 | gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME])) | ||
35 | fi | ||
36 | AS_VAR_POPDEF([ac_header_exists])dnl | ||
37 | ])dnl | ||
38 | AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])), | ||
39 | ["AS_VAR_GET([gl_absolute_header])"], | ||
40 | [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.]) | ||
41 | AS_VAR_POPDEF([gl_absolute_header])dnl | ||
42 | ])dnl | ||
43 | ])# gl_ABSOLUTE_HEADER | ||
44 | |||
45 | # gl_ABSOLUTE_HEADER_ONE(HEADER) | ||
46 | # ------------------------------ | ||
47 | # Like gl_ABSOLUTE_HEADER, except that: | ||
48 | # - it assumes that the header exists, | ||
49 | # - it uses the current CPPFLAGS, | ||
50 | # - it does not cache the result, | ||
51 | # - it is silent. | ||
52 | AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], | ||
53 | [ | ||
54 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
55 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])]) | ||
56 | dnl AIX "xlc -E" and "cc -E" omit #line directives for header files | ||
57 | dnl that contain only a #include of other header files and no | ||
58 | dnl non-comment tokens of their own. This leads to a failure to | ||
59 | dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> | ||
60 | dnl and others. The workaround is to force preservation of comments | ||
61 | dnl through option -C. This ensures all necessary #line directives | ||
62 | dnl are present. GCC supports option -C as well. | ||
63 | case "$host_os" in | ||
64 | aix*) gl_absname_cpp="$ac_cpp -C" ;; | ||
65 | *) gl_absname_cpp="$ac_cpp" ;; | ||
66 | esac | ||
67 | changequote(,) | ||
68 | case "$host_os" in | ||
69 | mingw*) | ||
70 | dnl For the sake of native Windows compilers (excluding gcc), | ||
71 | dnl treat backslash as a directory separator, like /. | ||
72 | dnl Actually, these compilers use a double-backslash as | ||
73 | dnl directory separator, inside the | ||
74 | dnl # line "filename" | ||
75 | dnl directives. | ||
76 | gl_dirsep_regex='[/\\]' | ||
77 | ;; | ||
78 | *) | ||
79 | gl_dirsep_regex='\/' | ||
80 | ;; | ||
81 | esac | ||
82 | dnl A sed expression that turns a string into a basic regular | ||
83 | dnl expression, for use within "/.../". | ||
84 | gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' | ||
85 | gl_header_literal_regex=`echo '$1' \ | ||
86 | | sed -e "$gl_make_literal_regex_sed"` | ||
87 | gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ | ||
88 | s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ | ||
89 | s|^/[^/]|//&| | ||
90 | p | ||
91 | q | ||
92 | }' | ||
93 | changequote([,]) | ||
94 | dnl eval is necessary to expand gl_absname_cpp. | ||
95 | dnl Ultrix and Pyramid sh refuse to redirect output of eval, | ||
96 | dnl so use subshell. | ||
97 | AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]), | ||
98 | [`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | | ||
99 | sed -n "$gl_absolute_header_sed"`]) | ||
100 | ]) | ||
diff --git a/gl/m4/af_alg.m4 b/gl/m4/af_alg.m4 new file mode 100644 index 0000000..f4c0d62 --- /dev/null +++ b/gl/m4/af_alg.m4 | |||
@@ -0,0 +1,57 @@ | |||
1 | # af_alg.m4 serial 6 | ||
2 | dnl Copyright 2018-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 Matteo Croce. | ||
8 | |||
9 | AC_DEFUN_ONCE([gl_AF_ALG], | ||
10 | [ | ||
11 | AC_REQUIRE([gl_SYS_SOCKET_H]) | ||
12 | AC_REQUIRE([AC_C_INLINE]) | ||
13 | |||
14 | dnl Check whether linux/if_alg.h has needed features. | ||
15 | AC_CACHE_CHECK([whether linux/if_alg.h has struct sockaddr_alg.], | ||
16 | [gl_cv_header_linux_if_alg_salg], | ||
17 | [AC_COMPILE_IFELSE( | ||
18 | [AC_LANG_PROGRAM([[#include <sys/socket.h> | ||
19 | #include <linux/if_alg.h> | ||
20 | struct sockaddr_alg salg = { | ||
21 | .salg_family = AF_ALG, | ||
22 | .salg_type = "hash", | ||
23 | .salg_name = "sha1", | ||
24 | };]])], | ||
25 | [gl_cv_header_linux_if_alg_salg=yes], | ||
26 | [gl_cv_header_linux_if_alg_salg=no])]) | ||
27 | if test "$gl_cv_header_linux_if_alg_salg" = yes; then | ||
28 | AC_DEFINE([HAVE_LINUX_IF_ALG_H], [1], | ||
29 | [Define to 1 if you have 'struct sockaddr_alg' defined.]) | ||
30 | fi | ||
31 | |||
32 | dnl The default is to not use AF_ALG if available, | ||
33 | dnl as it's system dependent as to whether the kernel | ||
34 | dnl routines are faster than libcrypto for example. | ||
35 | use_af_alg=no | ||
36 | AC_ARG_WITH([linux-crypto], | ||
37 | [AS_HELP_STRING([[--with-linux-crypto]], | ||
38 | [use Linux kernel cryptographic API (if available) for the hash functions | ||
39 | MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512 on files])], | ||
40 | [use_af_alg=$withval], | ||
41 | [use_af_alg=no]) | ||
42 | dnl We cannot use it if it is not available. | ||
43 | if test "$gl_cv_header_linux_if_alg_salg" != yes; then | ||
44 | if test "$use_af_alg" != no; then | ||
45 | AC_MSG_WARN([Linux kernel cryptographic API not found]) | ||
46 | fi | ||
47 | use_af_alg=no | ||
48 | fi | ||
49 | |||
50 | if test "$use_af_alg" != no; then | ||
51 | USE_AF_ALG=1 | ||
52 | else | ||
53 | USE_AF_ALG=0 | ||
54 | fi | ||
55 | AC_DEFINE_UNQUOTED([USE_LINUX_CRYPTO_API], [$USE_AF_ALG], | ||
56 | [Define to 1 if you want to use the Linux kernel cryptographic API.]) | ||
57 | ]) | ||
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index 270abd0..c685fac 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # alloca.m4 serial 14 | 1 | # alloca.m4 serial 21 |
2 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2013 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2023 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl 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, |
@@ -26,30 +26,35 @@ AC_DEFUN([gl_FUNC_ALLOCA], | |||
26 | AC_DEFINE([HAVE_ALLOCA], [1], | 26 | AC_DEFINE([HAVE_ALLOCA], [1], |
27 | [Define to 1 if you have 'alloca' after including <alloca.h>, | 27 | [Define to 1 if you have 'alloca' after including <alloca.h>, |
28 | a header that may be supplied by this distribution.]) | 28 | a header that may be supplied by this distribution.]) |
29 | ALLOCA_H=alloca.h | 29 | GL_GENERATE_ALLOCA_H=true |
30 | else | 30 | else |
31 | dnl alloca exists as a library function, i.e. it is slow and probably | 31 | dnl alloca exists as a library function, i.e. it is slow and probably |
32 | dnl a memory leak. Don't define HAVE_ALLOCA in this case. | 32 | dnl a memory leak. Don't define HAVE_ALLOCA in this case. |
33 | ALLOCA_H= | 33 | GL_GENERATE_ALLOCA_H=false |
34 | fi | 34 | fi |
35 | else | 35 | else |
36 | ALLOCA_H=alloca.h | 36 | GL_GENERATE_ALLOCA_H=true |
37 | fi | 37 | fi |
38 | AC_SUBST([ALLOCA_H]) | 38 | |
39 | AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) | 39 | if test $ac_cv_working_alloca_h = yes; then |
40 | HAVE_ALLOCA_H=1 | ||
41 | else | ||
42 | HAVE_ALLOCA_H=0 | ||
43 | fi | ||
44 | AC_SUBST([HAVE_ALLOCA_H]) | ||
40 | ]) | 45 | ]) |
41 | 46 | ||
42 | # Prerequisites of lib/alloca.c. | 47 | # Prerequisites of lib/alloca.c. |
43 | # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. | 48 | # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. |
44 | AC_DEFUN([gl_PREREQ_ALLOCA], [:]) | 49 | AC_DEFUN([gl_PREREQ_ALLOCA], [:]) |
45 | 50 | ||
46 | # This works around a bug in autoconf <= 2.68. | 51 | m4_version_prereq([2.70], [], [ |
47 | # See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>. | ||
48 | 52 | ||
49 | m4_version_prereq([2.69], [] ,[ | 53 | # This works around a bug in autoconf <= 2.68 and has simplifications |
50 | 54 | # from 2.70. See: | |
51 | # This is taken from the following Autoconf patch: | 55 | # https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html |
52 | # http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 | 56 | # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 |
57 | # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a | ||
53 | 58 | ||
54 | # _AC_LIBOBJ_ALLOCA | 59 | # _AC_LIBOBJ_ALLOCA |
55 | # ----------------- | 60 | # ----------------- |
@@ -65,26 +70,6 @@ AC_LIBSOURCES(alloca.c) | |||
65 | AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl | 70 | AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl |
66 | AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) | 71 | AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) |
67 | 72 | ||
68 | AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray, | ||
69 | [AC_EGREP_CPP(webecray, | ||
70 | [#if defined CRAY && ! defined CRAY2 | ||
71 | webecray | ||
72 | #else | ||
73 | wenotbecray | ||
74 | #endif | ||
75 | ], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) | ||
76 | if test $ac_cv_os_cray = yes; then | ||
77 | for ac_func in _getb67 GETB67 getb67; do | ||
78 | AC_CHECK_FUNC($ac_func, | ||
79 | [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, | ||
80 | [Define to one of '_getb67', 'GETB67', | ||
81 | 'getb67' for Cray-2 and Cray-YMP | ||
82 | systems. This function is required for | ||
83 | 'alloca.c' support on those systems.]) | ||
84 | break]) | ||
85 | done | ||
86 | fi | ||
87 | |||
88 | AC_CACHE_CHECK([stack direction for C alloca], | 73 | AC_CACHE_CHECK([stack direction for C alloca], |
89 | [ac_cv_c_stack_direction], | 74 | [ac_cv_c_stack_direction], |
90 | [AC_RUN_IFELSE([AC_LANG_SOURCE( | 75 | [AC_RUN_IFELSE([AC_LANG_SOURCE( |
@@ -115,7 +100,7 @@ AH_VERBATIM([STACK_DIRECTION], | |||
115 | STACK_DIRECTION > 0 => grows toward higher addresses | 100 | STACK_DIRECTION > 0 => grows toward higher addresses |
116 | STACK_DIRECTION < 0 => grows toward lower addresses | 101 | STACK_DIRECTION < 0 => grows toward lower addresses |
117 | STACK_DIRECTION = 0 => direction of growth unknown */ | 102 | STACK_DIRECTION = 0 => direction of growth unknown */ |
118 | @%:@undef STACK_DIRECTION])dnl | 103 | #undef STACK_DIRECTION])dnl |
119 | AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) | 104 | AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) |
120 | ])# _AC_LIBOBJ_ALLOCA | 105 | ])# _AC_LIBOBJ_ALLOCA |
121 | ]) | 106 | ]) |
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 index ea69af5..fa5fe83 100644 --- a/gl/m4/arpa_inet_h.m4 +++ b/gl/m4/arpa_inet_h.m4 | |||
@@ -1,15 +1,15 @@ | |||
1 | # arpa_inet_h.m4 serial 13 | 1 | # arpa_inet_h.m4 serial 17 |
2 | dnl Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl Written by Simon Josefsson and Bruno Haible | 7 | dnl Written by Simon Josefsson and Bruno Haible |
8 | 8 | ||
9 | AC_DEFUN([gl_HEADER_ARPA_INET], | 9 | AC_DEFUN_ONCE([gl_ARPA_INET_H], |
10 | [ | 10 | [ |
11 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | 11 | dnl Ensure to expand the default settings once only, before all statements |
12 | dnl once only, before all statements that occur in other macros. | 12 | dnl that occur in other macros. |
13 | AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) | 13 | AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) |
14 | 14 | ||
15 | AC_CHECK_HEADERS_ONCE([arpa/inet.h]) | 15 | AC_CHECK_HEADERS_ONCE([arpa/inet.h]) |
@@ -24,6 +24,8 @@ AC_DEFUN([gl_HEADER_ARPA_INET], | |||
24 | 24 | ||
25 | AC_REQUIRE([gl_FEATURES_H]) | 25 | AC_REQUIRE([gl_FEATURES_H]) |
26 | 26 | ||
27 | gl_PREREQ_SYS_H_WS2TCPIP | ||
28 | |||
27 | dnl Check for declarations of anything we want to poison if the | 29 | dnl Check for declarations of anything we want to poison if the |
28 | dnl corresponding gnulib module is not in use. | 30 | dnl corresponding gnulib module is not in use. |
29 | gl_WARN_ON_USE_PREPARE([[ | 31 | gl_WARN_ON_USE_PREPARE([[ |
@@ -38,17 +40,32 @@ AC_DEFUN([gl_HEADER_ARPA_INET], | |||
38 | ]], [inet_ntop inet_pton]) | 40 | ]], [inet_ntop inet_pton]) |
39 | ]) | 41 | ]) |
40 | 42 | ||
43 | # gl_ARPA_INET_MODULE_INDICATOR([modulename]) | ||
44 | # sets the shell variable that indicates the presence of the given module | ||
45 | # to a C preprocessor expression that will evaluate to 1. | ||
46 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
41 | AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], | 47 | AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], |
42 | [ | 48 | [ |
43 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 49 | dnl Ensure to expand the default settings once only. |
44 | AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) | 50 | gl_ARPA_INET_H_REQUIRE_DEFAULTS |
45 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 51 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
46 | ]) | 52 | ]) |
47 | 53 | ||
54 | # Initializes the default values for AC_SUBSTed shell variables. | ||
55 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
56 | # outside of macros or in macros that are not AC_REQUIREd. | ||
57 | AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS], | ||
58 | [ | ||
59 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS], [ | ||
60 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_NTOP]) | ||
61 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_PTON]) | ||
62 | ]) | ||
63 | m4_require(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS]) | ||
64 | AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) | ||
65 | ]) | ||
66 | |||
48 | AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], | 67 | AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], |
49 | [ | 68 | [ |
50 | GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP]) | ||
51 | GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON]) | ||
52 | dnl Assume proper GNU behavior unless another module says otherwise. | 69 | dnl Assume proper GNU behavior unless another module says otherwise. |
53 | HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) | 70 | HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) |
54 | HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) | 71 | HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) |
diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4 new file mode 100644 index 0000000..abba4fa --- /dev/null +++ b/gl/m4/assert_h.m4 | |||
@@ -0,0 +1,67 @@ | |||
1 | # assert-h.m4 | ||
2 | dnl Copyright (C) 2011-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 Paul Eggert. | ||
8 | |||
9 | AC_DEFUN([gl_ASSERT_H], | ||
10 | [ | ||
11 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], | ||
12 | [gl_save_CFLAGS=$CFLAGS | ||
13 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do | ||
14 | AS_CASE([$gl_working], | ||
15 | [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"]) | ||
16 | |||
17 | AC_COMPILE_IFELSE( | ||
18 | [AC_LANG_PROGRAM( | ||
19 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 | ||
20 | #pragma clang diagnostic error "-Wc2x-extensions" | ||
21 | #pragma clang diagnostic error "-Wc++17-extensions" | ||
22 | #endif | ||
23 | #ifdef INCLUDE_ASSERT_H | ||
24 | #include <assert.h> | ||
25 | #endif | ||
26 | static_assert (2 + 2 == 4, "arithmetic does not work"); | ||
27 | static_assert (2 + 2 == 4); | ||
28 | ]], | ||
29 | [[ | ||
30 | static_assert (sizeof (char) == 1, "sizeof does not work"); | ||
31 | static_assert (sizeof (char) == 1); | ||
32 | ]])], | ||
33 | [gl_cv_static_assert=$gl_working], | ||
34 | [gl_cv_static_assert=no]) | ||
35 | CFLAGS=$gl_save_CFLAGS | ||
36 | test "$gl_cv_static_assert" != no && break | ||
37 | done]) | ||
38 | |||
39 | GL_GENERATE_ASSERT_H=false | ||
40 | AS_CASE([$gl_cv_static_assert], | ||
41 | [yes*keyword*], | ||
42 | [AC_DEFINE([HAVE_C_STATIC_ASSERT], [1], | ||
43 | [Define to 1 if the static_assert keyword works.])], | ||
44 | [no], | ||
45 | [GL_GENERATE_ASSERT_H=true | ||
46 | gl_NEXT_HEADERS([assert.h])]) | ||
47 | |||
48 | dnl The "zz" puts this toward config.h's end, to avoid potential | ||
49 | dnl collisions with other definitions. #undef assert so that | ||
50 | dnl programs are not tempted to use it without specifically | ||
51 | dnl including assert.h. Break the #undef apart with a comment | ||
52 | dnl so that 'configure' does not comment it out. | ||
53 | AH_VERBATIM([zzstatic_assert], | ||
54 | [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ | ||
55 | && (!defined __cplusplus \ | ||
56 | || (__cpp_static_assert < 201411 \ | ||
57 | && __GNUG__ < 6 && __clang_major__ < 6))) | ||
58 | #include <assert.h> | ||
59 | #undef/**/assert | ||
60 | /* 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. */ | ||
62 | #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus | ||
63 | #undef/**/static_assert | ||
64 | #define static_assert _Static_assert | ||
65 | #endif | ||
66 | #endif]) | ||
67 | ]) | ||
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4 index fc19893..987930a 100644 --- a/gl/m4/base64.m4 +++ b/gl/m4/base64.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # base64.m4 serial 4 | 1 | # base64.m4 serial 4 |
2 | dnl Copyright (C) 2004, 2006, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index 978a06e..77218a7 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # btowc.m4 serial 10 | 1 | # btowc.m4 serial 12 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_BTOWC], | |||
10 | 10 | ||
11 | dnl Check whether <wchar.h> is usable at all, first. Otherwise the test | 11 | dnl Check whether <wchar.h> is usable at all, first. Otherwise the test |
12 | dnl program below may lead to an endless loop. See | 12 | dnl program below may lead to an endless loop. See |
13 | dnl <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. | 13 | dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. |
14 | AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) | 14 | AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) |
15 | 15 | ||
16 | AC_CHECK_FUNCS_ONCE([btowc]) | 16 | AC_CHECK_FUNCS_ONCE([btowc]) |
@@ -28,14 +28,6 @@ AC_DEFUN([gl_FUNC_BTOWC], | |||
28 | [ | 28 | [ |
29 | AC_RUN_IFELSE( | 29 | AC_RUN_IFELSE( |
30 | [AC_LANG_SOURCE([[ | 30 | [AC_LANG_SOURCE([[ |
31 | #include <string.h> | ||
32 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
33 | <wchar.h>. | ||
34 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
35 | included before <wchar.h>. */ | ||
36 | #include <stddef.h> | ||
37 | #include <stdio.h> | ||
38 | #include <time.h> | ||
39 | #include <wchar.h> | 31 | #include <wchar.h> |
40 | int main () | 32 | int main () |
41 | { | 33 | { |
@@ -50,6 +42,8 @@ changequote(,)dnl | |||
50 | case "$host_os" in | 42 | case "$host_os" in |
51 | # Guess no on Cygwin. | 43 | # Guess no on Cygwin. |
52 | cygwin*) gl_cv_func_btowc_nul="guessing no" ;; | 44 | cygwin*) gl_cv_func_btowc_nul="guessing no" ;; |
45 | # Guess yes on native Windows. | ||
46 | mingw*) gl_cv_func_btowc_nul="guessing yes" ;; | ||
53 | # Guess yes otherwise. | 47 | # Guess yes otherwise. |
54 | *) gl_cv_func_btowc_nul="guessing yes" ;; | 48 | *) gl_cv_func_btowc_nul="guessing yes" ;; |
55 | esac | 49 | esac |
@@ -65,24 +59,19 @@ changequote([,])dnl | |||
65 | dnl is present. | 59 | dnl is present. |
66 | changequote(,)dnl | 60 | changequote(,)dnl |
67 | case "$host_os" in | 61 | case "$host_os" in |
68 | # Guess no on IRIX. | 62 | # Guess no on IRIX. |
69 | irix*) gl_cv_func_btowc_eof="guessing no" ;; | 63 | irix*) gl_cv_func_btowc_eof="guessing no" ;; |
70 | # Guess yes otherwise. | 64 | # Guess yes on native Windows. |
71 | *) gl_cv_func_btowc_eof="guessing yes" ;; | 65 | mingw*) gl_cv_func_btowc_eof="guessing yes" ;; |
66 | # Guess yes otherwise. | ||
67 | *) gl_cv_func_btowc_eof="guessing yes" ;; | ||
72 | esac | 68 | esac |
73 | changequote([,])dnl | 69 | changequote([,])dnl |
74 | if test $LOCALE_FR != none; then | 70 | if test $LOCALE_FR != none; then |
75 | AC_RUN_IFELSE( | 71 | AC_RUN_IFELSE( |
76 | [AC_LANG_SOURCE([[ | 72 | [AC_LANG_SOURCE([[ |
77 | #include <locale.h> | 73 | #include <locale.h> |
78 | #include <string.h> | ||
79 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
80 | <wchar.h>. | ||
81 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
82 | included before <wchar.h>. */ | ||
83 | #include <stddef.h> | ||
84 | #include <stdio.h> | 74 | #include <stdio.h> |
85 | #include <time.h> | ||
86 | #include <wchar.h> | 75 | #include <wchar.h> |
87 | int main () | 76 | int main () |
88 | { | 77 | { |
diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4 new file mode 100644 index 0000000..531ed48 --- /dev/null +++ b/gl/m4/builtin-expect.m4 | |||
@@ -0,0 +1,49 @@ | |||
1 | dnl Check for __builtin_expect. | ||
2 | |||
3 | dnl Copyright 2016-2023 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 | |||
8 | dnl Written by Paul Eggert. | ||
9 | |||
10 | AC_DEFUN([gl___BUILTIN_EXPECT], | ||
11 | [ | ||
12 | AC_CACHE_CHECK([for __builtin_expect], | ||
13 | [gl_cv___builtin_expect], | ||
14 | [AC_LINK_IFELSE( | ||
15 | [AC_LANG_SOURCE([[ | ||
16 | int | ||
17 | main (int argc, char **argv) | ||
18 | { | ||
19 | argc = __builtin_expect (argc, 100); | ||
20 | return argv[argc != 100][0]; | ||
21 | }]])], | ||
22 | [gl_cv___builtin_expect=yes], | ||
23 | [AC_LINK_IFELSE( | ||
24 | [AC_LANG_SOURCE([[ | ||
25 | #include <builtins.h> | ||
26 | int | ||
27 | main (int argc, char **argv) | ||
28 | { | ||
29 | argc = __builtin_expect (argc, 100); | ||
30 | return argv[argc != 100][0]; | ||
31 | }]])], | ||
32 | [gl_cv___builtin_expect="in <builtins.h>"], | ||
33 | [gl_cv___builtin_expect=no])])]) | ||
34 | if test "$gl_cv___builtin_expect" = yes; then | ||
35 | AC_DEFINE([HAVE___BUILTIN_EXPECT], [1]) | ||
36 | elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then | ||
37 | AC_DEFINE([HAVE___BUILTIN_EXPECT], [2]) | ||
38 | fi | ||
39 | AH_VERBATIM([HAVE___BUILTIN_EXPECT], | ||
40 | [/* Define to 1 if the compiler supports __builtin_expect, | ||
41 | and to 2 if <builtins.h> does. */ | ||
42 | #undef HAVE___BUILTIN_EXPECT | ||
43 | #ifndef HAVE___BUILTIN_EXPECT | ||
44 | # define __builtin_expect(e, c) (e) | ||
45 | #elif HAVE___BUILTIN_EXPECT == 2 | ||
46 | # include <builtins.h> | ||
47 | #endif | ||
48 | ]) | ||
49 | ]) | ||
diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4 new file mode 100644 index 0000000..8058d17 --- /dev/null +++ b/gl/m4/byteswap.m4 | |||
@@ -0,0 +1,17 @@ | |||
1 | # byteswap.m4 serial 5 | ||
2 | dnl Copyright (C) 2005, 2007, 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 | dnl Written by Oskar Liljeblad. | ||
8 | |||
9 | AC_DEFUN([gl_BYTESWAP], | ||
10 | [ | ||
11 | dnl Prerequisites of lib/byteswap.in.h. | ||
12 | AC_CHECK_HEADERS([byteswap.h], [ | ||
13 | GL_GENERATE_BYTESWAP_H=false | ||
14 | ], [ | ||
15 | GL_GENERATE_BYTESWAP_H=true | ||
16 | ]) | ||
17 | ]) | ||
diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4 new file mode 100644 index 0000000..f614371 --- /dev/null +++ b/gl/m4/c-bool.m4 | |||
@@ -0,0 +1,51 @@ | |||
1 | # Check for bool that conforms to C2023. | ||
2 | |||
3 | dnl Copyright 2022-2023 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 | |||
8 | AC_DEFUN([gl_C_BOOL], | ||
9 | [ | ||
10 | AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool], | ||
11 | [AC_COMPILE_IFELSE( | ||
12 | [AC_LANG_SOURCE([[ | ||
13 | #if true == false | ||
14 | #error "true == false" | ||
15 | #endif | ||
16 | extern bool b; | ||
17 | bool b = true == false;]])], | ||
18 | [gl_cv_c_bool=yes], | ||
19 | [gl_cv_c_bool=no])]) | ||
20 | if test "$gl_cv_c_bool" = yes; then | ||
21 | AC_DEFINE([HAVE_C_BOOL], [1], | ||
22 | [Define to 1 if bool, true and false work as per C2023.]) | ||
23 | fi | ||
24 | |||
25 | AC_CHECK_HEADERS_ONCE([stdbool.h]) | ||
26 | |||
27 | dnl The "zz" puts this toward config.h's end, to avoid potential | ||
28 | dnl collisions with other definitions. | ||
29 | 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. | ||
31 | 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 | ||
33 | dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. | ||
34 | AH_VERBATIM([zzbool], | ||
35 | [#ifndef HAVE_C_BOOL | ||
36 | # if !defined __cplusplus && !defined __bool_true_false_are_defined | ||
37 | # if HAVE_STDBOOL_H | ||
38 | # include <stdbool.h> | ||
39 | # else | ||
40 | # if defined __SUNPRO_C | ||
41 | # error "<stdbool.h> is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC." | ||
42 | # else | ||
43 | # error "<stdbool.h> does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'." | ||
44 | # endif | ||
45 | # endif | ||
46 | # endif | ||
47 | # if !true | ||
48 | # define true (!false) | ||
49 | # endif | ||
50 | #endif]) | ||
51 | ]) | ||
diff --git a/gl/m4/calloc.m4 b/gl/m4/calloc.m4 new file mode 100644 index 0000000..23c0dd9 --- /dev/null +++ b/gl/m4/calloc.m4 | |||
@@ -0,0 +1,83 @@ | |||
1 | # calloc.m4 serial 29 | ||
2 | |||
3 | # Copyright (C) 2004-2023 Free Software Foundation, Inc. | ||
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 | # Written by Jim Meyering. | ||
9 | |||
10 | # Determine whether calloc (N, S) returns non-NULL when N*S is zero, | ||
11 | # and returns NULL when N*S overflows. | ||
12 | # 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 | |||
15 | # _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) | ||
16 | # ------------------------------------- | ||
17 | # If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. | ||
18 | AC_DEFUN([_AC_FUNC_CALLOC_IF], | ||
19 | [ | ||
20 | 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_cv_func_calloc_0_nonnull], | ||
23 | [if test $cross_compiling != yes; then | ||
24 | ac_cv_func_calloc_0_nonnull=yes | ||
25 | AC_RUN_IFELSE( | ||
26 | [AC_LANG_PROGRAM( | ||
27 | [AC_INCLUDES_DEFAULT], | ||
28 | [[int result = 0; | ||
29 | char * volatile p = calloc (0, 0); | ||
30 | if (!p) | ||
31 | result |= 1; | ||
32 | free (p); | ||
33 | return result; | ||
34 | ]])], | ||
35 | [], | ||
36 | [ac_cv_func_calloc_0_nonnull=no]) | ||
37 | else | ||
38 | case "$host_os" in | ||
39 | # Guess yes on glibc systems. | ||
40 | *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | ||
41 | # Guess yes on musl systems. | ||
42 | *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; | ||
43 | # Guess yes on native Windows. | ||
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 | ]) | ||
52 | |||
53 | |||
54 | # gl_FUNC_CALLOC_GNU | ||
55 | # ------------------ | ||
56 | # Replace calloc if it is not compatible with GNU libc. | ||
57 | AC_DEFUN([gl_FUNC_CALLOC_GNU], | ||
58 | [ | ||
59 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
60 | AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) | ||
61 | REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" | ||
62 | if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then | ||
63 | _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) | ||
64 | fi | ||
65 | ])# gl_FUNC_CALLOC_GNU | ||
66 | |||
67 | # gl_FUNC_CALLOC_POSIX | ||
68 | # -------------------- | ||
69 | # Test whether 'calloc' is POSIX compliant (sets errno to ENOMEM when it | ||
70 | # fails, and doesn't mess up with ptrdiff_t or size_t overflow), | ||
71 | # and replace calloc if it is not. | ||
72 | AC_DEFUN([gl_FUNC_CALLOC_POSIX], | ||
73 | [ | ||
74 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
75 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) | ||
76 | if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then | ||
77 | REPLACE_CALLOC_FOR_CALLOC_POSIX=1 | ||
78 | fi | ||
79 | dnl Although in theory we should also test for size_t overflow, | ||
80 | dnl in practice testing for ptrdiff_t overflow suffices | ||
81 | dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. | ||
82 | dnl A separate size_t test would slow down 'configure'. | ||
83 | ]) | ||
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4 new file mode 100644 index 0000000..9f95c67 --- /dev/null +++ b/gl/m4/close.m4 | |||
@@ -0,0 +1,35 @@ | |||
1 | # close.m4 serial 9 | ||
2 | dnl Copyright (C) 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 | AC_DEFUN([gl_FUNC_CLOSE], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
10 | m4_ifdef([gl_MSVC_INVAL], [ | ||
11 | AC_REQUIRE([gl_MSVC_INVAL]) | ||
12 | if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then | ||
13 | REPLACE_CLOSE=1 | ||
14 | fi | ||
15 | ]) | ||
16 | m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ | ||
17 | gl_PREREQ_SYS_H_WINSOCK2 | ||
18 | if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then | ||
19 | dnl Even if the 'socket' module is not used here, another part of the | ||
20 | dnl application may use it and pass file descriptors that refer to | ||
21 | dnl sockets to the close() function. So enable the support for sockets. | ||
22 | REPLACE_CLOSE=1 | ||
23 | fi | ||
24 | ]) | ||
25 | dnl Replace close() for supporting the gnulib-defined fchdir() function, | ||
26 | dnl to keep fchdir's bookkeeping up-to-date. | ||
27 | m4_ifdef([gl_FUNC_FCHDIR], [ | ||
28 | if test $REPLACE_CLOSE = 0; then | ||
29 | gl_TEST_FCHDIR | ||
30 | if test $HAVE_FCHDIR = 0; then | ||
31 | REPLACE_CLOSE=1 | ||
32 | fi | ||
33 | fi | ||
34 | ]) | ||
35 | ]) | ||
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4 index c2761be..5804f47 100644 --- a/gl/m4/codeset.m4 +++ b/gl/m4/codeset.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # codeset.m4 serial 5 (gettext-0.18.2) | 1 | # codeset.m4 serial 5 (gettext-0.18.2) |
2 | dnl Copyright (C) 2000-2002, 2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2023 Free Software |
3 | dnl 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. |
diff --git a/gl/m4/configmake.m4 b/gl/m4/configmake.m4 deleted file mode 100644 index 823ffc0..0000000 --- a/gl/m4/configmake.m4 +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | # configmake.m4 serial 1 | ||
2 | dnl Copyright (C) 2010-2013 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 | # gl_CONFIGMAKE_PREP | ||
8 | # ------------------ | ||
9 | # Guarantee all of the standard directory variables, even when used with | ||
10 | # autoconf 2.59 (datarootdir wasn't supported until 2.59c) or automake | ||
11 | # 1.9.6 (pkglibexecdir wasn't supported until 1.10b.). | ||
12 | AC_DEFUN([gl_CONFIGMAKE_PREP], | ||
13 | [ | ||
14 | dnl Technically, datadir should default to datarootdir. But if | ||
15 | dnl autoconf is too old to provide datarootdir, then reversing the | ||
16 | dnl definition is a reasonable compromise. Only AC_SUBST a variable | ||
17 | dnl if it was not already defined earlier by autoconf. | ||
18 | if test "x$datarootdir" = x; then | ||
19 | AC_SUBST([datarootdir], ['${datadir}']) | ||
20 | fi | ||
21 | dnl Copy the approach used in autoconf 2.60. | ||
22 | if test "x$docdir" = x; then | ||
23 | AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], | ||
24 | ['${datarootdir}/doc/${PACKAGE_TARNAME}'], | ||
25 | ['${datarootdir}/doc/${PACKAGE}'])]) | ||
26 | fi | ||
27 | dnl The remaining variables missing from autoconf 2.59 are easier. | ||
28 | if test "x$htmldir" = x; then | ||
29 | AC_SUBST([htmldir], ['${docdir}']) | ||
30 | fi | ||
31 | if test "x$dvidir" = x; then | ||
32 | AC_SUBST([dvidir], ['${docdir}']) | ||
33 | fi | ||
34 | if test "x$pdfdir" = x; then | ||
35 | AC_SUBST([pdfdir], ['${docdir}']) | ||
36 | fi | ||
37 | if test "x$psdir" = x; then | ||
38 | AC_SUBST([psdir], ['${docdir}']) | ||
39 | fi | ||
40 | if test "x$lispdir" = x; then | ||
41 | AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) | ||
42 | fi | ||
43 | if test "x$localedir" = x; then | ||
44 | AC_SUBST([localedir], ['${datarootdir}/locale']) | ||
45 | fi | ||
46 | |||
47 | dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely | ||
48 | dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. | ||
49 | AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) | ||
50 | ]) | ||
diff --git a/gl/m4/dirname.m4 b/gl/m4/dirname.m4 deleted file mode 100644 index 5897a2a..0000000 --- a/gl/m4/dirname.m4 +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | #serial 10 -*- autoconf -*- | ||
2 | dnl Copyright (C) 2002-2006, 2009-2013 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_DIRNAME], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_DIRNAME_LGPL]) | ||
10 | ]) | ||
11 | |||
12 | AC_DEFUN([gl_DIRNAME_LGPL], | ||
13 | [ | ||
14 | dnl Prerequisites of lib/dirname.h. | ||
15 | AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) | ||
16 | |||
17 | dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, | ||
18 | dnl lib/stripslash.c. | ||
19 | ]) | ||
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4 index bd6f867..1776e5e 100644 --- a/gl/m4/double-slash-root.m4 +++ b/gl/m4/double-slash-root.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # double-slash-root.m4 serial 4 -*- Autoconf -*- | 1 | # double-slash-root.m4 serial 4 -*- Autoconf -*- |
2 | dnl Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4 new file mode 100644 index 0000000..e1cc73e --- /dev/null +++ b/gl/m4/dup2.m4 | |||
@@ -0,0 +1,105 @@ | |||
1 | #serial 27 | ||
2 | dnl Copyright (C) 2002, 2005, 2007, 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_FUNC_DUP2], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
10 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
11 | AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], | ||
12 | [AC_RUN_IFELSE([ | ||
13 | AC_LANG_PROGRAM( | ||
14 | [[#include <errno.h> | ||
15 | #include <fcntl.h> | ||
16 | #include <limits.h> | ||
17 | #include <sys/resource.h> | ||
18 | #include <unistd.h> | ||
19 | ]GL_MDA_DEFINES[ | ||
20 | #ifndef RLIM_SAVED_CUR | ||
21 | # define RLIM_SAVED_CUR RLIM_INFINITY | ||
22 | #endif | ||
23 | #ifndef RLIM_SAVED_MAX | ||
24 | # define RLIM_SAVED_MAX RLIM_INFINITY | ||
25 | #endif | ||
26 | ]], | ||
27 | [[int result = 0; | ||
28 | int bad_fd = INT_MAX; | ||
29 | struct rlimit rlim; | ||
30 | if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 | ||
31 | && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX | ||
32 | && rlim.rlim_cur != RLIM_INFINITY | ||
33 | && rlim.rlim_cur != RLIM_SAVED_MAX | ||
34 | && rlim.rlim_cur != RLIM_SAVED_CUR) | ||
35 | bad_fd = rlim.rlim_cur; | ||
36 | #ifdef FD_CLOEXEC | ||
37 | if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) | ||
38 | result |= 1; | ||
39 | #endif | ||
40 | if (dup2 (1, 1) != 1) | ||
41 | result |= 2; | ||
42 | #ifdef FD_CLOEXEC | ||
43 | if (fcntl (1, F_GETFD) != FD_CLOEXEC) | ||
44 | result |= 4; | ||
45 | #endif | ||
46 | close (0); | ||
47 | if (dup2 (0, 0) != -1) | ||
48 | result |= 8; | ||
49 | /* Many gnulib modules require POSIX conformance of EBADF. */ | ||
50 | if (dup2 (2, bad_fd) == -1 && errno != EBADF) | ||
51 | result |= 16; | ||
52 | /* Flush out some cygwin core dumps. */ | ||
53 | if (dup2 (2, -1) != -1 || errno != EBADF) | ||
54 | result |= 32; | ||
55 | dup2 (2, 255); | ||
56 | dup2 (2, 256); | ||
57 | /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ | ||
58 | { | ||
59 | int fd = open (".", O_RDONLY); | ||
60 | if (fd == -1) | ||
61 | result |= 64; | ||
62 | else if (dup2 (fd, fd + 1) == -1) | ||
63 | result |= 128; | ||
64 | close (fd); | ||
65 | } | ||
66 | return result;]]) | ||
67 | ], | ||
68 | [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], | ||
69 | [case "$host_os" in | ||
70 | mingw*) # on this platform, dup2 always returns 0 for success | ||
71 | gl_cv_func_dup2_works="guessing no" ;; | ||
72 | cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 | ||
73 | gl_cv_func_dup2_works="guessing no" ;; | ||
74 | aix* | freebsd*) | ||
75 | # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, | ||
76 | # not EBADF. | ||
77 | gl_cv_func_dup2_works="guessing no" ;; | ||
78 | haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. | ||
79 | gl_cv_func_dup2_works="guessing no" ;; | ||
80 | *-android*) # implemented using dup3(), which fails if oldfd == newfd | ||
81 | gl_cv_func_dup2_works="guessing no" ;; | ||
82 | os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. | ||
83 | gl_cv_func_dup2_works="guessing no" ;; | ||
84 | *) gl_cv_func_dup2_works="guessing yes" ;; | ||
85 | esac]) | ||
86 | ]) | ||
87 | case "$gl_cv_func_dup2_works" in | ||
88 | *yes) ;; | ||
89 | *) | ||
90 | REPLACE_DUP2=1 | ||
91 | AC_CHECK_FUNCS([setdtablesize]) | ||
92 | ;; | ||
93 | esac | ||
94 | dnl Replace dup2() for supporting the gnulib-defined fchdir() function, | ||
95 | dnl to keep fchdir's bookkeeping up-to-date. | ||
96 | m4_ifdef([gl_FUNC_FCHDIR], [ | ||
97 | gl_TEST_FCHDIR | ||
98 | if test $HAVE_FCHDIR = 0; then | ||
99 | REPLACE_DUP2=1 | ||
100 | fi | ||
101 | ]) | ||
102 | ]) | ||
103 | |||
104 | # Prerequisites of lib/dup2.c. | ||
105 | AC_DEFUN([gl_PREREQ_DUP2], []) | ||
diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4 index c640ec1..cb3e08f 100644 --- a/gl/m4/eealloc.m4 +++ b/gl/m4/eealloc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # eealloc.m4 serial 3 | 1 | # eealloc.m4 serial 3 |
2 | dnl Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 index 593a33e..741dfc5 100644 --- a/gl/m4/environ.m4 +++ b/gl/m4/environ.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # environ.m4 serial 6 | 1 | # environ.m4 serial 8 |
2 | dnl Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -29,16 +29,15 @@ AC_DEFUN_ONCE([gl_ENVIRON], | |||
29 | AC_DEFUN([gt_CHECK_VAR_DECL], | 29 | AC_DEFUN([gt_CHECK_VAR_DECL], |
30 | [ | 30 | [ |
31 | define([gt_cv_var], [gt_cv_var_]$2[_declaration]) | 31 | define([gt_cv_var], [gt_cv_var_]$2[_declaration]) |
32 | AC_MSG_CHECKING([if $2 is properly declared]) | 32 | AC_CACHE_CHECK([if $2 is properly declared], [gt_cv_var], |
33 | AC_CACHE_VAL([gt_cv_var], [ | 33 | [AC_COMPILE_IFELSE( |
34 | AC_COMPILE_IFELSE( | 34 | [AC_LANG_PROGRAM( |
35 | [AC_LANG_PROGRAM( | 35 | [[$1 |
36 | [[$1 | 36 | typedef struct { int foo; } foo_t; |
37 | extern struct { int foo; } $2;]], | 37 | extern foo_t $2;]], |
38 | [[$2.foo = 1;]])], | 38 | [[$2.foo = 1;]])], |
39 | [gt_cv_var=no], | 39 | [gt_cv_var=no], |
40 | [gt_cv_var=yes])]) | 40 | [gt_cv_var=yes])]) |
41 | AC_MSG_RESULT([$gt_cv_var]) | ||
42 | if test $gt_cv_var = yes; then | 41 | if test $gt_cv_var = yes; then |
43 | AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, | 42 | AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, |
44 | [Define if you have the declaration of $2.]) | 43 | [Define if you have the declaration of $2.]) |
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index c813ea5..4c70d22 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 | |||
@@ -1,9 +1,11 @@ | |||
1 | # errno_h.m4 serial 12 | 1 | # errno_h.m4 serial 14 |
2 | dnl Copyright (C) 2004, 2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004, 2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_PREREQ([2.61]) | ||
8 | |||
7 | AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], | 9 | AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], |
8 | [ | 10 | [ |
9 | AC_REQUIRE([AC_PROG_CC]) | 11 | AC_REQUIRE([AC_PROG_CC]) |
@@ -66,13 +68,11 @@ booboo | |||
66 | [gl_cv_header_errno_h_complete=yes]) | 68 | [gl_cv_header_errno_h_complete=yes]) |
67 | ]) | 69 | ]) |
68 | if test $gl_cv_header_errno_h_complete = yes; then | 70 | if test $gl_cv_header_errno_h_complete = yes; then |
69 | ERRNO_H='' | 71 | GL_GENERATE_ERRNO_H=false |
70 | else | 72 | else |
71 | gl_NEXT_HEADERS([errno.h]) | 73 | gl_NEXT_HEADERS([errno.h]) |
72 | ERRNO_H='errno.h' | 74 | GL_GENERATE_ERRNO_H=true |
73 | fi | 75 | fi |
74 | AC_SUBST([ERRNO_H]) | ||
75 | AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) | ||
76 | gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) | 76 | gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) |
77 | gl_REPLACE_ERRNO_VALUE([ENOLINK]) | 77 | gl_REPLACE_ERRNO_VALUE([ENOLINK]) |
78 | gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) | 78 | gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) |
@@ -86,7 +86,7 @@ booboo | |||
86 | # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. | 86 | # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. |
87 | AC_DEFUN([gl_REPLACE_ERRNO_VALUE], | 87 | AC_DEFUN([gl_REPLACE_ERRNO_VALUE], |
88 | [ | 88 | [ |
89 | if test -n "$ERRNO_H"; then | 89 | if $GL_GENERATE_ERRNO_H; then |
90 | AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ | 90 | AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ |
91 | AC_EGREP_CPP([yes],[ | 91 | AC_EGREP_CPP([yes],[ |
92 | #include <errno.h> | 92 | #include <errno.h> |
@@ -129,9 +129,3 @@ yes | |||
129 | AC_SUBST($1[_VALUE]) | 129 | AC_SUBST($1[_VALUE]) |
130 | fi | 130 | fi |
131 | ]) | 131 | ]) |
132 | |||
133 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | ||
134 | dnl Remove this when we can assume autoconf >= 2.61. | ||
135 | m4_ifdef([AC_COMPUTE_INT], [], [ | ||
136 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | ||
137 | ]) | ||
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 29e6fdc..8cc75df 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 | |||
@@ -1,6 +1,6 @@ | |||
1 | #serial 14 | 1 | #serial 15 |
2 | 2 | ||
3 | # Copyright (C) 1996-1998, 2001-2004, 2009-2013 Free Software Foundation, Inc. | 3 | # Copyright (C) 1996-1998, 2001-2004, 2009-2023 Free Software Foundation, Inc. |
4 | # | 4 | # |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
@@ -22,6 +22,10 @@ AC_DEFUN([gl_ERROR], | |||
22 | # Prerequisites of lib/error.c. | 22 | # Prerequisites of lib/error.c. |
23 | AC_DEFUN([gl_PREREQ_ERROR], | 23 | AC_DEFUN([gl_PREREQ_ERROR], |
24 | [ | 24 | [ |
25 | dnl Use system extensions on Android, so that AC_FUNC_STRERROR_R | ||
26 | dnl discovers the GNU API for strerror_r on Android API level 23 and later. | ||
27 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
28 | |||
25 | AC_REQUIRE([AC_FUNC_STRERROR_R]) | 29 | AC_REQUIRE([AC_FUNC_STRERROR_R]) |
26 | : | 30 | : |
27 | ]) | 31 | ]) |
diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4 index 09df468..2ef4643 100644 --- a/gl/m4/exponentd.m4 +++ b/gl/m4/exponentd.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # exponentd.m4 serial 3 | 1 | # exponentd.m4 serial 3 |
2 | dnl Copyright (C) 2007-2008, 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2008, 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index e30f122..5336b8d 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 | |||
@@ -1,14 +1,19 @@ | |||
1 | # serial 13 -*- Autoconf -*- | 1 | # serial 23 -*- Autoconf -*- |
2 | # Enable extensions on systems that normally disable them. | 2 | # Enable extensions on systems that normally disable them. |
3 | 3 | ||
4 | # Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. | 4 | # Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
7 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
8 | 8 | ||
9 | 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+. | ||
11 | m4_ifndef([AC_CHECK_INCLUDES_DEFAULT], | ||
12 | [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])]) | ||
13 | |||
9 | # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git | 14 | # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git |
10 | # Autoconf. Perhaps we can remove this once we can assume Autoconf | 15 | # Autoconf. Perhaps we can remove this once we can assume Autoconf |
11 | # 2.70 or later everywhere, but since Autoconf mutates rapidly | 16 | # is recent-enough everywhere, but since Autoconf mutates rapidly |
12 | # enough in this area it's likely we'll need to redefine | 17 | # enough in this area it's likely we'll need to redefine |
13 | # AC_USE_SYSTEM_EXTENSIONS for quite some time. | 18 | # AC_USE_SYSTEM_EXTENSIONS for quite some time. |
14 | 19 | ||
@@ -26,67 +31,125 @@ | |||
26 | # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS | 31 | # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS |
27 | # invocation occurs in gl_EARLY, not in gl_INIT. | 32 | # invocation occurs in gl_EARLY, not in gl_INIT. |
28 | 33 | ||
34 | m4_version_prereq([2.72], [], [ | ||
35 | |||
29 | # AC_USE_SYSTEM_EXTENSIONS | 36 | # AC_USE_SYSTEM_EXTENSIONS |
30 | # ------------------------ | 37 | # ------------------------ |
31 | # Enable extensions on systems that normally disable them, | 38 | # Enable extensions on systems that normally disable them, |
32 | # typically due to standards-conformance issues. | 39 | # typically due to standards-conformance issues. |
33 | # | 40 | # We unconditionally define as many of the known feature-enabling |
34 | # Remember that #undef in AH_VERBATIM gets replaced with #define by | 41 | # as possible, reserving conditional behavior for macros that are |
35 | # AC_DEFINE. The goal here is to define all known feature-enabling | 42 | # known to cause problems on some platforms (such as __EXTENSIONS__). |
36 | # macros, then, if reports of conflicts are made, disable macros that | ||
37 | # cause problems on some platforms (such as __EXTENSIONS__). | ||
38 | AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], | 43 | AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], |
39 | [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl | 44 | [AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl |
45 | AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl | ||
46 | AC_BEFORE([$0], [AC_LINK_IFELSE])dnl | ||
40 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl | 47 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl |
41 | 48 | AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl | |
42 | AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) | 49 | dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE. |
43 | if test "$MINIX" = yes; then | ||
44 | AC_DEFINE([_POSIX_SOURCE], [1], | ||
45 | [Define to 1 if you need to in order for 'stat' and other | ||
46 | things to work.]) | ||
47 | AC_DEFINE([_POSIX_1_SOURCE], [2], | ||
48 | [Define to 2 if the system does not provide POSIX.1 features | ||
49 | except with this defined.]) | ||
50 | AC_DEFINE([_MINIX], [1], | ||
51 | [Define to 1 if on MINIX.]) | ||
52 | AC_DEFINE([_NETBSD_SOURCE], [1], | ||
53 | [Define to 1 to make NetBSD features available. MINIX 3 needs this.]) | ||
54 | fi | ||
55 | |||
56 | dnl Use a different key than __EXTENSIONS__, as that name broke existing | 50 | dnl Use a different key than __EXTENSIONS__, as that name broke existing |
57 | dnl configure.ac when using autoheader 2.62. | 51 | dnl configure.ac when using autoheader 2.62. |
58 | AH_VERBATIM([USE_SYSTEM_EXTENSIONS], | 52 | dnl The macros below are in alphabetical order ignoring leading _ or __ |
53 | dnl prefixes. | ||
54 | AH_VERBATIM([USE_SYSTEM_EXTENSIONS], | ||
59 | [/* Enable extensions on AIX 3, Interix. */ | 55 | [/* Enable extensions on AIX 3, Interix. */ |
60 | #ifndef _ALL_SOURCE | 56 | #ifndef _ALL_SOURCE |
61 | # undef _ALL_SOURCE | 57 | # undef _ALL_SOURCE |
62 | #endif | 58 | #endif |
63 | /* Enable general extensions on OS X. */ | 59 | /* Enable general extensions on macOS. */ |
64 | #ifndef _DARWIN_C_SOURCE | 60 | #ifndef _DARWIN_C_SOURCE |
65 | # undef _DARWIN_C_SOURCE | 61 | # undef _DARWIN_C_SOURCE |
66 | #endif | 62 | #endif |
63 | /* Enable general extensions on Solaris. */ | ||
64 | #ifndef __EXTENSIONS__ | ||
65 | # undef __EXTENSIONS__ | ||
66 | #endif | ||
67 | /* Enable GNU extensions on systems that have them. */ | 67 | /* Enable GNU extensions on systems that have them. */ |
68 | #ifndef _GNU_SOURCE | 68 | #ifndef _GNU_SOURCE |
69 | # undef _GNU_SOURCE | 69 | # undef _GNU_SOURCE |
70 | #endif | 70 | #endif |
71 | /* Enable threading extensions on Solaris. */ | 71 | /* Enable X/Open compliant socket functions that do not require linking |
72 | with -lxnet on HP-UX 11.11. */ | ||
73 | #ifndef _HPUX_ALT_XOPEN_SOCKET_API | ||
74 | # undef _HPUX_ALT_XOPEN_SOCKET_API | ||
75 | #endif | ||
76 | /* Identify the host operating system as Minix. | ||
77 | This macro does not affect the system headers' behavior. | ||
78 | A future release of Autoconf may stop defining this macro. */ | ||
79 | #ifndef _MINIX | ||
80 | # undef _MINIX | ||
81 | #endif | ||
82 | /* Enable general extensions on NetBSD. | ||
83 | Enable NetBSD compatibility extensions on Minix. */ | ||
84 | #ifndef _NETBSD_SOURCE | ||
85 | # undef _NETBSD_SOURCE | ||
86 | #endif | ||
87 | /* Enable OpenBSD compatibility extensions on NetBSD. | ||
88 | Oddly enough, this does nothing on OpenBSD. */ | ||
89 | #ifndef _OPENBSD_SOURCE | ||
90 | # undef _OPENBSD_SOURCE | ||
91 | #endif | ||
92 | /* Define to 1 if needed for POSIX-compatible behavior. */ | ||
93 | #ifndef _POSIX_SOURCE | ||
94 | # undef _POSIX_SOURCE | ||
95 | #endif | ||
96 | /* Define to 2 if needed for POSIX-compatible behavior. */ | ||
97 | #ifndef _POSIX_1_SOURCE | ||
98 | # undef _POSIX_1_SOURCE | ||
99 | #endif | ||
100 | /* Enable POSIX-compatible threading on Solaris. */ | ||
72 | #ifndef _POSIX_PTHREAD_SEMANTICS | 101 | #ifndef _POSIX_PTHREAD_SEMANTICS |
73 | # undef _POSIX_PTHREAD_SEMANTICS | 102 | # undef _POSIX_PTHREAD_SEMANTICS |
74 | #endif | 103 | #endif |
104 | /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ | ||
105 | #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ | ||
106 | # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ | ||
107 | #endif | ||
108 | /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ | ||
109 | #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
110 | # undef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
111 | #endif | ||
112 | /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ | ||
113 | #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ | ||
114 | # undef __STDC_WANT_IEC_60559_DFP_EXT__ | ||
115 | #endif | ||
116 | /* Enable extensions specified by C23 Annex F. */ | ||
117 | #ifndef __STDC_WANT_IEC_60559_EXT__ | ||
118 | # undef __STDC_WANT_IEC_60559_EXT__ | ||
119 | #endif | ||
120 | /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ | ||
121 | #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ | ||
122 | # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ | ||
123 | #endif | ||
124 | /* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ | ||
125 | #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ | ||
126 | # undef __STDC_WANT_IEC_60559_TYPES_EXT__ | ||
127 | #endif | ||
128 | /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ | ||
129 | #ifndef __STDC_WANT_LIB_EXT2__ | ||
130 | # undef __STDC_WANT_LIB_EXT2__ | ||
131 | #endif | ||
132 | /* Enable extensions specified by ISO/IEC 24747:2009. */ | ||
133 | #ifndef __STDC_WANT_MATH_SPEC_FUNCS__ | ||
134 | # undef __STDC_WANT_MATH_SPEC_FUNCS__ | ||
135 | #endif | ||
75 | /* Enable extensions on HP NonStop. */ | 136 | /* Enable extensions on HP NonStop. */ |
76 | #ifndef _TANDEM_SOURCE | 137 | #ifndef _TANDEM_SOURCE |
77 | # undef _TANDEM_SOURCE | 138 | # undef _TANDEM_SOURCE |
78 | #endif | 139 | #endif |
79 | /* Enable X/Open extensions if necessary. HP-UX 11.11 defines | 140 | /* Enable X/Open extensions. Define to 500 only if necessary |
80 | mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of | 141 | to make mbstate_t available. */ |
81 | whether compiling with -Ae or -D_HPUX_SOURCE=1. */ | ||
82 | #ifndef _XOPEN_SOURCE | 142 | #ifndef _XOPEN_SOURCE |
83 | # undef _XOPEN_SOURCE | 143 | # undef _XOPEN_SOURCE |
84 | #endif | 144 | #endif |
85 | /* Enable general extensions on Solaris. */ | 145 | ])dnl |
86 | #ifndef __EXTENSIONS__ | 146 | |
87 | # undef __EXTENSIONS__ | 147 | AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl |
88 | #endif | 148 | _AC_CHECK_HEADER_ONCE([wchar.h]) |
89 | ]) | 149 | _AC_CHECK_HEADER_ONCE([minix/config.h]) |
150 | |||
151 | dnl Defining __EXTENSIONS__ may break the system headers on some systems. | ||
152 | dnl (FIXME: Which ones?) | ||
90 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], | 153 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], |
91 | [ac_cv_safe_to_define___extensions__], | 154 | [ac_cv_safe_to_define___extensions__], |
92 | [AC_COMPILE_IFELSE( | 155 | [AC_COMPILE_IFELSE( |
@@ -95,30 +158,57 @@ dnl configure.ac when using autoheader 2.62. | |||
95 | ]AC_INCLUDES_DEFAULT])], | 158 | ]AC_INCLUDES_DEFAULT])], |
96 | [ac_cv_safe_to_define___extensions__=yes], | 159 | [ac_cv_safe_to_define___extensions__=yes], |
97 | [ac_cv_safe_to_define___extensions__=no])]) | 160 | [ac_cv_safe_to_define___extensions__=no])]) |
98 | test $ac_cv_safe_to_define___extensions__ = yes && | 161 | |
99 | AC_DEFINE([__EXTENSIONS__]) | 162 | dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to |
100 | AC_DEFINE([_ALL_SOURCE]) | 163 | dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1. |
101 | AC_DEFINE([_DARWIN_C_SOURCE]) | 164 | dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms |
102 | AC_DEFINE([_GNU_SOURCE]) | 165 | dnl not covered by turn-on-extensions macros (notably Dragonfly, Free, |
103 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | 166 | dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so |
104 | AC_DEFINE([_TANDEM_SOURCE]) | 167 | dnl it should only be defined when necessary. |
105 | AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], | 168 | AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], |
106 | [ac_cv_should_define__xopen_source], | 169 | [ac_cv_should_define__xopen_source], |
107 | [ac_cv_should_define__xopen_source=no | 170 | [ac_cv_should_define__xopen_source=no |
108 | AC_COMPILE_IFELSE( | 171 | AS_IF([test $ac_cv_header_wchar_h = yes], |
109 | [AC_LANG_PROGRAM([[ | 172 | [AC_COMPILE_IFELSE( |
173 | [AC_LANG_PROGRAM([[ | ||
110 | #include <wchar.h> | 174 | #include <wchar.h> |
111 | mbstate_t x;]])], | 175 | mbstate_t x;]])], |
112 | [], | 176 | [], |
113 | [AC_COMPILE_IFELSE( | 177 | [AC_COMPILE_IFELSE( |
114 | [AC_LANG_PROGRAM([[ | 178 | [AC_LANG_PROGRAM([[ |
115 | #define _XOPEN_SOURCE 500 | 179 | #define _XOPEN_SOURCE 500 |
116 | #include <wchar.h> | 180 | #include <wchar.h> |
117 | mbstate_t x;]])], | 181 | mbstate_t x;]])], |
118 | [ac_cv_should_define__xopen_source=yes])])]) | 182 | [ac_cv_should_define__xopen_source=yes])])])]) |
119 | test $ac_cv_should_define__xopen_source = yes && | 183 | |
120 | AC_DEFINE([_XOPEN_SOURCE], [500]) | 184 | AC_DEFINE([_ALL_SOURCE]) |
185 | AC_DEFINE([_DARWIN_C_SOURCE]) | ||
186 | AC_DEFINE([_GNU_SOURCE]) | ||
187 | AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) | ||
188 | AC_DEFINE([_NETBSD_SOURCE]) | ||
189 | AC_DEFINE([_OPENBSD_SOURCE]) | ||
190 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | ||
191 | AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) | ||
192 | AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) | ||
193 | AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) | ||
194 | AC_DEFINE([__STDC_WANT_IEC_60559_EXT__]) | ||
195 | AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) | ||
196 | AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) | ||
197 | AC_DEFINE([__STDC_WANT_LIB_EXT2__]) | ||
198 | AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) | ||
199 | AC_DEFINE([_TANDEM_SOURCE]) | ||
200 | AS_IF([test $ac_cv_header_minix_config_h = yes], | ||
201 | [MINIX=yes | ||
202 | AC_DEFINE([_MINIX]) | ||
203 | AC_DEFINE([_POSIX_SOURCE]) | ||
204 | AC_DEFINE([_POSIX_1_SOURCE], [2])], | ||
205 | [MINIX=]) | ||
206 | AS_IF([test $ac_cv_safe_to_define___extensions__ = yes], | ||
207 | [AC_DEFINE([__EXTENSIONS__])]) | ||
208 | AS_IF([test $ac_cv_should_define__xopen_source = yes], | ||
209 | [AC_DEFINE([_XOPEN_SOURCE], [500])]) | ||
121 | ])# AC_USE_SYSTEM_EXTENSIONS | 210 | ])# AC_USE_SYSTEM_EXTENSIONS |
211 | ]) | ||
122 | 212 | ||
123 | # gl_USE_SYSTEM_EXTENSIONS | 213 | # gl_USE_SYSTEM_EXTENSIONS |
124 | # ------------------------ | 214 | # ------------------------ |
@@ -126,13 +216,17 @@ dnl configure.ac when using autoheader 2.62. | |||
126 | # typically due to standards-conformance issues. | 216 | # typically due to standards-conformance issues. |
127 | AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], | 217 | AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], |
128 | [ | 218 | [ |
129 | dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. | ||
130 | dnl gnulib does not need it. But if it gets required by third-party macros | ||
131 | dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a | ||
132 | dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". | ||
133 | dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, | ||
134 | dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. | ||
135 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
136 | |||
137 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 219 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
220 | |||
221 | dnl On OpenBSD 6.8 with GCC, the include files contain a couple of | ||
222 | dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE. | ||
223 | dnl That's because this version of GCC (4.2.1) supports the option | ||
224 | dnl '-std=gnu99' but not the option '-std=gnu11'. | ||
225 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
226 | case "$host_os" in | ||
227 | openbsd*) | ||
228 | AC_DEFINE([_ISOC11_SOURCE], [1], | ||
229 | [Define to enable the declarations of ISO C 11 types and functions.]) | ||
230 | ;; | ||
231 | esac | ||
138 | ]) | 232 | ]) |
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index c4c5e7f..c001b1c 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 | |||
@@ -1,61 +1,121 @@ | |||
1 | dnl 'extern inline' a la ISO C99. | 1 | dnl 'extern inline' a la ISO C99. |
2 | 2 | ||
3 | dnl Copyright 2012-2013 Free Software Foundation, Inc. | 3 | dnl Copyright 2012-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 | 7 | ||
8 | AC_DEFUN([gl_EXTERN_INLINE], | 8 | AC_DEFUN([gl_EXTERN_INLINE], |
9 | [ | 9 | [ |
10 | AH_VERBATIM([extern_inline], | 10 | AC_CACHE_CHECK([whether ctype.h defines __header_inline], |
11 | [gl_cv_have___header_inline], | ||
12 | [AC_PREPROC_IFELSE( | ||
13 | [AC_LANG_SOURCE([[#include <ctype.h> | ||
14 | #ifndef __header_inline | ||
15 | #error "<ctype.h> does not define __header_inline" | ||
16 | #endif | ||
17 | ]])], | ||
18 | [gl_cv_have___header_inline=yes], | ||
19 | [gl_cv_have___header_inline=no])]) | ||
20 | if test "$gl_cv_have___header_inline" = yes; then | ||
21 | AC_DEFINE([HAVE___HEADER_INLINE], [1], | ||
22 | [Define to 1 if ctype.h defines __header_inline.]) | ||
23 | fi | ||
24 | |||
25 | AH_VERBATIM([HAVE___HEADER_INLINE_1], | ||
11 | [/* Please see the Gnulib manual for how to use these macros. | 26 | [/* Please see the Gnulib manual for how to use these macros. |
12 | 27 | ||
13 | Suppress extern inline with HP-UX cc, as it appears to be broken; see | 28 | Suppress extern inline with HP-UX cc, as it appears to be broken; see |
14 | <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. | 29 | <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>. |
15 | 30 | ||
16 | Suppress extern inline with Sun C in standards-conformance mode, as it | 31 | Suppress extern inline with Sun C in standards-conformance mode, as it |
17 | mishandles inline functions that call each other. E.g., for 'inline void f | 32 | mishandles inline functions that call each other. E.g., for 'inline void f |
18 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains | 33 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains |
19 | 'reference to static identifier "f" in extern inline function'. | 34 | 'reference to static identifier "f" in extern inline function'. |
20 | This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. | 35 | This bug was observed with Oracle Developer Studio 12.6 |
36 | (Sun C 5.15 SunOS_sparc 2017/05/30). | ||
37 | |||
38 | Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) | ||
39 | on configurations that mistakenly use 'static inline' to implement | ||
40 | functions or macros in standard C headers like <ctype.h>. For example, | ||
41 | if isdigit is mistakenly implemented via a static inline function, | ||
42 | a program containing an extern inline function that calls isdigit | ||
43 | may not work since the C standard prohibits extern inline functions | ||
44 | from calling static functions (ISO C 99 section 6.7.4.(3). | ||
45 | This bug is known to occur on: | ||
46 | |||
47 | OS X 10.8 and earlier; see: | ||
48 | https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html | ||
49 | |||
50 | DragonFly; see | ||
51 | http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log | ||
21 | 52 | ||
22 | Suppress the use of extern inline on Apple's platforms, as Libc at least | 53 | FreeBSD; see: |
23 | through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g., | 54 | https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html |
24 | <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. | 55 | |
25 | Perhaps Apple will fix this some day. */ | 56 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and |
57 | for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. | ||
58 | Assume DragonFly and FreeBSD will be similar. | ||
59 | |||
60 | GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 | ||
61 | inline semantics, unless -fgnu89-inline is used. It defines a macro | ||
62 | __GNUC_STDC_INLINE__ to indicate this situation or a macro | ||
63 | __GNUC_GNU_INLINE__ to indicate the opposite situation. | ||
64 | GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline | ||
65 | semantics but warns, unless -fgnu89-inline is used: | ||
66 | warning: C99 inline functions are not supported; using GNU89 | ||
67 | warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute | ||
68 | It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. | ||
69 | */ | ||
70 | #if (((defined __APPLE__ && defined __MACH__) \ | ||
71 | || defined __DragonFly__ || defined __FreeBSD__) \ | ||
72 | && (defined HAVE___HEADER_INLINE \ | ||
73 | ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ | ||
74 | && ! defined __clang__) \ | ||
75 | : ((! defined _DONT_USE_CTYPE_INLINE_ \ | ||
76 | && (defined __GNUC__ || defined __cplusplus)) \ | ||
77 | || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ | ||
78 | && defined __GNUC__ && ! defined __cplusplus)))) | ||
79 | # define _GL_EXTERN_INLINE_STDHEADER_BUG | ||
80 | #endif | ||
26 | #if ((__GNUC__ \ | 81 | #if ((__GNUC__ \ |
27 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | 82 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ |
28 | : (199901L <= __STDC_VERSION__ \ | 83 | : (199901L <= __STDC_VERSION__ \ |
29 | && !defined __HP_cc \ | 84 | && !defined __HP_cc \ |
85 | && !defined __PGI \ | ||
30 | && !(defined __SUNPRO_C && __STDC__))) \ | 86 | && !(defined __SUNPRO_C && __STDC__))) \ |
31 | && !defined __APPLE__) | 87 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) |
32 | # define _GL_INLINE inline | 88 | # define _GL_INLINE inline |
33 | # define _GL_EXTERN_INLINE extern inline | 89 | # define _GL_EXTERN_INLINE extern inline |
90 | # define _GL_EXTERN_INLINE_IN_USE | ||
34 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | 91 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ |
35 | && !defined __APPLE__) | 92 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) |
36 | # if __GNUC_GNU_INLINE__ | 93 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ |
37 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | 94 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ |
38 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) | 95 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) |
39 | # else | 96 | # else |
40 | # define _GL_INLINE extern inline | 97 | # define _GL_INLINE extern inline |
41 | # endif | 98 | # endif |
42 | # define _GL_EXTERN_INLINE extern | 99 | # define _GL_EXTERN_INLINE extern |
100 | # define _GL_EXTERN_INLINE_IN_USE | ||
43 | #else | 101 | #else |
44 | # define _GL_INLINE static _GL_UNUSED | 102 | # define _GL_INLINE _GL_UNUSED static |
45 | # define _GL_EXTERN_INLINE static _GL_UNUSED | 103 | # define _GL_EXTERN_INLINE _GL_UNUSED static |
46 | #endif | 104 | #endif |
47 | 105 | ||
48 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | 106 | /* In GCC 4.6 (inclusive) to 5.1 (exclusive), |
107 | suppress bogus "no previous prototype for 'FOO'" | ||
108 | and "no previous declaration for 'FOO'" diagnostics, | ||
109 | when FOO is an inline function in the header; see | ||
110 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and | ||
111 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ | ||
112 | #if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ | ||
49 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ | 113 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ |
50 | # define _GL_INLINE_HEADER_CONST_PRAGMA | 114 | # define _GL_INLINE_HEADER_CONST_PRAGMA |
51 | # else | 115 | # else |
52 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ | 116 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ |
53 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") | 117 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") |
54 | # endif | 118 | # endif |
55 | /* Suppress GCC's bogus "no previous prototype for 'FOO'" | ||
56 | and "no previous declaration for 'FOO'" diagnostics, | ||
57 | when FOO is an inline function in the header; see | ||
58 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ | ||
59 | # define _GL_INLINE_HEADER_BEGIN \ | 119 | # define _GL_INLINE_HEADER_BEGIN \ |
60 | _Pragma ("GCC diagnostic push") \ | 120 | _Pragma ("GCC diagnostic push") \ |
61 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | 121 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ |
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 index 87cc4bd..59d558b 100644 --- a/gl/m4/fcntl-o.m4 +++ b/gl/m4/fcntl-o.m4 | |||
@@ -1,23 +1,22 @@ | |||
1 | # fcntl-o.m4 serial 4 | 1 | # fcntl-o.m4 serial 7 |
2 | dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl Written by Paul Eggert. | 7 | dnl Written by Paul Eggert. |
8 | 8 | ||
9 | AC_PREREQ([2.60]) | ||
10 | |||
9 | # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. | 11 | # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. |
10 | # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. | 12 | # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. |
11 | # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. | 13 | # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. |
12 | AC_DEFUN([gl_FCNTL_O_FLAGS], | 14 | AC_DEFUN([gl_FCNTL_O_FLAGS], |
13 | [ | 15 | [ |
14 | dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. | 16 | dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. |
15 | dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes | 17 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
16 | dnl AC_GNU_SOURCE. | ||
17 | m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], | ||
18 | [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], | ||
19 | [AC_REQUIRE([AC_GNU_SOURCE])]) | ||
20 | 18 | ||
19 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
21 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 20 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
22 | AC_CHECK_FUNCS_ONCE([symlink]) | 21 | AC_CHECK_FUNCS_ONCE([symlink]) |
23 | AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], | 22 | AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], |
@@ -33,6 +32,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], | |||
33 | # defined sleep(n) _sleep ((n) * 1000) | 32 | # defined sleep(n) _sleep ((n) * 1000) |
34 | #endif | 33 | #endif |
35 | #include <fcntl.h> | 34 | #include <fcntl.h> |
35 | ]GL_MDA_DEFINES[ | ||
36 | #ifndef O_NOATIME | 36 | #ifndef O_NOATIME |
37 | #define O_NOATIME 0 | 37 | #define O_NOATIME 0 |
38 | #endif | 38 | #endif |
@@ -116,7 +116,13 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], | |||
116 | 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( | 116 | 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( |
117 | *) gl_cv_header_working_fcntl_h='no';; | 117 | *) gl_cv_header_working_fcntl_h='no';; |
118 | esac], | 118 | esac], |
119 | [gl_cv_header_working_fcntl_h=cross-compiling])]) | 119 | [case "$host_os" in |
120 | # Guess 'no' on native Windows. | ||
121 | mingw*) gl_cv_header_working_fcntl_h='no' ;; | ||
122 | *) gl_cv_header_working_fcntl_h=cross-compiling ;; | ||
123 | esac | ||
124 | ]) | ||
125 | ]) | ||
120 | 126 | ||
121 | case $gl_cv_header_working_fcntl_h in #( | 127 | case $gl_cv_header_working_fcntl_h in #( |
122 | *O_NOATIME* | no | cross-compiling) ac_val=0;; #( | 128 | *O_NOATIME* | no | cross-compiling) ac_val=0;; #( |
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4 new file mode 100644 index 0000000..524a99a --- /dev/null +++ b/gl/m4/fcntl.m4 | |||
@@ -0,0 +1,151 @@ | |||
1 | # fcntl.m4 serial 11 | ||
2 | dnl Copyright (C) 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 | # For now, this module ensures that fcntl() | ||
8 | # - supports F_DUPFD correctly | ||
9 | # - supports or emulates F_DUPFD_CLOEXEC | ||
10 | # - supports F_GETFD | ||
11 | # Still to be ported to mingw: | ||
12 | # - F_SETFD | ||
13 | # - F_GETFL, F_SETFL | ||
14 | # - F_GETOWN, F_SETOWN | ||
15 | # - F_GETLK, F_SETLK, F_SETLKW | ||
16 | AC_DEFUN([gl_FUNC_FCNTL], | ||
17 | [ | ||
18 | dnl Persuade glibc to expose F_DUPFD_CLOEXEC. | ||
19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
20 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | ||
21 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
22 | AC_CHECK_FUNCS_ONCE([fcntl]) | ||
23 | if test $ac_cv_func_fcntl = no; then | ||
24 | gl_REPLACE_FCNTL | ||
25 | else | ||
26 | dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target | ||
27 | dnl haiku alpha 2 F_DUPFD has wrong errno | ||
28 | AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], | ||
29 | [gl_cv_func_fcntl_f_dupfd_works], | ||
30 | [AC_RUN_IFELSE( | ||
31 | [AC_LANG_PROGRAM( | ||
32 | [[#include <errno.h> | ||
33 | #include <fcntl.h> | ||
34 | #include <limits.h> | ||
35 | #include <sys/resource.h> | ||
36 | #include <unistd.h> | ||
37 | ]GL_MDA_DEFINES[ | ||
38 | #ifndef RLIM_SAVED_CUR | ||
39 | # define RLIM_SAVED_CUR RLIM_INFINITY | ||
40 | #endif | ||
41 | #ifndef RLIM_SAVED_MAX | ||
42 | # define RLIM_SAVED_MAX RLIM_INFINITY | ||
43 | #endif | ||
44 | ]], | ||
45 | [[int result = 0; | ||
46 | int bad_fd = INT_MAX; | ||
47 | struct rlimit rlim; | ||
48 | if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 | ||
49 | && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX | ||
50 | && rlim.rlim_cur != RLIM_INFINITY | ||
51 | && rlim.rlim_cur != RLIM_SAVED_MAX | ||
52 | && rlim.rlim_cur != RLIM_SAVED_CUR) | ||
53 | bad_fd = rlim.rlim_cur; | ||
54 | if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; | ||
55 | if (errno != EINVAL) result |= 2; | ||
56 | if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; | ||
57 | if (errno != EINVAL) result |= 8; | ||
58 | /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ | ||
59 | { | ||
60 | int fd; | ||
61 | fd = open (".", O_RDONLY); | ||
62 | if (fd == -1) | ||
63 | result |= 16; | ||
64 | else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) | ||
65 | result |= 32; | ||
66 | |||
67 | close (fd); | ||
68 | } | ||
69 | return result;]])], | ||
70 | [gl_cv_func_fcntl_f_dupfd_works=yes], | ||
71 | [gl_cv_func_fcntl_f_dupfd_works=no], | ||
72 | [case $host_os in | ||
73 | aix* | cygwin* | haiku*) | ||
74 | gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; | ||
75 | *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; | ||
76 | esac])]) | ||
77 | case $gl_cv_func_fcntl_f_dupfd_works in | ||
78 | *yes) ;; | ||
79 | *) gl_REPLACE_FCNTL | ||
80 | AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD | ||
81 | behavior does not match POSIX]) ;; | ||
82 | esac | ||
83 | |||
84 | dnl Many systems lack F_DUPFD_CLOEXEC. | ||
85 | dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. | ||
86 | AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], | ||
87 | [gl_cv_func_fcntl_f_dupfd_cloexec], | ||
88 | [AC_RUN_IFELSE( | ||
89 | [AC_LANG_SOURCE( | ||
90 | [[#include <fcntl.h> | ||
91 | #include <unistd.h> | ||
92 | int main (int argc, char *argv[]) | ||
93 | { | ||
94 | if (argc == 1) | ||
95 | /* parent process */ | ||
96 | { | ||
97 | if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) | ||
98 | return 1; | ||
99 | return execl ("./conftest", "./conftest", "child", NULL); | ||
100 | } | ||
101 | else | ||
102 | /* child process */ | ||
103 | return (fcntl (10, F_GETFL) < 0 ? 0 : 42); | ||
104 | } | ||
105 | ]]) | ||
106 | ], | ||
107 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
108 | #ifdef __linux__ | ||
109 | /* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace | ||
110 | it to support the semantics on older kernels that failed with EINVAL. */ | ||
111 | choke me | ||
112 | #endif | ||
113 | ]])], | ||
114 | [gl_cv_func_fcntl_f_dupfd_cloexec=yes], | ||
115 | [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"]) | ||
116 | ], | ||
117 | [gl_cv_func_fcntl_f_dupfd_cloexec=no], | ||
118 | [case "$host_os" in | ||
119 | # Guess no on NetBSD. | ||
120 | netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; | ||
121 | *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; | ||
122 | esac | ||
123 | ]) | ||
124 | ]) | ||
125 | case "$gl_cv_func_fcntl_f_dupfd_cloexec" in | ||
126 | *yes) ;; | ||
127 | *) gl_REPLACE_FCNTL | ||
128 | dnl No witness macro needed for this bug. | ||
129 | ;; | ||
130 | esac | ||
131 | fi | ||
132 | dnl Replace fcntl() for supporting the gnulib-defined fchdir() function, | ||
133 | dnl to keep fchdir's bookkeeping up-to-date. | ||
134 | m4_ifdef([gl_FUNC_FCHDIR], [ | ||
135 | gl_TEST_FCHDIR | ||
136 | if test $HAVE_FCHDIR = 0; then | ||
137 | gl_REPLACE_FCNTL | ||
138 | fi | ||
139 | ]) | ||
140 | ]) | ||
141 | |||
142 | AC_DEFUN([gl_REPLACE_FCNTL], | ||
143 | [ | ||
144 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | ||
145 | AC_CHECK_FUNCS_ONCE([fcntl]) | ||
146 | if test $ac_cv_func_fcntl = no; then | ||
147 | HAVE_FCNTL=0 | ||
148 | else | ||
149 | REPLACE_FCNTL=1 | ||
150 | fi | ||
151 | ]) | ||
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 new file mode 100644 index 0000000..68f4e64 --- /dev/null +++ b/gl/m4/fcntl_h.m4 | |||
@@ -0,0 +1,70 @@ | |||
1 | # serial 20 | ||
2 | # Configure fcntl.h. | ||
3 | dnl Copyright (C) 2006-2007, 2009-2023 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 | |||
8 | dnl Written by Paul Eggert. | ||
9 | |||
10 | AC_DEFUN_ONCE([gl_FCNTL_H], | ||
11 | [ | ||
12 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | ||
13 | AC_REQUIRE([gl_FCNTL_O_FLAGS]) | ||
14 | gl_NEXT_HEADERS([fcntl.h]) | ||
15 | |||
16 | dnl Ensure the type pid_t gets defined. | ||
17 | AC_REQUIRE([AC_TYPE_PID_T]) | ||
18 | |||
19 | dnl Ensure the type mode_t gets defined. | ||
20 | AC_REQUIRE([AC_TYPE_MODE_T]) | ||
21 | |||
22 | dnl Check for declarations of anything we want to poison if the | ||
23 | dnl corresponding gnulib module is not in use, if it is not common | ||
24 | dnl enough to be declared everywhere. | ||
25 | gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> | ||
26 | ]], [fcntl openat]) | ||
27 | ]) | ||
28 | |||
29 | # gl_FCNTL_MODULE_INDICATOR([modulename]) | ||
30 | # sets the shell variable that indicates the presence of the given module | ||
31 | # to a C preprocessor expression that will evaluate to 1. | ||
32 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
33 | AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], | ||
34 | [ | ||
35 | dnl Ensure to expand the default settings once only. | ||
36 | gl_FCNTL_H_REQUIRE_DEFAULTS | ||
37 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
38 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
39 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
40 | ]) | ||
41 | |||
42 | # Initializes the default values for AC_SUBSTed shell variables. | ||
43 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
44 | # outside of macros or in macros that are not AC_REQUIREd. | ||
45 | AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], | ||
46 | [ | ||
47 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [ | ||
48 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT]) | ||
49 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL]) | ||
50 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) | ||
51 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) | ||
52 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) | ||
53 | dnl Support Microsoft deprecated alias function names by default. | ||
54 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) | ||
55 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) | ||
56 | ]) | ||
57 | m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS]) | ||
58 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | ||
59 | ]) | ||
60 | |||
61 | AC_DEFUN([gl_FCNTL_H_DEFAULTS], | ||
62 | [ | ||
63 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
64 | HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) | ||
65 | HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) | ||
66 | REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) | ||
67 | REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) | ||
68 | REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) | ||
69 | REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) | ||
70 | ]) | ||
diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4 new file mode 100644 index 0000000..3e3c890 --- /dev/null +++ b/gl/m4/fflush.m4 | |||
@@ -0,0 +1,100 @@ | |||
1 | # fflush.m4 serial 18 | ||
2 | |||
3 | # Copyright (C) 2007-2023 Free Software Foundation, Inc. | ||
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 | dnl From Eric Blake | ||
9 | |||
10 | dnl Find out how to obey POSIX semantics of fflush(stdin) discarding | ||
11 | dnl unread input on seekable streams, rather than C99 undefined semantics. | ||
12 | |||
13 | AC_DEFUN([gl_FUNC_FFLUSH], | ||
14 | [ | ||
15 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
16 | gl_FUNC_FFLUSH_STDIN | ||
17 | case "$gl_cv_func_fflush_stdin" in | ||
18 | *yes) ;; | ||
19 | *) REPLACE_FFLUSH=1 ;; | ||
20 | esac | ||
21 | ]) | ||
22 | |||
23 | dnl Determine whether fflush works on input streams. | ||
24 | dnl Sets gl_cv_func_fflush_stdin. | ||
25 | |||
26 | AC_DEFUN([gl_FUNC_FFLUSH_STDIN], | ||
27 | [ | ||
28 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
29 | AC_CHECK_HEADERS_ONCE([unistd.h]) | ||
30 | AC_CACHE_CHECK([whether fflush works on input streams], | ||
31 | [gl_cv_func_fflush_stdin], | ||
32 | [echo hello world > conftest.txt | ||
33 | AC_RUN_IFELSE([AC_LANG_PROGRAM( | ||
34 | [[ | ||
35 | #include <stdio.h> | ||
36 | #if HAVE_UNISTD_H | ||
37 | # include <unistd.h> | ||
38 | #else /* on Windows with MSVC */ | ||
39 | # include <io.h> | ||
40 | #endif | ||
41 | ]GL_MDA_DEFINES], | ||
42 | [[FILE *f = fopen ("conftest.txt", "r"); | ||
43 | char buffer[10]; | ||
44 | int fd; | ||
45 | int c; | ||
46 | if (f == NULL) | ||
47 | return 1; | ||
48 | fd = fileno (f); | ||
49 | if (fd < 0 || fread (buffer, 1, 5, f) != 5) | ||
50 | { fclose (f); return 2; } | ||
51 | /* For deterministic results, ensure f read a bigger buffer. */ | ||
52 | if (lseek (fd, 0, SEEK_CUR) == 5) | ||
53 | { fclose (f); return 3; } | ||
54 | /* POSIX requires fflush-fseek to set file offset of fd. This fails | ||
55 | on BSD systems and on mingw. */ | ||
56 | if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) | ||
57 | { fclose (f); return 4; } | ||
58 | if (lseek (fd, 0, SEEK_CUR) != 5) | ||
59 | { fclose (f); return 5; } | ||
60 | /* Verify behaviour of fflush after ungetc. See | ||
61 | <https://www.opengroup.org/austin/aardvark/latest/xshbug3.txt> */ | ||
62 | /* Verify behaviour of fflush after a backup ungetc. This fails on | ||
63 | mingw. */ | ||
64 | c = fgetc (f); | ||
65 | ungetc (c, f); | ||
66 | fflush (f); | ||
67 | if (fgetc (f) != c) | ||
68 | { fclose (f); return 6; } | ||
69 | /* Verify behaviour of fflush after a non-backup ungetc. This fails | ||
70 | on glibc 2.8 and on BSD systems. */ | ||
71 | c = fgetc (f); | ||
72 | ungetc ('@', f); | ||
73 | fflush (f); | ||
74 | if (fgetc (f) != c) | ||
75 | { fclose (f); return 7; } | ||
76 | fclose (f); | ||
77 | return 0; | ||
78 | ]])], | ||
79 | [gl_cv_func_fflush_stdin=yes], | ||
80 | [gl_cv_func_fflush_stdin=no], | ||
81 | [case "$host_os" in | ||
82 | # Guess no on native Windows. | ||
83 | mingw*) gl_cv_func_fflush_stdin="guessing no" ;; | ||
84 | *) gl_cv_func_fflush_stdin=cross ;; | ||
85 | esac | ||
86 | ]) | ||
87 | rm conftest.txt | ||
88 | ]) | ||
89 | case "$gl_cv_func_fflush_stdin" in | ||
90 | *yes) gl_func_fflush_stdin=1 ;; | ||
91 | *no) gl_func_fflush_stdin=0 ;; | ||
92 | *) gl_func_fflush_stdin='(-1)' ;; | ||
93 | esac | ||
94 | 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, | ||
96 | 0 if fflush is known to not work, -1 if unknown.]) | ||
97 | ]) | ||
98 | |||
99 | # Prerequisites of lib/fflush.c. | ||
100 | AC_DEFUN([gl_PREREQ_FFLUSH], [:]) | ||
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index 397f2d1..2f0c9c4 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # float_h.m4 serial 9 | 1 | # float_h.m4 serial 13 |
2 | dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,42 +8,46 @@ AC_DEFUN([gl_FLOAT_H], | |||
8 | [ | 8 | [ |
9 | AC_REQUIRE([AC_PROG_CC]) | 9 | AC_REQUIRE([AC_PROG_CC]) |
10 | AC_REQUIRE([AC_CANONICAL_HOST]) | 10 | AC_REQUIRE([AC_CANONICAL_HOST]) |
11 | FLOAT_H= | 11 | GL_GENERATE_FLOAT_H=false |
12 | REPLACE_FLOAT_LDBL=0 | 12 | REPLACE_FLOAT_LDBL=0 |
13 | case "$host_os" in | 13 | case "$host_os" in |
14 | aix* | beos* | openbsd* | mirbsd* | irix*) | 14 | aix* | beos* | openbsd* | mirbsd* | irix*) |
15 | FLOAT_H=float.h | 15 | GL_GENERATE_FLOAT_H=true |
16 | ;; | 16 | ;; |
17 | freebsd*) | 17 | freebsd* | dragonfly*) |
18 | case "$host_cpu" in | 18 | case "$host_cpu" in |
19 | changequote(,)dnl | 19 | changequote(,)dnl |
20 | i[34567]86 ) | 20 | i[34567]86 ) |
21 | changequote([,])dnl | 21 | changequote([,])dnl |
22 | FLOAT_H=float.h | 22 | GL_GENERATE_FLOAT_H=true |
23 | ;; | 23 | ;; |
24 | x86_64 ) | 24 | x86_64 ) |
25 | # On x86_64 systems, the C compiler may still be generating | 25 | # On x86_64 systems, the C compiler may still be generating |
26 | # 32-bit code. | 26 | # 32-bit code. |
27 | AC_EGREP_CPP([yes], | 27 | AC_COMPILE_IFELSE( |
28 | [#if defined __LP64__ || defined __x86_64__ || defined __amd64__ | 28 | [AC_LANG_SOURCE( |
29 | yes | 29 | [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__ |
30 | #endif], | 30 | int ok; |
31 | #else | ||
32 | error fail | ||
33 | #endif | ||
34 | ]])], | ||
31 | [], | 35 | [], |
32 | [FLOAT_H=float.h]) | 36 | [GL_GENERATE_FLOAT_H=true]) |
33 | ;; | 37 | ;; |
34 | esac | 38 | esac |
35 | ;; | 39 | ;; |
36 | linux*) | 40 | linux*) |
37 | case "$host_cpu" in | 41 | case "$host_cpu" in |
38 | powerpc*) | 42 | powerpc*) |
39 | FLOAT_H=float.h | 43 | GL_GENERATE_FLOAT_H=true |
40 | ;; | 44 | ;; |
41 | esac | 45 | esac |
42 | ;; | 46 | ;; |
43 | esac | 47 | esac |
44 | case "$host_os" in | 48 | case "$host_os" in |
45 | aix* | freebsd* | linux*) | 49 | aix* | freebsd* | dragonfly* | linux*) |
46 | if test -n "$FLOAT_H"; then | 50 | if $GL_GENERATE_FLOAT_H; then |
47 | REPLACE_FLOAT_LDBL=1 | 51 | REPLACE_FLOAT_LDBL=1 |
48 | fi | 52 | fi |
49 | ;; | 53 | ;; |
@@ -69,14 +73,20 @@ int main () | |||
69 | [gl_cv_func_itold_works=no], | 73 | [gl_cv_func_itold_works=no], |
70 | [case "$host" in | 74 | [case "$host" in |
71 | sparc*-*-linux*) | 75 | sparc*-*-linux*) |
72 | AC_EGREP_CPP([yes], | 76 | AC_COMPILE_IFELSE( |
73 | [#if defined __LP64__ || defined __arch64__ | 77 | [AC_LANG_SOURCE( |
74 | yes | 78 | [[#if defined __LP64__ || defined __arch64__ |
75 | #endif], | 79 | int ok; |
80 | #else | ||
81 | error fail | ||
82 | #endif | ||
83 | ]])], | ||
76 | [gl_cv_func_itold_works="guessing no"], | 84 | [gl_cv_func_itold_works="guessing no"], |
77 | [gl_cv_func_itold_works="guessing yes"]) | 85 | [gl_cv_func_itold_works="guessing yes"]) |
78 | ;; | 86 | ;; |
79 | *) gl_cv_func_itold_works="guessing yes" ;; | 87 | # Guess yes on native Windows. |
88 | mingw*) gl_cv_func_itold_works="guessing yes" ;; | ||
89 | *) gl_cv_func_itold_works="guessing yes" ;; | ||
80 | esac | 90 | esac |
81 | ]) | 91 | ]) |
82 | ]) | 92 | ]) |
@@ -85,14 +95,12 @@ int main () | |||
85 | REPLACE_ITOLD=1 | 95 | REPLACE_ITOLD=1 |
86 | dnl We add the workaround to <float.h> but also to <math.h>, | 96 | dnl We add the workaround to <float.h> but also to <math.h>, |
87 | dnl to increase the chances that the fix function gets pulled in. | 97 | dnl to increase the chances that the fix function gets pulled in. |
88 | FLOAT_H=float.h | 98 | GL_GENERATE_FLOAT_H=true |
89 | ;; | 99 | ;; |
90 | esac | 100 | esac |
91 | 101 | ||
92 | if test -n "$FLOAT_H"; then | 102 | if $GL_GENERATE_FLOAT_H; then |
93 | gl_NEXT_HEADERS([float.h]) | 103 | gl_NEXT_HEADERS([float.h]) |
94 | fi | 104 | fi |
95 | AC_SUBST([FLOAT_H]) | ||
96 | AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) | ||
97 | AC_SUBST([REPLACE_ITOLD]) | 105 | AC_SUBST([REPLACE_ITOLD]) |
98 | ]) | 106 | ]) |
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index c892ff9..c49ffa6 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # floorf.m4 serial 13 | 1 | # floorf.m4 serial 18 |
2 | dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -39,7 +39,7 @@ AC_DEFUN([gl_FUNC_FLOORF], | |||
39 | static float dummy (float f) { return 0; } | 39 | static float dummy (float f) { return 0; } |
40 | int main (int argc, char *argv[]) | 40 | int main (int argc, char *argv[]) |
41 | { | 41 | { |
42 | float (*my_floorf) (float) = argc ? floorf : dummy; | 42 | float (* volatile my_floorf) (float) = argc ? floorf : dummy; |
43 | /* Test whether floorf (-0.0f) is -0.0f. */ | 43 | /* Test whether floorf (-0.0f) is -0.0f. */ |
44 | if (signbitf (minus_zerof) && !signbitf (my_floorf (minus_zerof))) | 44 | if (signbitf (minus_zerof) && !signbitf (my_floorf (minus_zerof))) |
45 | return 1; | 45 | return 1; |
@@ -49,10 +49,14 @@ int main (int argc, char *argv[]) | |||
49 | [gl_cv_func_floorf_ieee=yes], | 49 | [gl_cv_func_floorf_ieee=yes], |
50 | [gl_cv_func_floorf_ieee=no], | 50 | [gl_cv_func_floorf_ieee=no], |
51 | [case "$host_os" in | 51 | [case "$host_os" in |
52 | # Guess yes on glibc systems. | 52 | # Guess yes on glibc systems. |
53 | *-gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; | 53 | *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; |
54 | # If we don't know, assume the worst. | 54 | # Guess yes on musl systems. |
55 | *) gl_cv_func_floorf_ieee="guessing no" ;; | 55 | *-musl*) gl_cv_func_floorf_ieee="guessing yes" ;; |
56 | # Guess yes on native Windows. | ||
57 | mingw*) gl_cv_func_floorf_ieee="guessing yes" ;; | ||
58 | # If we don't know, obey --enable-cross-guesses. | ||
59 | *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; | ||
56 | esac | 60 | esac |
57 | ]) | 61 | ]) |
58 | LIBS="$save_LIBS" | 62 | LIBS="$save_LIBS" |
diff --git a/gl/m4/fopen.m4 b/gl/m4/fopen.m4 new file mode 100644 index 0000000..9c39ff7 --- /dev/null +++ b/gl/m4/fopen.m4 | |||
@@ -0,0 +1,149 @@ | |||
1 | # fopen.m4 serial 13 | ||
2 | dnl Copyright (C) 2007-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_FUNC_FOPEN], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
10 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
11 | case "$host_os" in | ||
12 | mingw* | pw*) | ||
13 | dnl Replace fopen, for handling of "/dev/null". | ||
14 | REPLACE_FOPEN=1 | ||
15 | dnl fopen on mingw also has the trailing slash bug. | ||
16 | gl_cv_func_fopen_slash="guessing no" | ||
17 | ;; | ||
18 | *) | ||
19 | dnl fopen("foo/", "w") should not create a file when the file name has a | ||
20 | dnl trailing slash. | ||
21 | AC_CACHE_CHECK([whether fopen recognizes a trailing slash], | ||
22 | [gl_cv_func_fopen_slash], | ||
23 | [ | ||
24 | AC_RUN_IFELSE( | ||
25 | [AC_LANG_SOURCE([[ | ||
26 | #include <stddef.h> | ||
27 | #include <stdio.h> | ||
28 | int main () | ||
29 | { | ||
30 | FILE *fp = fopen ("conftest.sl/", "w"); | ||
31 | int result = (fp != NULL); | ||
32 | if (fp != NULL) | ||
33 | fclose (fp); | ||
34 | return result; | ||
35 | }]])], | ||
36 | [gl_cv_func_fopen_slash=yes], | ||
37 | [gl_cv_func_fopen_slash=no], | ||
38 | [ | ||
39 | changequote(,)dnl | ||
40 | case "$host_os" in | ||
41 | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) | ||
42 | gl_cv_func_fopen_slash="guessing no" ;; | ||
43 | *) | ||
44 | gl_cv_func_fopen_slash="guessing yes" ;; | ||
45 | esac | ||
46 | changequote([,])dnl | ||
47 | ]) | ||
48 | rm -f conftest.sl | ||
49 | ]) | ||
50 | ;; | ||
51 | esac | ||
52 | case "$gl_cv_func_fopen_slash" in | ||
53 | *no) | ||
54 | AC_DEFINE([FOPEN_TRAILING_SLASH_BUG], [1], | ||
55 | [Define to 1 if fopen() fails to recognize a trailing slash.]) | ||
56 | REPLACE_FOPEN=1 | ||
57 | ;; | ||
58 | esac | ||
59 | ]) | ||
60 | |||
61 | AC_DEFUN([gl_FUNC_FOPEN_GNU], | ||
62 | [ | ||
63 | AC_REQUIRE([gl_FUNC_FOPEN]) | ||
64 | AC_CACHE_CHECK([whether fopen supports the mode character 'x'], | ||
65 | [gl_cv_func_fopen_mode_x], | ||
66 | [rm -f conftest.x | ||
67 | AC_RUN_IFELSE( | ||
68 | [AC_LANG_SOURCE([[ | ||
69 | #include <stdio.h> | ||
70 | #include <errno.h> | ||
71 | int main () | ||
72 | { | ||
73 | FILE *fp; | ||
74 | fp = fopen ("conftest.x", "w"); | ||
75 | fclose (fp); | ||
76 | fp = fopen ("conftest.x", "wx"); | ||
77 | if (fp != NULL) | ||
78 | /* 'x' ignored */ | ||
79 | return 1; | ||
80 | else if (errno == EEXIST) | ||
81 | return 0; | ||
82 | else | ||
83 | /* 'x' rejected */ | ||
84 | return 2; | ||
85 | }]])], | ||
86 | [gl_cv_func_fopen_mode_x=yes], | ||
87 | [gl_cv_func_fopen_mode_x=no], | ||
88 | [case "$host_os" in | ||
89 | # Guess yes on glibc and musl systems. | ||
90 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) | ||
91 | gl_cv_func_fopen_mode_x="guessing yes" ;; | ||
92 | # If we don't know, obey --enable-cross-guesses. | ||
93 | *) | ||
94 | gl_cv_func_fopen_mode_x="$gl_cross_guess_normal" ;; | ||
95 | esac | ||
96 | ]) | ||
97 | rm -f conftest.x | ||
98 | ]) | ||
99 | AC_CACHE_CHECK([whether fopen supports the mode character 'e'], | ||
100 | [gl_cv_func_fopen_mode_e], | ||
101 | [echo foo > conftest.x | ||
102 | AC_RUN_IFELSE( | ||
103 | [AC_LANG_SOURCE([[ | ||
104 | #include <stdio.h> | ||
105 | #include <errno.h> | ||
106 | #include <fcntl.h> | ||
107 | ]GL_MDA_DEFINES[ | ||
108 | int main () | ||
109 | { | ||
110 | FILE *fp = fopen ("conftest.x", "re"); | ||
111 | if (fp != NULL) | ||
112 | { | ||
113 | if (fcntl (fileno (fp), F_GETFD) & FD_CLOEXEC) | ||
114 | return 0; | ||
115 | else | ||
116 | /* 'e' ignored */ | ||
117 | return 1; | ||
118 | } | ||
119 | else | ||
120 | /* 'e' rejected */ | ||
121 | return 2; | ||
122 | }]])], | ||
123 | [gl_cv_func_fopen_mode_e=yes], | ||
124 | [gl_cv_func_fopen_mode_e=no], | ||
125 | [case "$host_os" in | ||
126 | # Guess yes on glibc and musl systems. | ||
127 | linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) | ||
128 | gl_cv_func_fopen_mode_e="guessing yes" ;; | ||
129 | # Guess no on native Windows. | ||
130 | mingw*) | ||
131 | gl_cv_func_fopen_mode_e="guessing no" ;; | ||
132 | # If we don't know, obey --enable-cross-guesses. | ||
133 | *) | ||
134 | gl_cv_func_fopen_mode_e="$gl_cross_guess_normal" ;; | ||
135 | esac | ||
136 | ]) | ||
137 | rm -f conftest.x | ||
138 | ]) | ||
139 | REPLACE_FOPEN_FOR_FOPEN_GNU="$REPLACE_FOPEN" | ||
140 | case "$gl_cv_func_fopen_mode_x" in | ||
141 | *no) REPLACE_FOPEN_FOR_FOPEN_GNU=1 ;; | ||
142 | esac | ||
143 | case "$gl_cv_func_fopen_mode_e" in | ||
144 | *no) REPLACE_FOPEN_FOR_FOPEN_GNU=1 ;; | ||
145 | esac | ||
146 | ]) | ||
147 | |||
148 | # Prerequisites of lib/fopen.c. | ||
149 | AC_DEFUN([gl_PREREQ_FOPEN], [:]) | ||
diff --git a/gl/m4/fpurge.m4 b/gl/m4/fpurge.m4 new file mode 100644 index 0000000..b365409 --- /dev/null +++ b/gl/m4/fpurge.m4 | |||
@@ -0,0 +1,73 @@ | |||
1 | # fpurge.m4 serial 12 | ||
2 | dnl Copyright (C) 2007, 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_FUNC_FPURGE], | ||
8 | [ | ||
9 | 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_FUNCS_ONCE([fpurge]) | ||
13 | AC_CHECK_FUNCS_ONCE([__fpurge]) | ||
14 | AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) | ||
15 | if test "x$ac_cv_func_fpurge" = xyes; then | ||
16 | HAVE_FPURGE=1 | ||
17 | # 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_RUN_IFELSE( | ||
20 | [AC_LANG_PROGRAM( | ||
21 | [[#include <stdio.h> | ||
22 | ]], | ||
23 | [[FILE *f = fopen ("conftest.txt", "w+"); | ||
24 | if (!f) | ||
25 | return 1; | ||
26 | if (fputc ('a', f) != 'a') | ||
27 | { fclose (f); return 2; } | ||
28 | rewind (f); | ||
29 | if (fgetc (f) != 'a') | ||
30 | { fclose (f); return 3; } | ||
31 | if (fgetc (f) != EOF) | ||
32 | { fclose (f); return 4; } | ||
33 | if (fpurge (f) != 0) | ||
34 | { fclose (f); return 5; } | ||
35 | if (putc ('b', f) != 'b') | ||
36 | { fclose (f); return 6; } | ||
37 | if (fclose (f) != 0) | ||
38 | return 7; | ||
39 | if ((f = fopen ("conftest.txt", "r")) == NULL) | ||
40 | return 8; | ||
41 | if (fgetc (f) != 'a') | ||
42 | { fclose (f); return 9; } | ||
43 | if (fgetc (f) != 'b') | ||
44 | { fclose (f); return 10; } | ||
45 | if (fgetc (f) != EOF) | ||
46 | { fclose (f); return 11; } | ||
47 | if (fclose (f) != 0) | ||
48 | return 12; | ||
49 | if (remove ("conftest.txt") != 0) | ||
50 | return 13; | ||
51 | return 0; | ||
52 | ]])], | ||
53 | [gl_cv_func_fpurge_works=yes], | ||
54 | [gl_cv_func_fpurge_works=no], | ||
55 | [case "$host_os" in | ||
56 | # Guess yes on musl systems. | ||
57 | *-musl*) gl_cv_func_fpurge_works="guessing yes" ;; | ||
58 | # Otherwise obey --enable-cross-guesses. | ||
59 | *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; | ||
60 | esac | ||
61 | ]) | ||
62 | ]) | ||
63 | case "$gl_cv_func_fpurge_works" in | ||
64 | *yes) ;; | ||
65 | *) REPLACE_FPURGE=1 ;; | ||
66 | esac | ||
67 | else | ||
68 | HAVE_FPURGE=0 | ||
69 | fi | ||
70 | if test "x$ac_cv_have_decl_fpurge" = xno; then | ||
71 | HAVE_DECL_FPURGE=0 | ||
72 | fi | ||
73 | ]) | ||
diff --git a/gl/m4/freading.m4 b/gl/m4/freading.m4 new file mode 100644 index 0000000..3533336 --- /dev/null +++ b/gl/m4/freading.m4 | |||
@@ -0,0 +1,11 @@ | |||
1 | # freading.m4 serial 2 | ||
2 | dnl Copyright (C) 2007, 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_FUNC_FREADING], | ||
8 | [ | ||
9 | AC_CHECK_HEADERS_ONCE([stdio_ext.h]) | ||
10 | AC_CHECK_FUNCS_ONCE([__freading]) | ||
11 | ]) | ||
diff --git a/gl/m4/free.m4 b/gl/m4/free.m4 new file mode 100644 index 0000000..0389dea --- /dev/null +++ b/gl/m4/free.m4 | |||
@@ -0,0 +1,52 @@ | |||
1 | # free.m4 serial 6 | ||
2 | # Copyright (C) 2003-2005, 2009-2023 Free Software Foundation, Inc. | ||
3 | # This file is free software; the Free Software Foundation | ||
4 | # gives unlimited permission to copy and/or distribute it, | ||
5 | # with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | # Written by Paul Eggert and Bruno Haible. | ||
8 | |||
9 | AC_DEFUN([gl_FUNC_FREE], | ||
10 | [ | ||
11 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
12 | |||
13 | dnl In the next release of POSIX, free must preserve errno. | ||
14 | dnl https://www.austingroupbugs.net/view.php?id=385 | ||
15 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924 | ||
16 | dnl So far, we know of three platforms that do this: | ||
17 | dnl * glibc >= 2.33, thanks to the fix for this bug: | ||
18 | dnl <https://sourceware.org/bugzilla/show_bug.cgi?id=17924> | ||
19 | dnl * OpenBSD >= 4.5, thanks to this commit: | ||
20 | dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h> | ||
21 | dnl * Solaris, because its malloc() implementation is based on brk(), | ||
22 | dnl not mmap(); hence its free() implementation makes no system calls. | ||
23 | dnl For other platforms, you can only be sure if they state it in their | ||
24 | dnl documentation, or by code inspection of the free() implementation in libc. | ||
25 | AC_CACHE_CHECK([whether free is known to preserve errno], | ||
26 | [gl_cv_func_free_preserves_errno], | ||
27 | [AC_COMPILE_IFELSE( | ||
28 | [AC_LANG_PROGRAM( | ||
29 | [[#include <stdlib.h> | ||
30 | ]], | ||
31 | [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) | ||
32 | #elif defined __OpenBSD__ | ||
33 | #elif defined __sun | ||
34 | #else | ||
35 | #error "'free' is not known to preserve errno" | ||
36 | #endif | ||
37 | ]])], | ||
38 | [gl_cv_func_free_preserves_errno=yes], | ||
39 | [gl_cv_func_free_preserves_errno=no]) | ||
40 | ]) | ||
41 | |||
42 | case $gl_cv_func_free_preserves_errno in | ||
43 | *yes) | ||
44 | AC_DEFINE([HAVE_FREE_POSIX], [1], | ||
45 | [Define if the 'free' function is guaranteed to preserve errno.]) | ||
46 | ;; | ||
47 | *) REPLACE_FREE=1 ;; | ||
48 | esac | ||
49 | ]) | ||
50 | |||
51 | # Prerequisites of lib/free.c. | ||
52 | AC_DEFUN([gl_PREREQ_FREE], [:]) | ||
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4 new file mode 100644 index 0000000..c5fe688 --- /dev/null +++ b/gl/m4/fseek.m4 | |||
@@ -0,0 +1,15 @@ | |||
1 | # fseek.m4 serial 4 | ||
2 | dnl Copyright (C) 2007, 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_FUNC_FSEEK], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
10 | AC_REQUIRE([gl_FUNC_FSEEKO]) | ||
11 | dnl When fseeko needs fixes, fseek needs them too. | ||
12 | if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then | ||
13 | REPLACE_FSEEK=1 | ||
14 | fi | ||
15 | ]) | ||
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4 new file mode 100644 index 0000000..05ee06b --- /dev/null +++ b/gl/m4/fseeko.m4 | |||
@@ -0,0 +1,77 @@ | |||
1 | # fseeko.m4 serial 20 | ||
2 | dnl Copyright (C) 2007-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_FUNC_FSEEKO], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
10 | AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) | ||
11 | AC_REQUIRE([gl_SYS_TYPES_H]) | ||
12 | AC_REQUIRE([AC_PROG_CC]) | ||
13 | |||
14 | dnl Persuade glibc <stdio.h> to declare fseeko(). | ||
15 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
16 | |||
17 | AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko], | ||
18 | [ | ||
19 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> | ||
20 | ]], [[fseeko (stdin, 0, 0);]])], | ||
21 | [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no]) | ||
22 | ]) | ||
23 | |||
24 | AC_CHECK_DECLS_ONCE([fseeko]) | ||
25 | if test $ac_cv_have_decl_fseeko = no; then | ||
26 | HAVE_DECL_FSEEKO=0 | ||
27 | fi | ||
28 | |||
29 | if test $gl_cv_func_fseeko = no; then | ||
30 | HAVE_FSEEKO=0 | ||
31 | else | ||
32 | if test $WINDOWS_64_BIT_OFF_T = 1; then | ||
33 | REPLACE_FSEEKO=1 | ||
34 | fi | ||
35 | if test $gl_cv_var_stdin_large_offset = no; then | ||
36 | REPLACE_FSEEKO=1 | ||
37 | fi | ||
38 | m4_ifdef([gl_FUNC_FFLUSH_STDIN], [ | ||
39 | gl_FUNC_FFLUSH_STDIN | ||
40 | case "$gl_cv_func_fflush_stdin" in | ||
41 | *yes) ;; | ||
42 | *) REPLACE_FSEEKO=1 ;; | ||
43 | esac | ||
44 | ]) | ||
45 | fi | ||
46 | ]) | ||
47 | |||
48 | dnl Code shared by fseeko and ftello. Determine if large files are supported, | ||
49 | dnl but stdin does not start as a large file by default. | ||
50 | AC_DEFUN([gl_STDIN_LARGE_OFFSET], | ||
51 | [ | ||
52 | AC_CACHE_CHECK([whether stdin defaults to large file offsets], | ||
53 | [gl_cv_var_stdin_large_offset], | ||
54 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], | ||
55 | [[#if defined __SL64 && defined __SCLE /* cygwin */ | ||
56 | /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making | ||
57 | fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and | ||
58 | it is easier to do a version check than building a runtime test. */ | ||
59 | # include <cygwin/version.h> | ||
60 | # if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25) | ||
61 | choke me | ||
62 | # endif | ||
63 | #endif]])], | ||
64 | [gl_cv_var_stdin_large_offset=yes], | ||
65 | [gl_cv_var_stdin_large_offset=no])]) | ||
66 | ]) | ||
67 | |||
68 | # Prerequisites of lib/fseeko.c. | ||
69 | AC_DEFUN([gl_PREREQ_FSEEKO], | ||
70 | [ | ||
71 | dnl Native Windows has the function _fseeki64. mingw hides it in some | ||
72 | dnl circumstances, but mingw64 makes it usable again. | ||
73 | AC_CHECK_FUNCS([_fseeki64]) | ||
74 | if test $ac_cv_func__fseeki64 = yes; then | ||
75 | AC_CHECK_DECLS([_fseeki64]) | ||
76 | fi | ||
77 | ]) | ||
diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4 new file mode 100644 index 0000000..7cb2edb --- /dev/null +++ b/gl/m4/fstat.m4 | |||
@@ -0,0 +1,40 @@ | |||
1 | # fstat.m4 serial 8 | ||
2 | dnl Copyright (C) 2011-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_FUNC_FSTAT], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
10 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
11 | |||
12 | case "$host_os" in | ||
13 | mingw* | solaris*) | ||
14 | dnl On MinGW, the original stat() returns st_atime, st_mtime, | ||
15 | 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 | ||
18 | ;; | ||
19 | esac | ||
20 | |||
21 | dnl Replace fstat() for supporting the gnulib-defined open() on directories. | ||
22 | m4_ifdef([gl_FUNC_FCHDIR], [ | ||
23 | gl_TEST_FCHDIR | ||
24 | if test $HAVE_FCHDIR = 0; then | ||
25 | case "$gl_cv_func_open_directory_works" in | ||
26 | *yes) ;; | ||
27 | *) | ||
28 | REPLACE_FSTAT=1 | ||
29 | ;; | ||
30 | esac | ||
31 | fi | ||
32 | ]) | ||
33 | ]) | ||
34 | |||
35 | # Prerequisites of lib/fstat.c and lib/stat-w32.c. | ||
36 | AC_DEFUN([gl_PREREQ_FSTAT], [ | ||
37 | AC_REQUIRE([gl_SYS_STAT_H]) | ||
38 | AC_REQUIRE([gl_PREREQ_STAT_W32]) | ||
39 | : | ||
40 | ]) | ||
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4 index c72ecb8..f65c459 100644 --- a/gl/m4/fstypename.m4 +++ b/gl/m4/fstypename.m4 | |||
@@ -6,7 +6,7 @@ dnl See if struct statfs has the f_fstypename member. | |||
6 | dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. | 6 | dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. |
7 | dnl | 7 | dnl |
8 | 8 | ||
9 | # Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2013 Free Software | 9 | # Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2023 Free Software |
10 | # Foundation, Inc. | 10 | # Foundation, Inc. |
11 | # This file is free software; the Free Software Foundation | 11 | # This file is free software; the Free Software Foundation |
12 | # gives unlimited permission to copy and/or distribute it, | 12 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 6277bfa..88f3ca8 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 | |||
@@ -1,7 +1,7 @@ | |||
1 | # serial 30 | 1 | # serial 35 |
2 | # Obtaining file system usage information. | 2 | # Obtaining file system usage information. |
3 | 3 | ||
4 | # Copyright (C) 1997-1998, 2000-2001, 2003-2013 Free Software Foundation, Inc. | 4 | # Copyright (C) 1997-1998, 2000-2001, 2003-2023 Free Software Foundation, Inc. |
5 | # | 5 | # |
6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
@@ -29,27 +29,29 @@ AC_DEFUN([gl_FSUSAGE], | |||
29 | 29 | ||
30 | AC_DEFUN([gl_FILE_SYSTEM_USAGE], | 30 | AC_DEFUN([gl_FILE_SYSTEM_USAGE], |
31 | [ | 31 | [ |
32 | dnl Enable large-file support. This has the effect of changing the size | 32 | dnl Enable large-file support. This has the effect of changing the size |
33 | dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on | 33 | dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on |
34 | dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size | 34 | dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size |
35 | dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on | 35 | dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on |
36 | dnl Mac OS X >= 10.5 (32-bit mode). | 36 | dnl Mac OS X >= 10.5 (32-bit mode). |
37 | AC_REQUIRE([AC_SYS_LARGEFILE]) | 37 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
38 | 38 | ||
39 | AC_MSG_NOTICE([checking how to get file system space usage]) | 39 | ac_fsusage_space=no |
40 | ac_fsusage_space=no | ||
41 | 40 | ||
42 | # Perform only the link test since it seems there are no variants of the | 41 | # Perform only the link test since it seems there are no variants of the |
43 | # statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) | 42 | # statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) |
44 | # because that got a false positive on SCO OSR5. Adding the declaration | 43 | # because that got a false positive on SCO OSR5. Adding the declaration |
45 | # of a 'struct statvfs' causes this test to fail (as it should) on such | 44 | # of a 'struct statvfs' causes this test to fail (as it should) on such |
46 | # systems. That system is reported to work fine with STAT_STATFS4 which | 45 | # systems. That system is reported to work fine with STAT_STATFS4 which |
47 | # is what it gets when this test fails. | 46 | # is what it gets when this test fails. |
48 | if test $ac_fsusage_space = no; then | 47 | if test $ac_fsusage_space = no; then |
49 | # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, | 48 | # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, |
50 | # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. | 49 | # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. |
51 | AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], | 50 | AC_CACHE_CHECK([for statvfs function (SVR4)], |
52 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | 51 | [fu_cv_sys_stat_statvfs], |
52 | [AC_LINK_IFELSE( | ||
53 | [AC_LANG_PROGRAM([[ | ||
54 | #include <sys/types.h> | ||
53 | #ifdef __osf__ | 55 | #ifdef __osf__ |
54 | "Do not use Tru64's statvfs implementation" | 56 | "Do not use Tru64's statvfs implementation" |
55 | #endif | 57 | #endif |
@@ -68,45 +70,47 @@ struct statvfs fsd; | |||
68 | int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; | 70 | int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; |
69 | #endif | 71 | #endif |
70 | ]], | 72 | ]], |
71 | [[statvfs (0, &fsd);]])], | 73 | [[statvfs (0, &fsd);]])], |
72 | [fu_cv_sys_stat_statvfs=yes], | 74 | [fu_cv_sys_stat_statvfs=yes], |
73 | [fu_cv_sys_stat_statvfs=no])]) | 75 | [fu_cv_sys_stat_statvfs=no]) |
74 | if test $fu_cv_sys_stat_statvfs = yes; then | ||
75 | ac_fsusage_space=yes | ||
76 | # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. | ||
77 | # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems | ||
78 | # statvfs with large-file support is already equivalent to statvfs64. | ||
79 | AC_CACHE_CHECK([whether to use statvfs64], | ||
80 | [fu_cv_sys_stat_statvfs64], | ||
81 | [AC_LINK_IFELSE( | ||
82 | [AC_LANG_PROGRAM( | ||
83 | [[#include <sys/types.h> | ||
84 | #include <sys/statvfs.h> | ||
85 | struct statvfs64 fsd; | ||
86 | int check_f_blocks_larger_in_statvfs64 | ||
87 | [sizeof (((struct statvfs64 *) 0)->f_blocks) | ||
88 | > sizeof (((struct statvfs *) 0)->f_blocks) | ||
89 | ? 1 : -1]; | ||
90 | ]], | ||
91 | [[statvfs64 (0, &fsd);]])], | ||
92 | [fu_cv_sys_stat_statvfs64=yes], | ||
93 | [fu_cv_sys_stat_statvfs64=no]) | ||
94 | ]) | 76 | ]) |
95 | if test $fu_cv_sys_stat_statvfs64 = yes; then | 77 | if test $fu_cv_sys_stat_statvfs = yes; then |
96 | AC_DEFINE([STAT_STATVFS64], [1], | 78 | ac_fsusage_space=yes |
97 | [ Define if statvfs64 should be preferred over statvfs.]) | 79 | # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. |
98 | else | 80 | # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems |
99 | AC_DEFINE([STAT_STATVFS], [1], | 81 | # statvfs with large-file support is already equivalent to statvfs64. |
100 | [ Define if there is a function named statvfs. (SVR4)]) | 82 | AC_CACHE_CHECK([whether to use statvfs64], |
83 | [fu_cv_sys_stat_statvfs64], | ||
84 | [AC_LINK_IFELSE( | ||
85 | [AC_LANG_PROGRAM( | ||
86 | [[#include <sys/types.h> | ||
87 | #include <sys/statvfs.h> | ||
88 | struct statvfs64 fsd; | ||
89 | int check_f_blocks_larger_in_statvfs64 | ||
90 | [sizeof (((struct statvfs64 *) 0)->f_blocks) | ||
91 | > sizeof (((struct statvfs *) 0)->f_blocks) | ||
92 | ? 1 : -1]; | ||
93 | ]], | ||
94 | [[statvfs64 (0, &fsd);]])], | ||
95 | [fu_cv_sys_stat_statvfs64=yes], | ||
96 | [fu_cv_sys_stat_statvfs64=no]) | ||
97 | ]) | ||
98 | if test $fu_cv_sys_stat_statvfs64 = yes; then | ||
99 | AC_DEFINE([STAT_STATVFS64], [1], | ||
100 | [Define if statvfs64 should be preferred over statvfs.]) | ||
101 | else | ||
102 | AC_DEFINE([STAT_STATVFS], [1], | ||
103 | [Define if there is a function named statvfs. (SVR4)]) | ||
104 | fi | ||
101 | fi | 105 | fi |
102 | fi | 106 | fi |
103 | fi | ||
104 | 107 | ||
105 | # Check for this unconditionally so we have a | 108 | # Check for this unconditionally so we have a |
106 | # good fallback on glibc/Linux > 2.6 < 2.6.36 | 109 | # good fallback on glibc/Linux > 2.6 < 2.6.36 |
107 | AC_MSG_CHECKING([for two-argument statfs with statfs.f_frsize member]) | 110 | AC_CACHE_CHECK([for two-argument statfs with statfs.f_frsize member], |
108 | AC_CACHE_VAL([fu_cv_sys_stat_statfs2_frsize], | 111 | [fu_cv_sys_stat_statfs2_frsize], |
109 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 112 | [AC_RUN_IFELSE( |
113 | [AC_LANG_SOURCE([[ | ||
110 | #ifdef HAVE_SYS_PARAM_H | 114 | #ifdef HAVE_SYS_PARAM_H |
111 | #include <sys/param.h> | 115 | #include <sys/param.h> |
112 | #endif | 116 | #endif |
@@ -119,26 +123,26 @@ AC_CACHE_VAL([fu_cv_sys_stat_statfs2_frsize], | |||
119 | int | 123 | int |
120 | main () | 124 | main () |
121 | { | 125 | { |
122 | struct statfs fsd; | 126 | struct statfs fsd; |
123 | fsd.f_frsize = 0; | 127 | fsd.f_frsize = 0; |
124 | return statfs (".", &fsd) != 0; | 128 | return statfs (".", &fsd) != 0; |
125 | }]])], | 129 | }]])], |
126 | [fu_cv_sys_stat_statfs2_frsize=yes], | 130 | [fu_cv_sys_stat_statfs2_frsize=yes], |
127 | [fu_cv_sys_stat_statfs2_frsize=no], | 131 | [fu_cv_sys_stat_statfs2_frsize=no], |
128 | [fu_cv_sys_stat_statfs2_frsize=no])]) | 132 | [fu_cv_sys_stat_statfs2_frsize=no]) |
129 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_frsize]) | 133 | ]) |
130 | if test $fu_cv_sys_stat_statfs2_frsize = yes; then | 134 | if test $fu_cv_sys_stat_statfs2_frsize = yes; then |
131 | ac_fsusage_space=yes | 135 | ac_fsusage_space=yes |
132 | AC_DEFINE([STAT_STATFS2_FRSIZE], [1], | 136 | AC_DEFINE([STAT_STATFS2_FRSIZE], [1], |
133 | [ Define if statfs takes 2 args and struct statfs has a field named f_frsize. | 137 | [Define if statfs takes 2 args and struct statfs has a field named f_frsize. |
134 | (glibc/Linux > 2.6)]) | 138 | (glibc/Linux > 2.6)]) |
135 | fi | 139 | fi |
136 | 140 | ||
137 | if test $ac_fsusage_space = no; then | 141 | if test $ac_fsusage_space = no; then |
138 | # DEC Alpha running OSF/1 | 142 | # DEC Alpha running OSF/1 |
139 | AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) | 143 | AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)], |
140 | AC_CACHE_VAL([fu_cv_sys_stat_statfs3_osf1], | 144 | [fu_cv_sys_stat_statfs3_osf1], |
141 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 145 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
142 | #include <sys/param.h> | 146 | #include <sys/param.h> |
143 | #include <sys/types.h> | 147 | #include <sys/types.h> |
144 | #include <sys/mount.h> | 148 | #include <sys/mount.h> |
@@ -149,28 +153,27 @@ if test $ac_fsusage_space = no; then | |||
149 | fsd.f_fsize = 0; | 153 | fsd.f_fsize = 0; |
150 | return statfs (".", &fsd, sizeof (struct statfs)) != 0; | 154 | return statfs (".", &fsd, sizeof (struct statfs)) != 0; |
151 | }]])], | 155 | }]])], |
152 | [fu_cv_sys_stat_statfs3_osf1=yes], | 156 | [fu_cv_sys_stat_statfs3_osf1=yes], |
153 | [fu_cv_sys_stat_statfs3_osf1=no], | 157 | [fu_cv_sys_stat_statfs3_osf1=no], |
154 | [fu_cv_sys_stat_statfs3_osf1=no])]) | 158 | [fu_cv_sys_stat_statfs3_osf1=no]) |
155 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs3_osf1]) | 159 | ]) |
156 | if test $fu_cv_sys_stat_statfs3_osf1 = yes; then | 160 | if test $fu_cv_sys_stat_statfs3_osf1 = yes; then |
157 | ac_fsusage_space=yes | 161 | ac_fsusage_space=yes |
158 | AC_DEFINE([STAT_STATFS3_OSF1], [1], | 162 | AC_DEFINE([STAT_STATFS3_OSF1], [1], |
159 | [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) | 163 | [Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) |
164 | fi | ||
160 | fi | 165 | fi |
161 | fi | ||
162 | 166 | ||
163 | if test $ac_fsusage_space = no; then | 167 | if test $ac_fsusage_space = no; then |
164 | # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. | 168 | # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. |
165 | # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, | 169 | # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, |
166 | # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) | 170 | # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) |
167 | # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and | 171 | # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and |
168 | # <sys/vfs.h>.) | 172 | # <sys/vfs.h>.) |
169 | # (On Solaris, statfs has 4 arguments.) | 173 | # (On Solaris, statfs has 4 arguments.) |
170 | AC_MSG_CHECKING([for two-argument statfs with statfs.f_bsize dnl | 174 | AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)], |
171 | member (AIX, 4.3BSD)]) | 175 | [fu_cv_sys_stat_statfs2_bsize], |
172 | AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize], | 176 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
173 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
174 | #ifdef HAVE_SYS_PARAM_H | 177 | #ifdef HAVE_SYS_PARAM_H |
175 | #include <sys/param.h> | 178 | #include <sys/param.h> |
176 | #endif | 179 | #endif |
@@ -183,88 +186,56 @@ member (AIX, 4.3BSD)]) | |||
183 | int | 186 | int |
184 | main () | 187 | main () |
185 | { | 188 | { |
186 | struct statfs fsd; | 189 | struct statfs fsd; |
187 | fsd.f_bsize = 0; | 190 | fsd.f_bsize = 0; |
188 | return statfs (".", &fsd) != 0; | 191 | return statfs (".", &fsd) != 0; |
189 | }]])], | 192 | }]])], |
190 | [fu_cv_sys_stat_statfs2_bsize=yes], | 193 | [fu_cv_sys_stat_statfs2_bsize=yes], |
191 | [fu_cv_sys_stat_statfs2_bsize=no], | 194 | [fu_cv_sys_stat_statfs2_bsize=no], |
192 | [fu_cv_sys_stat_statfs2_bsize=no])]) | 195 | [fu_cv_sys_stat_statfs2_bsize=no]) |
193 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize]) | 196 | ]) |
194 | if test $fu_cv_sys_stat_statfs2_bsize = yes; then | 197 | if test $fu_cv_sys_stat_statfs2_bsize = yes; then |
195 | ac_fsusage_space=yes | 198 | ac_fsusage_space=yes |
196 | AC_DEFINE([STAT_STATFS2_BSIZE], [1], | 199 | AC_DEFINE([STAT_STATFS2_BSIZE], [1], |
197 | [ Define if statfs takes 2 args and struct statfs has a field named f_bsize. | 200 | [Define if statfs takes 2 args and struct statfs has a field named f_bsize. |
198 | (4.3BSD, SunOS 4, HP-UX, AIX PS/2)]) | 201 | (4.3BSD, SunOS 4, HP-UX)]) |
202 | fi | ||
199 | fi | 203 | fi |
200 | fi | ||
201 | 204 | ||
202 | if test $ac_fsusage_space = no; then | 205 | if test $ac_fsusage_space = no; then |
203 | # SVR3 | 206 | # SVR3 |
204 | # (Solaris already handled above.) | 207 | # (Solaris already handled above.) |
205 | AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) | 208 | AC_CACHE_CHECK([for four-argument statfs (SVR3)], |
206 | AC_CACHE_VAL([fu_cv_sys_stat_statfs4], | 209 | [fu_cv_sys_stat_statfs4], |
207 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 210 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
208 | #include <sys/types.h> | 211 | #include <sys/types.h> |
209 | #include <sys/statfs.h> | 212 | #include <sys/statfs.h> |
210 | int | 213 | int |
211 | main () | 214 | main () |
212 | { | 215 | { |
213 | struct statfs fsd; | 216 | struct statfs fsd; |
214 | return statfs (".", &fsd, sizeof fsd, 0) != 0; | 217 | return statfs (".", &fsd, sizeof fsd, 0) != 0; |
215 | }]])], | ||
216 | [fu_cv_sys_stat_statfs4=yes], | ||
217 | [fu_cv_sys_stat_statfs4=no], | ||
218 | [fu_cv_sys_stat_statfs4=no])]) | ||
219 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs4]) | ||
220 | if test $fu_cv_sys_stat_statfs4 = yes; then | ||
221 | ac_fsusage_space=yes | ||
222 | AC_DEFINE([STAT_STATFS4], [1], | ||
223 | [ Define if statfs takes 4 args. (SVR3, Dynix, old Irix, old AIX, Dolphin)]) | ||
224 | fi | ||
225 | fi | ||
226 | |||
227 | if test $ac_fsusage_space = no; then | ||
228 | # 4.4BSD and older NetBSD | ||
229 | # (OSF/1 already handled above.) | ||
230 | # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) | ||
231 | # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in | ||
232 | # <sys/mount.h>.) | ||
233 | AC_MSG_CHECKING([for two-argument statfs with statfs.f_fsize dnl | ||
234 | member (4.4BSD and NetBSD)]) | ||
235 | AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize], | ||
236 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
237 | #include <sys/types.h> | ||
238 | #ifdef HAVE_SYS_PARAM_H | ||
239 | #include <sys/param.h> | ||
240 | #endif | ||
241 | #ifdef HAVE_SYS_MOUNT_H | ||
242 | #include <sys/mount.h> | ||
243 | #endif | ||
244 | int | ||
245 | main () | ||
246 | { | ||
247 | struct statfs fsd; | ||
248 | fsd.f_fsize = 0; | ||
249 | return statfs (".", &fsd) != 0; | ||
250 | }]])], | 218 | }]])], |
251 | [fu_cv_sys_stat_statfs2_fsize=yes], | 219 | [fu_cv_sys_stat_statfs4=yes], |
252 | [fu_cv_sys_stat_statfs2_fsize=no], | 220 | [fu_cv_sys_stat_statfs4=no], |
253 | [fu_cv_sys_stat_statfs2_fsize=no])]) | 221 | [fu_cv_sys_stat_statfs4=no]) |
254 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize]) | 222 | ]) |
255 | if test $fu_cv_sys_stat_statfs2_fsize = yes; then | 223 | if test $fu_cv_sys_stat_statfs4 = yes; then |
256 | ac_fsusage_space=yes | 224 | ac_fsusage_space=yes |
257 | AC_DEFINE([STAT_STATFS2_FSIZE], [1], | 225 | AC_DEFINE([STAT_STATFS4], [1], |
258 | [ Define if statfs takes 2 args and struct statfs has a field named f_fsize. | 226 | [Define if statfs takes 4 args. (SVR3, old Irix)]) |
259 | (4.4BSD, NetBSD)]) | 227 | fi |
260 | fi | 228 | fi |
261 | fi | ||
262 | 229 | ||
263 | if test $ac_fsusage_space = no; then | 230 | if test $ac_fsusage_space = no; then |
264 | # Ultrix | 231 | # 4.4BSD and older NetBSD |
265 | AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) | 232 | # (OSF/1 already handled above.) |
266 | AC_CACHE_VAL([fu_cv_sys_stat_fs_data], | 233 | # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) |
267 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 234 | # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in |
235 | # <sys/mount.h>.) | ||
236 | AC_CACHE_CHECK([for two-argument statfs with statfs.f_fsize member (4.4BSD and NetBSD)], | ||
237 | [fu_cv_sys_stat_statfs2_fsize], | ||
238 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
268 | #include <sys/types.h> | 239 | #include <sys/types.h> |
269 | #ifdef HAVE_SYS_PARAM_H | 240 | #ifdef HAVE_SYS_PARAM_H |
270 | #include <sys/param.h> | 241 | #include <sys/param.h> |
@@ -272,41 +243,26 @@ if test $ac_fsusage_space = no; then | |||
272 | #ifdef HAVE_SYS_MOUNT_H | 243 | #ifdef HAVE_SYS_MOUNT_H |
273 | #include <sys/mount.h> | 244 | #include <sys/mount.h> |
274 | #endif | 245 | #endif |
275 | #ifdef HAVE_SYS_FS_TYPES_H | ||
276 | #include <sys/fs_types.h> | ||
277 | #endif | ||
278 | int | 246 | int |
279 | main () | 247 | main () |
280 | { | 248 | { |
281 | struct fs_data fsd; | 249 | struct statfs fsd; |
282 | /* Ultrix's statfs returns 1 for success, | 250 | fsd.f_fsize = 0; |
283 | 0 for not mounted, -1 for failure. */ | 251 | return statfs (".", &fsd) != 0; |
284 | return statfs (".", &fsd) != 1; | ||
285 | }]])], | 252 | }]])], |
286 | [fu_cv_sys_stat_fs_data=yes], | 253 | [fu_cv_sys_stat_statfs2_fsize=yes], |
287 | [fu_cv_sys_stat_fs_data=no], | 254 | [fu_cv_sys_stat_statfs2_fsize=no], |
288 | [fu_cv_sys_stat_fs_data=no])]) | 255 | [fu_cv_sys_stat_statfs2_fsize=no]) |
289 | AC_MSG_RESULT([$fu_cv_sys_stat_fs_data]) | 256 | ]) |
290 | if test $fu_cv_sys_stat_fs_data = yes; then | 257 | if test $fu_cv_sys_stat_statfs2_fsize = yes; then |
291 | ac_fsusage_space=yes | 258 | ac_fsusage_space=yes |
292 | AC_DEFINE([STAT_STATFS2_FS_DATA], [1], | 259 | AC_DEFINE([STAT_STATFS2_FSIZE], [1], |
293 | [ Define if statfs takes 2 args and the second argument has | 260 | [Define if statfs takes 2 args and struct statfs has a field named f_fsize. |
294 | type struct fs_data. (Ultrix)]) | 261 | (4.4BSD, NetBSD)]) |
262 | fi | ||
295 | fi | 263 | fi |
296 | fi | ||
297 | 264 | ||
298 | if test $ac_fsusage_space = no; then | 265 | AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) |
299 | # SVR2 | ||
300 | # (AIX, HP-UX, OSF/1 already handled above.) | ||
301 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h> | ||
302 | ]])], | ||
303 | [AC_DEFINE([STAT_READ_FILSYS], [1], | ||
304 | [Define if there is no specific function for reading file systems usage | ||
305 | information and you have the <sys/filsys.h> header file. (SVR2)]) | ||
306 | ac_fsusage_space=yes]) | ||
307 | fi | ||
308 | |||
309 | AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) | ||
310 | 266 | ||
311 | ]) | 267 | ]) |
312 | 268 | ||
@@ -316,18 +272,22 @@ AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) | |||
316 | # enable the work-around code in fsusage.c. | 272 | # enable the work-around code in fsusage.c. |
317 | AC_DEFUN([gl_STATFS_TRUNCATES], | 273 | AC_DEFUN([gl_STATFS_TRUNCATES], |
318 | [ | 274 | [ |
319 | AC_MSG_CHECKING([for statfs that truncates block counts]) | 275 | AC_CACHE_CHECK([for statfs that truncates block counts], |
320 | AC_CACHE_VAL([fu_cv_sys_truncating_statfs], | 276 | [fu_cv_sys_truncating_statfs], |
321 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 277 | [AC_COMPILE_IFELSE( |
278 | [AC_LANG_PROGRAM([[ | ||
322 | #if !defined(sun) && !defined(__sun) | 279 | #if !defined(sun) && !defined(__sun) |
323 | choke -- this is a workaround for a Sun-specific problem | 280 | choke -- this is a workaround for a Sun-specific problem |
324 | #endif | 281 | #endif |
325 | #include <sys/types.h> | 282 | #include <sys/types.h> |
326 | #include <sys/vfs.h>]], | 283 | #include <sys/vfs.h> |
327 | [[struct statfs t; long c = *(t.f_spare); | 284 | ]], |
328 | if (c) return 0;]])], | 285 | [[struct statfs t; long c = *(t.f_spare); |
329 | [fu_cv_sys_truncating_statfs=yes], | 286 | if (c) return 0; |
330 | [fu_cv_sys_truncating_statfs=no])]) | 287 | ]])], |
288 | [fu_cv_sys_truncating_statfs=yes], | ||
289 | [fu_cv_sys_truncating_statfs=no]) | ||
290 | ]) | ||
331 | if test $fu_cv_sys_truncating_statfs = yes; then | 291 | if test $fu_cv_sys_truncating_statfs = yes; then |
332 | AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1], | 292 | AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1], |
333 | [Define if the block counts reported by statfs may be truncated to 2GB | 293 | [Define if the block counts reported by statfs may be truncated to 2GB |
@@ -335,13 +295,12 @@ choke -- this is a workaround for a Sun-specific problem | |||
335 | (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. | 295 | (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. |
336 | SunOS 4.1.1 seems not to be affected.)]) | 296 | SunOS 4.1.1 seems not to be affected.)]) |
337 | fi | 297 | fi |
338 | AC_MSG_RESULT([$fu_cv_sys_truncating_statfs]) | ||
339 | ]) | 298 | ]) |
340 | 299 | ||
341 | 300 | ||
342 | # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. | 301 | # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. |
343 | AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], | 302 | AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], |
344 | [ | 303 | [ |
345 | AC_CHECK_HEADERS([dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h]) | 304 | AC_CHECK_HEADERS([sys/fs/s5param.h sys/statfs.h]) |
346 | gl_STATFS_TRUNCATES | 305 | gl_STATFS_TRUNCATES |
347 | ]) | 306 | ]) |
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4 new file mode 100644 index 0000000..79f1aaf --- /dev/null +++ b/gl/m4/ftell.m4 | |||
@@ -0,0 +1,15 @@ | |||
1 | # ftell.m4 serial 3 | ||
2 | dnl Copyright (C) 2007, 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_FUNC_FTELL], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
10 | AC_REQUIRE([gl_FUNC_FTELLO]) | ||
11 | dnl When ftello needs fixes, ftell needs them too. | ||
12 | if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then | ||
13 | REPLACE_FTELL=1 | ||
14 | fi | ||
15 | ]) | ||
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4 new file mode 100644 index 0000000..4901b16 --- /dev/null +++ b/gl/m4/ftello.m4 | |||
@@ -0,0 +1,151 @@ | |||
1 | # ftello.m4 serial 14 | ||
2 | dnl Copyright (C) 2007-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_FUNC_FTELLO], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
10 | AC_REQUIRE([AC_PROG_CC]) | ||
11 | AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) | ||
12 | AC_REQUIRE([gl_SYS_TYPES_H]) | ||
13 | |||
14 | dnl Persuade glibc <stdio.h> to declare ftello(). | ||
15 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
16 | |||
17 | AC_CHECK_DECLS_ONCE([ftello]) | ||
18 | if test $ac_cv_have_decl_ftello = no; then | ||
19 | HAVE_DECL_FTELLO=0 | ||
20 | fi | ||
21 | |||
22 | AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello], | ||
23 | [ | ||
24 | AC_LINK_IFELSE( | ||
25 | [AC_LANG_PROGRAM( | ||
26 | [[#include <stdio.h>]], | ||
27 | [[ftello (stdin);]])], | ||
28 | [gl_cv_func_ftello=yes], | ||
29 | [gl_cv_func_ftello=no]) | ||
30 | ]) | ||
31 | if test $gl_cv_func_ftello = no; then | ||
32 | HAVE_FTELLO=0 | ||
33 | else | ||
34 | if test $WINDOWS_64_BIT_OFF_T = 1; then | ||
35 | REPLACE_FTELLO=1 | ||
36 | fi | ||
37 | if test $gl_cv_var_stdin_large_offset = no; then | ||
38 | REPLACE_FTELLO=1 | ||
39 | fi | ||
40 | if test $REPLACE_FTELLO = 0; then | ||
41 | dnl Detect bug on Solaris. | ||
42 | 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 | ||
44 | 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. | ||
46 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
47 | AC_CACHE_CHECK([whether ftello works], | ||
48 | [gl_cv_func_ftello_works], | ||
49 | [ | ||
50 | dnl Initial guess, used when cross-compiling or when /dev/tty cannot | ||
51 | dnl be opened. | ||
52 | changequote(,)dnl | ||
53 | case "$host_os" in | ||
54 | # Guess no on Solaris. | ||
55 | solaris*) gl_cv_func_ftello_works="guessing no" ;; | ||
56 | # Guess yes on native Windows. | ||
57 | mingw*) gl_cv_func_ftello_works="guessing yes" ;; | ||
58 | # Guess yes otherwise. | ||
59 | *) gl_cv_func_ftello_works="guessing yes" ;; | ||
60 | esac | ||
61 | changequote([,])dnl | ||
62 | AC_RUN_IFELSE( | ||
63 | [AC_LANG_SOURCE([[ | ||
64 | #include <stdio.h> | ||
65 | #include <stdlib.h> | ||
66 | #include <string.h> | ||
67 | #define TESTFILE "conftest.tmp" | ||
68 | int | ||
69 | main (void) | ||
70 | { | ||
71 | FILE *fp; | ||
72 | |||
73 | /* Create a file with some contents. */ | ||
74 | fp = fopen (TESTFILE, "w"); | ||
75 | if (fp == NULL) | ||
76 | return 70; | ||
77 | if (fwrite ("foogarsh", 1, 8, fp) < 8) | ||
78 | { fclose (fp); return 71; } | ||
79 | if (fclose (fp)) | ||
80 | return 72; | ||
81 | |||
82 | /* The file's contents is now "foogarsh". */ | ||
83 | |||
84 | /* Try writing after reading to EOF. */ | ||
85 | fp = fopen (TESTFILE, "r+"); | ||
86 | if (fp == NULL) | ||
87 | return 73; | ||
88 | if (fseek (fp, -1, SEEK_END)) | ||
89 | { fclose (fp); return 74; } | ||
90 | if (!(getc (fp) == 'h')) | ||
91 | { fclose (fp); return 1; } | ||
92 | if (!(getc (fp) == EOF)) | ||
93 | { fclose (fp); return 2; } | ||
94 | if (!(ftell (fp) == 8)) | ||
95 | { fclose (fp); return 3; } | ||
96 | if (!(ftell (fp) == 8)) | ||
97 | { fclose (fp); return 4; } | ||
98 | if (!(putc ('!', fp) == '!')) | ||
99 | { fclose (fp); return 5; } | ||
100 | if (!(ftell (fp) == 9)) | ||
101 | { fclose (fp); return 6; } | ||
102 | if (!(fclose (fp) == 0)) | ||
103 | return 7; | ||
104 | fp = fopen (TESTFILE, "r"); | ||
105 | if (fp == NULL) | ||
106 | return 75; | ||
107 | { | ||
108 | char buf[10]; | ||
109 | if (!(fread (buf, 1, 10, fp) == 9)) | ||
110 | { fclose (fp); return 10; } | ||
111 | if (!(memcmp (buf, "foogarsh!", 9) == 0)) | ||
112 | { fclose (fp); return 11; } | ||
113 | } | ||
114 | if (!(fclose (fp) == 0)) | ||
115 | return 12; | ||
116 | |||
117 | /* The file's contents is now "foogarsh!". */ | ||
118 | |||
119 | return 0; | ||
120 | }]])], | ||
121 | [gl_cv_func_ftello_works=yes], | ||
122 | [gl_cv_func_ftello_works=no], [:]) | ||
123 | ]) | ||
124 | case "$gl_cv_func_ftello_works" in | ||
125 | *yes) ;; | ||
126 | *) | ||
127 | REPLACE_FTELLO=1 | ||
128 | AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1], | ||
129 | [Define to 1 if the system's ftello function has the Solaris bug.]) | ||
130 | ;; | ||
131 | esac | ||
132 | fi | ||
133 | if test $REPLACE_FTELLO = 0; then | ||
134 | dnl Detect bug on macOS >= 10.15. | ||
135 | gl_FUNC_UNGETC_WORKS | ||
136 | if test $gl_ftello_broken_after_ungetc = yes; then | ||
137 | REPLACE_FTELLO=1 | ||
138 | AC_DEFINE([FTELLO_BROKEN_AFTER_UNGETC], [1], | ||
139 | [Define to 1 if the system's ftello function has the macOS bug.]) | ||
140 | fi | ||
141 | fi | ||
142 | fi | ||
143 | ]) | ||
144 | |||
145 | # Prerequisites of lib/ftello.c. | ||
146 | AC_DEFUN([gl_PREREQ_FTELLO], | ||
147 | [ | ||
148 | dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 | ||
149 | dnl makes it usable again. | ||
150 | AC_CHECK_FUNCS([_ftelli64]) | ||
151 | ]) | ||
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 1d631f8..15f09ff 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 | |||
@@ -1,14 +1,13 @@ | |||
1 | # getaddrinfo.m4 serial 30 | 1 | # getaddrinfo.m4 serial 34 |
2 | dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_GETADDRINFO], | 7 | AC_DEFUN([gl_GETADDRINFO], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 9 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
10 | AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H | 10 | AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H |
11 | AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) | ||
12 | GETADDRINFO_LIB= | 11 | GETADDRINFO_LIB= |
13 | gai_saved_LIBS="$LIBS" | 12 | gai_saved_LIBS="$LIBS" |
14 | 13 | ||
@@ -55,10 +54,40 @@ AC_DEFUN([gl_GETADDRINFO], | |||
55 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then | 54 | if test "$gl_cv_w32_getaddrinfo" = "yes"; then |
56 | GETADDRINFO_LIB="-lws2_32" | 55 | GETADDRINFO_LIB="-lws2_32" |
57 | LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" | 56 | LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" |
57 | dnl Check for correct signature, in particular for a cdecl-compatible | ||
58 | dnl calling convention. | ||
59 | AC_CACHE_CHECK([for getaddrinfo with POSIX signature], | ||
60 | [gl_cv_func_getaddrinfo_posix_signature], | ||
61 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | ||
62 | #include <sys/types.h> | ||
63 | #ifdef HAVE_SYS_SOCKET_H | ||
64 | #include <sys/socket.h> | ||
65 | #endif | ||
66 | #ifdef HAVE_NETDB_H | ||
67 | #include <netdb.h> | ||
68 | #endif | ||
69 | #ifdef HAVE_WS2TCPIP_H | ||
70 | #include <ws2tcpip.h> | ||
71 | #endif | ||
72 | #include <stddef.h> | ||
73 | extern | ||
74 | #ifdef __cplusplus | ||
75 | "C" | ||
76 | #endif | ||
77 | int getaddrinfo (const char *, const char *, const struct addrinfo *, struct addrinfo **); | ||
78 | ]])], | ||
79 | [gl_cv_func_getaddrinfo_posix_signature=yes], | ||
80 | [gl_cv_func_getaddrinfo_posix_signature=no]) | ||
81 | ]) | ||
82 | if test $gl_cv_func_getaddrinfo_posix_signature = no; then | ||
83 | REPLACE_GETADDRINFO=1 | ||
84 | fi | ||
58 | else | 85 | else |
59 | HAVE_GETADDRINFO=0 | 86 | HAVE_GETADDRINFO=0 |
60 | fi | 87 | fi |
61 | fi | 88 | fi |
89 | AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], | ||
90 | [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) | ||
62 | 91 | ||
63 | # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an | 92 | # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an |
64 | # inline function declared in ws2tcpip.h, so we need to get that | 93 | # inline function declared in ws2tcpip.h, so we need to get that |
@@ -127,13 +156,13 @@ const char *gai_strerror(int);]])], | |||
127 | # Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. | 156 | # Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. |
128 | AC_DEFUN([gl_PREREQ_GETADDRINFO], [ | 157 | AC_DEFUN([gl_PREREQ_GETADDRINFO], [ |
129 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) | 158 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) |
130 | AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 159 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
131 | AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB | 160 | AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB |
132 | AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB | 161 | AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB |
133 | AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB | 162 | AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB |
134 | AC_REQUIRE([AC_C_RESTRICT]) | 163 | AC_REQUIRE([AC_C_RESTRICT]) |
135 | AC_REQUIRE([gl_SOCKET_FAMILIES]) | 164 | AC_REQUIRE([gl_SOCKET_FAMILIES]) |
136 | AC_REQUIRE([gl_HEADER_SYS_SOCKET]) | 165 | AC_REQUIRE([gl_SYS_SOCKET_H]) |
137 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 166 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
138 | 167 | ||
139 | dnl Including sys/socket.h is wrong for Windows, but Windows does not | 168 | dnl Including sys/socket.h is wrong for Windows, but Windows does not |
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 new file mode 100644 index 0000000..9aaed20 --- /dev/null +++ b/gl/m4/getdelim.m4 | |||
@@ -0,0 +1,111 @@ | |||
1 | # getdelim.m4 serial 16 | ||
2 | |||
3 | dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. | ||
4 | dnl | ||
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 | |||
9 | AC_PREREQ([2.59]) | ||
10 | |||
11 | AC_DEFUN([gl_FUNC_GETDELIM], | ||
12 | [ | ||
13 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
14 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
15 | |||
16 | dnl Persuade glibc <stdio.h> to declare getdelim(). | ||
17 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
18 | |||
19 | AC_CHECK_DECLS_ONCE([getdelim]) | ||
20 | |||
21 | AC_CHECK_FUNCS_ONCE([getdelim]) | ||
22 | if test $ac_cv_func_getdelim = yes; then | ||
23 | HAVE_GETDELIM=1 | ||
24 | dnl Found it in some library. Verify that it works. | ||
25 | AC_CACHE_CHECK([for working getdelim function], | ||
26 | [gl_cv_func_working_getdelim], | ||
27 | [case "$host_os" in | ||
28 | darwin*) | ||
29 | dnl On macOS 10.13, valgrind detected an out-of-bounds read during | ||
30 | dnl the GNU sed test suite: | ||
31 | dnl Invalid read of size 16 | ||
32 | dnl at 0x100EE6A05: _platform_memchr$VARIANT$Base (in /usr/lib/system/libsystem_platform.dylib) | ||
33 | dnl by 0x100B7B0BD: getdelim (in /usr/lib/system/libsystem_c.dylib) | ||
34 | dnl by 0x10000B0BE: ck_getdelim (utils.c:254) | ||
35 | gl_cv_func_working_getdelim=no ;; | ||
36 | *) | ||
37 | echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data | ||
38 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
39 | # include <stdio.h> | ||
40 | # include <stdlib.h> | ||
41 | # include <string.h> | ||
42 | int main () | ||
43 | { | ||
44 | FILE *in = fopen ("./conftest.data", "r"); | ||
45 | if (!in) | ||
46 | return 1; | ||
47 | { | ||
48 | /* Test result for a NULL buffer and a zero size. | ||
49 | Based on a test program from Karl Heuer. */ | ||
50 | char *line = NULL; | ||
51 | size_t siz = 0; | ||
52 | int len = getdelim (&line, &siz, '\n', in); | ||
53 | if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) | ||
54 | { free (line); fclose (in); return 2; } | ||
55 | free (line); | ||
56 | } | ||
57 | { | ||
58 | /* Test result for a NULL buffer and a non-zero size. | ||
59 | This crashes on FreeBSD 8.0. */ | ||
60 | char *line = NULL; | ||
61 | size_t siz = (size_t)(~0) / 4; | ||
62 | if (getdelim (&line, &siz, '\n', in) == -1) | ||
63 | { fclose (in); return 3; } | ||
64 | free (line); | ||
65 | } | ||
66 | fclose (in); | ||
67 | return 0; | ||
68 | } | ||
69 | ]])], | ||
70 | [gl_cv_func_working_getdelim=yes], | ||
71 | [gl_cv_func_working_getdelim=no], | ||
72 | [dnl We're cross compiling. | ||
73 | dnl Guess it works on glibc2 systems and musl systems. | ||
74 | AC_EGREP_CPP([Lucky GNU user], | ||
75 | [ | ||
76 | #include <features.h> | ||
77 | #ifdef __GNU_LIBRARY__ | ||
78 | #if (__GLIBC__ >= 2) && !defined __UCLIBC__ | ||
79 | Lucky GNU user | ||
80 | #endif | ||
81 | #endif | ||
82 | ], | ||
83 | [gl_cv_func_working_getdelim="guessing yes"], | ||
84 | [case "$host_os" in | ||
85 | *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; | ||
86 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; | ||
87 | esac | ||
88 | ]) | ||
89 | ]) | ||
90 | ;; | ||
91 | esac | ||
92 | ]) | ||
93 | case "$gl_cv_func_working_getdelim" in | ||
94 | *yes) ;; | ||
95 | *) REPLACE_GETDELIM=1 ;; | ||
96 | esac | ||
97 | else | ||
98 | HAVE_GETDELIM=0 | ||
99 | fi | ||
100 | |||
101 | if test $ac_cv_have_decl_getdelim = no; then | ||
102 | HAVE_DECL_GETDELIM=0 | ||
103 | fi | ||
104 | ]) | ||
105 | |||
106 | # Prerequisites of lib/getdelim.c. | ||
107 | AC_DEFUN([gl_PREREQ_GETDELIM], | ||
108 | [ | ||
109 | AC_CHECK_FUNCS([flockfile funlockfile]) | ||
110 | AC_CHECK_DECLS([getc_unlocked]) | ||
111 | ]) | ||
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4 new file mode 100644 index 0000000..8bcda90 --- /dev/null +++ b/gl/m4/getdtablesize.m4 | |||
@@ -0,0 +1,63 @@ | |||
1 | # getdtablesize.m4 serial 8 | ||
2 | dnl Copyright (C) 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 | AC_DEFUN([gl_FUNC_GETDTABLESIZE], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
10 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
11 | AC_CHECK_FUNCS_ONCE([getdtablesize]) | ||
12 | AC_CHECK_DECLS_ONCE([getdtablesize]) | ||
13 | if test $ac_cv_func_getdtablesize = yes && | ||
14 | test $ac_cv_have_decl_getdtablesize = yes; then | ||
15 | AC_CACHE_CHECK([whether getdtablesize works], | ||
16 | [gl_cv_func_getdtablesize_works], | ||
17 | [dnl There are two concepts: the "maximum possible file descriptor value + 1" | ||
18 | dnl and the "maximum number of open file descriptors in a process". | ||
19 | dnl Per SUSv2 and POSIX, getdtablesize() should return the first one. | ||
20 | dnl On most platforms, the first and the second concept are the same. | ||
21 | dnl On OpenVMS, however, they are different and getdtablesize() returns | ||
22 | dnl the second one; thus the test below fails. But we don't care | ||
23 | dnl because there's no good way to write a replacement getdtablesize(). | ||
24 | case "$host_os" in | ||
25 | vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; | ||
26 | *) | ||
27 | dnl Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft | ||
28 | dnl limit up to an unchangeable hard limit; all other platforms | ||
29 | dnl correctly require setrlimit before getdtablesize() can report | ||
30 | dnl a larger value. | ||
31 | AC_RUN_IFELSE([ | ||
32 | AC_LANG_PROGRAM( | ||
33 | [[#include <unistd.h>] | ||
34 | GL_MDA_DEFINES | ||
35 | ], | ||
36 | [[int size = getdtablesize(); | ||
37 | if (dup2 (0, getdtablesize()) != -1) | ||
38 | return 1; | ||
39 | if (size != getdtablesize()) | ||
40 | return 2; | ||
41 | ]])], | ||
42 | [gl_cv_func_getdtablesize_works=yes], | ||
43 | [gl_cv_func_getdtablesize_works=no], | ||
44 | [case "$host_os" in | ||
45 | cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows | ||
46 | gl_cv_func_getdtablesize_works="guessing no" ;; | ||
47 | *) gl_cv_func_getdtablesize_works="guessing yes" ;; | ||
48 | esac | ||
49 | ]) | ||
50 | ;; | ||
51 | esac | ||
52 | ]) | ||
53 | case "$gl_cv_func_getdtablesize_works" in | ||
54 | *yes | "no (limitation)") ;; | ||
55 | *) REPLACE_GETDTABLESIZE=1 ;; | ||
56 | esac | ||
57 | else | ||
58 | HAVE_GETDTABLESIZE=0 | ||
59 | fi | ||
60 | ]) | ||
61 | |||
62 | # Prerequisites of lib/getdtablesize.c. | ||
63 | AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:]) | ||
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index 7413f9e..63f5f63 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # gethostname.m4 serial 13 | 1 | # gethostname.m4 serial 15 |
2 | dnl Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -48,7 +48,7 @@ AC_DEFUN([gl_PREREQ_HOST_NAME_MAX], [ | |||
48 | dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead. | 48 | dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead. |
49 | dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead. | 49 | dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead. |
50 | dnl - On mingw, use 256, because | 50 | dnl - On mingw, use 256, because |
51 | dnl <http://msdn.microsoft.com/en-us/library/ms738527.aspx> says: | 51 | dnl <https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-gethostname> says: |
52 | dnl "if a buffer of 256 bytes is passed in the name parameter and | 52 | dnl "if a buffer of 256 bytes is passed in the name parameter and |
53 | dnl the namelen parameter is set to 256, the buffer size will always | 53 | dnl the namelen parameter is set to 256, the buffer size will always |
54 | dnl be adequate." | 54 | dnl be adequate." |
@@ -74,7 +74,7 @@ lucky | |||
74 | dnl mingw. | 74 | dnl mingw. |
75 | gl_cv_decl_HOST_NAME_MAX=256 | 75 | gl_cv_decl_HOST_NAME_MAX=256 |
76 | else | 76 | else |
77 | _AC_COMPUTE_INT([MAXHOSTNAMELEN], [gl_cv_decl_HOST_NAME_MAX], [ | 77 | AC_COMPUTE_INT([gl_cv_decl_HOST_NAME_MAX], [MAXHOSTNAMELEN], [ |
78 | #include <sys/types.h> | 78 | #include <sys/types.h> |
79 | #if HAVE_SYS_PARAM_H | 79 | #if HAVE_SYS_PARAM_H |
80 | # include <sys/param.h> | 80 | # include <sys/param.h> |
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 new file mode 100644 index 0000000..03569f0 --- /dev/null +++ b/gl/m4/getline.m4 | |||
@@ -0,0 +1,109 @@ | |||
1 | # getline.m4 serial 30 | ||
2 | |||
3 | dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, | ||
4 | dnl Inc. | ||
5 | dnl | ||
6 | dnl This file is free software; the Free Software Foundation | ||
7 | dnl gives unlimited permission to copy and/or distribute it, | ||
8 | dnl with or without modifications, as long as this notice is preserved. | ||
9 | |||
10 | AC_PREREQ([2.59]) | ||
11 | |||
12 | dnl See if there's a working, system-supplied version of the getline function. | ||
13 | dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems | ||
14 | dnl have a function by that name in -linet that doesn't have anything | ||
15 | dnl to do with the function we need. | ||
16 | AC_DEFUN([gl_FUNC_GETLINE], | ||
17 | [ | ||
18 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
19 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
20 | |||
21 | dnl Persuade glibc <stdio.h> to declare getline(). | ||
22 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
23 | |||
24 | AC_CHECK_DECLS_ONCE([getline]) | ||
25 | |||
26 | gl_getline_needs_run_time_check=no | ||
27 | AC_CHECK_FUNC([getline], | ||
28 | [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], | ||
33 | [am_cv_func_working_getline], | ||
34 | [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data | ||
35 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
36 | # include <stdio.h> | ||
37 | # include <stdlib.h> | ||
38 | # include <string.h> | ||
39 | int main () | ||
40 | { | ||
41 | FILE *in = fopen ("./conftest.data", "r"); | ||
42 | if (!in) | ||
43 | return 1; | ||
44 | { | ||
45 | /* Test result for a NULL buffer and a zero size. | ||
46 | Based on a test program from Karl Heuer. */ | ||
47 | char *line = NULL; | ||
48 | size_t siz = 0; | ||
49 | int len = getline (&line, &siz, in); | ||
50 | if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) | ||
51 | { free (line); fclose (in); return 2; } | ||
52 | free (line); | ||
53 | } | ||
54 | { | ||
55 | /* Test result for a NULL buffer and a non-zero size. | ||
56 | This crashes on FreeBSD 8.0. */ | ||
57 | char *line = NULL; | ||
58 | size_t siz = (size_t)(~0) / 4; | ||
59 | if (getline (&line, &siz, in) == -1) | ||
60 | { fclose (in); return 3; } | ||
61 | free (line); | ||
62 | } | ||
63 | fclose (in); | ||
64 | return 0; | ||
65 | } | ||
66 | ]])], | ||
67 | [am_cv_func_working_getline=yes], | ||
68 | [am_cv_func_working_getline=no], | ||
69 | [dnl We're cross compiling. | ||
70 | dnl Guess it works on glibc2 systems and musl systems. | ||
71 | AC_EGREP_CPP([Lucky GNU user], | ||
72 | [ | ||
73 | #include <features.h> | ||
74 | #ifdef __GNU_LIBRARY__ | ||
75 | #if (__GLIBC__ >= 2) && !defined __UCLIBC__ | ||
76 | Lucky GNU user | ||
77 | #endif | ||
78 | #endif | ||
79 | ], | ||
80 | [am_cv_func_working_getline="guessing yes"], | ||
81 | [case "$host_os" in | ||
82 | *-musl*) am_cv_func_working_getline="guessing yes" ;; | ||
83 | *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; | ||
84 | esac | ||
85 | ]) | ||
86 | ]) | ||
87 | ]) | ||
88 | fi | ||
89 | |||
90 | if test $ac_cv_have_decl_getline = no; then | ||
91 | HAVE_DECL_GETLINE=0 | ||
92 | fi | ||
93 | |||
94 | case "$am_cv_func_working_getline" in | ||
95 | *yes) ;; | ||
96 | *) | ||
97 | dnl Set REPLACE_GETLINE always: Even if we have not found the broken | ||
98 | dnl getline function among $LIBS, it may exist in libinet and the | ||
99 | dnl executable may be linked with -linet. | ||
100 | REPLACE_GETLINE=1 | ||
101 | ;; | ||
102 | esac | ||
103 | ]) | ||
104 | |||
105 | # Prerequisites of lib/getline.c. | ||
106 | AC_DEFUN([gl_PREREQ_GETLINE], | ||
107 | [ | ||
108 | : | ||
109 | ]) | ||
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 611372a..79e420b 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | # Check for getloadavg. | 1 | # Check for getloadavg. |
2 | 2 | ||
3 | # Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2013 Free Software | 3 | # Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2023 Free Software |
4 | # Foundation, Inc. | 4 | # Foundation, Inc. |
5 | 5 | ||
6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
8 | # with or without modifications, as long as this notice is preserved. | 8 | # with or without modifications, as long as this notice is preserved. |
9 | 9 | ||
10 | #serial 6 | 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. |
@@ -22,7 +22,7 @@ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | |||
22 | 22 | ||
23 | gl_save_LIBS=$LIBS | 23 | gl_save_LIBS=$LIBS |
24 | 24 | ||
25 | # getloadvg 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 | AC_CHECK_FUNC([getloadavg], [], |
@@ -45,7 +45,9 @@ AC_CHECK_FUNC([getloadavg], [], | |||
45 | # There is a commonly available library for RS/6000 AIX. | 45 | # There is a commonly available library for RS/6000 AIX. |
46 | # Since it is not a standard part of AIX, it might be installed locally. | 46 | # Since it is not a standard part of AIX, it might be installed locally. |
47 | gl_getloadavg_LIBS=$LIBS | 47 | gl_getloadavg_LIBS=$LIBS |
48 | LIBS="-L/usr/local/lib $LIBS" | 48 | if test $cross_compiling != yes; then |
49 | LIBS="-L/usr/local/lib $LIBS" | ||
50 | fi | ||
49 | AC_CHECK_LIB([getloadavg], [getloadavg], | 51 | AC_CHECK_LIB([getloadavg], [getloadavg], |
50 | [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes], | 52 | [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes], |
51 | [LIBS=$gl_getloadavg_LIBS]) | 53 | [LIBS=$gl_getloadavg_LIBS]) |
@@ -92,6 +94,9 @@ else | |||
92 | fi | 94 | fi |
93 | AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0], | 95 | AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0], |
94 | [[#if HAVE_SYS_LOADAVG_H | 96 | [[#if HAVE_SYS_LOADAVG_H |
97 | /* OpenIndiana has a bug: <sys/time.h> must be included before | ||
98 | <sys/loadavg.h>. */ | ||
99 | # include <sys/time.h> | ||
95 | # include <sys/loadavg.h> | 100 | # include <sys/loadavg.h> |
96 | #endif | 101 | #endif |
97 | #include <stdlib.h>]]) | 102 | #include <stdlib.h>]]) |
@@ -105,7 +110,7 @@ AC_DEFUN([gl_PREREQ_GETLOADAVG], | |||
105 | [ | 110 | [ |
106 | # Figure out what our getloadavg.c needs. | 111 | # Figure out what our getloadavg.c needs. |
107 | 112 | ||
108 | AC_CHECK_HEADERS_ONCE([sys/param.h]) | 113 | AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h]) |
109 | 114 | ||
110 | # On HPUX9, an unprivileged user can get load averages this way. | 115 | # On HPUX9, an unprivileged user can get load averages this way. |
111 | if test $gl_func_getloadavg_done = no; then | 116 | if test $gl_func_getloadavg_done = no; then |
@@ -142,7 +147,7 @@ fi | |||
142 | AC_CHECK_HEADERS([nlist.h], | 147 | AC_CHECK_HEADERS([nlist.h], |
143 | [AC_CHECK_MEMBERS([struct nlist.n_un.n_name], | 148 | [AC_CHECK_MEMBERS([struct nlist.n_un.n_name], |
144 | [], [], | 149 | [], [], |
145 | [@%:@include <nlist.h>]) | 150 | [#include <nlist.h>]) |
146 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]], | 151 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]], |
147 | [[struct nlist x; | 152 | [[struct nlist x; |
148 | #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME | 153 | #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME |
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4 index 50f4509..7981a09 100644 --- a/gl/m4/getopt.m4 +++ b/gl/m4/getopt.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # getopt.m4 serial 44 | 1 | # getopt.m4 serial 48 |
2 | dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -21,6 +21,8 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX], | |||
21 | REPLACE_GETOPT=1 | 21 | REPLACE_GETOPT=1 |
22 | fi | 22 | fi |
23 | ]) | 23 | ]) |
24 | GL_GENERATE_GETOPT_H=false | ||
25 | GL_GENERATE_GETOPT_CDEFS_H=false | ||
24 | if test $REPLACE_GETOPT = 1; then | 26 | if test $REPLACE_GETOPT = 1; then |
25 | dnl Arrange for getopt.h to be created. | 27 | dnl Arrange for getopt.h to be created. |
26 | gl_GETOPT_SUBSTITUTE_HEADER | 28 | gl_GETOPT_SUBSTITUTE_HEADER |
@@ -32,9 +34,16 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX], | |||
32 | # getopt_long_only. | 34 | # getopt_long_only. |
33 | AC_DEFUN([gl_FUNC_GETOPT_GNU], | 35 | AC_DEFUN([gl_FUNC_GETOPT_GNU], |
34 | [ | 36 | [ |
37 | dnl Set the variable gl_getopt_required, so that all invocations of | ||
38 | dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file | ||
39 | dnl will check for getopt with GNU extensions. | ||
40 | dnl This means that if one gnulib-tool invocation requests getopt-posix | ||
41 | dnl and another gnulib-tool invocation requests getopt-gnu, it is as if | ||
42 | dnl both had requested getopt-gnu. | ||
35 | m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) | 43 | m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) |
36 | 44 | ||
37 | AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) | 45 | dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically |
46 | dnl done through the module dependency getopt-gnu -> getopt-posix. | ||
38 | ]) | 47 | ]) |
39 | 48 | ||
40 | # Determine whether to replace the entire getopt facility. | 49 | # Determine whether to replace the entire getopt facility. |
@@ -295,8 +304,10 @@ dnl is ambiguous with environment values that contain newlines. | |||
295 | ]])], | 304 | ]])], |
296 | [gl_cv_func_getopt_gnu=yes], | 305 | [gl_cv_func_getopt_gnu=yes], |
297 | [gl_cv_func_getopt_gnu=no], | 306 | [gl_cv_func_getopt_gnu=no], |
298 | [dnl Cross compiling. Assume the worst, even on glibc platforms. | 307 | [dnl Cross compiling. |
299 | gl_cv_func_getopt_gnu="guessing no" | 308 | dnl Assume the worst, even on glibc platforms. |
309 | dnl But obey --enable-cross-guesses. | ||
310 | gl_cv_func_getopt_gnu="$gl_cross_guess_normal" | ||
300 | ]) | 311 | ]) |
301 | case $gl_had_POSIXLY_CORRECT in | 312 | case $gl_had_POSIXLY_CORRECT in |
302 | exported) ;; | 313 | exported) ;; |
@@ -354,15 +365,17 @@ dnl is ambiguous with environment values that contain newlines. | |||
354 | 365 | ||
355 | AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], | 366 | AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], |
356 | [ | 367 | [ |
357 | GETOPT_H=getopt.h | 368 | AC_CHECK_HEADERS_ONCE([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 | |||
358 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], | 376 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], |
359 | [Define to rpl_ if the getopt replacement functions and variables | 377 | [Define to rpl_ if the getopt replacement functions and variables |
360 | should be used.]) | 378 | should be used.]) |
361 | AC_SUBST([GETOPT_H]) | 379 | GL_GENERATE_GETOPT_H=true |
362 | ]) | 380 | GL_GENERATE_GETOPT_CDEFS_H=true |
363 | |||
364 | # Prerequisites of lib/getopt*. | ||
365 | AC_DEFUN([gl_PREREQ_GETOPT], | ||
366 | [ | ||
367 | AC_CHECK_DECLS_ONCE([getenv]) | ||
368 | ]) | 381 | ]) |
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4 new file mode 100644 index 0000000..b67c527 --- /dev/null +++ b/gl/m4/getprogname.m4 | |||
@@ -0,0 +1,43 @@ | |||
1 | # getprogname.m4 - check for getprogname or replacements for it | ||
2 | |||
3 | # Copyright (C) 2016-2023 Free Software Foundation, Inc. | ||
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 | AC_DEFUN([gl_FUNC_GETPROGNAME], | ||
11 | [ | ||
12 | AC_CHECK_FUNCS_ONCE([getprogname getexecname]) | ||
13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
14 | ac_found=0 | ||
15 | AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], | ||
16 | [#include <errno.h>]) | ||
17 | AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [], | ||
18 | [#include <errno.h>]) | ||
19 | AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include <stdlib.h>]) | ||
20 | |||
21 | # Incur the cost of this test only if none of the above worked. | ||
22 | if test $ac_found = 0; then | ||
23 | # On OpenBSD 5.1, using the global __progname variable appears to be | ||
24 | # the only way to implement getprogname. | ||
25 | AC_CACHE_CHECK([whether __progname is defined in default libraries], | ||
26 | [gl_cv_var___progname], | ||
27 | [ | ||
28 | gl_cv_var___progname= | ||
29 | AC_LINK_IFELSE( | ||
30 | [AC_LANG_PROGRAM( | ||
31 | [[extern char *__progname;]], | ||
32 | [[return *__progname;]] | ||
33 | )], | ||
34 | [gl_cv_var___progname=yes] | ||
35 | ) | ||
36 | ] | ||
37 | ) | ||
38 | if test "$gl_cv_var___progname" = yes; then | ||
39 | AC_DEFINE([HAVE_VAR___PROGNAME], 1, | ||
40 | [Define if you have a global __progname variable]) | ||
41 | fi | ||
42 | fi | ||
43 | ]) | ||
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4 index 8d1f066..a0eda3d 100644 --- a/gl/m4/gettext.m4 +++ b/gl/m4/gettext.m4 | |||
@@ -1,16 +1,16 @@ | |||
1 | # gettext.m4 serial 66 (gettext-0.18.2) | 1 | # gettext.m4 serial 71 (gettext-0.20.2) |
2 | dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl | 6 | dnl |
7 | dnl This file can can be used in projects which are not available under | 7 | dnl This file can be used in projects which are not available under |
8 | dnl the GNU General Public License or the GNU Library General Public | 8 | dnl the GNU General Public License or the GNU Lesser General Public |
9 | dnl License but which still want to provide support for the GNU gettext | 9 | dnl License but which still want to provide support for the GNU gettext |
10 | dnl functionality. | 10 | dnl functionality. |
11 | dnl Please note that the actual code of the GNU gettext library is covered | 11 | dnl Please note that the actual code of the GNU gettext library is covered |
12 | dnl by the GNU Library General Public License, and the rest of the GNU | 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU |
13 | dnl gettext package package is covered by the GNU General Public License. | 13 | dnl gettext package is covered by the GNU General Public License. |
14 | dnl They are *not* in the public domain. | 14 | dnl They are *not* in the public domain. |
15 | 15 | ||
16 | dnl Authors: | 16 | dnl Authors: |
@@ -20,15 +20,13 @@ dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010. | |||
20 | dnl Macro to add for using GNU gettext. | 20 | dnl Macro to add for using GNU gettext. |
21 | 21 | ||
22 | dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). | 22 | dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). |
23 | dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The | 23 | dnl INTLSYMBOL must be one of 'external', 'use-libtool'. |
24 | dnl default (if it is not specified or empty) is 'no-libtool'. | 24 | dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and |
25 | dnl INTLSYMBOL should be 'external' for packages with no intl directory, | 25 | dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'. |
26 | dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. | ||
27 | dnl If INTLSYMBOL is 'use-libtool', then a libtool library | 26 | dnl If INTLSYMBOL is 'use-libtool', then a libtool library |
28 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, | 27 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, |
29 | dnl depending on --{enable,disable}-{shared,static} and on the presence of | 28 | dnl depending on --{enable,disable}-{shared,static} and on the presence of |
30 | dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library | 29 | dnl AM-DISABLE-SHARED). |
31 | dnl $(top_builddir)/intl/libintl.a will be created. | ||
32 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext | 30 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext |
33 | dnl implementations (in libc or libintl) without the ngettext() function | 31 | dnl implementations (in libc or libintl) without the ngettext() function |
34 | dnl will be ignored. If NEEDSYMBOL is specified and is | 32 | dnl will be ignored. If NEEDSYMBOL is specified and is |
@@ -57,19 +55,17 @@ dnl | |||
57 | AC_DEFUN([AM_GNU_GETTEXT], | 55 | AC_DEFUN([AM_GNU_GETTEXT], |
58 | [ | 56 | [ |
59 | dnl Argument checking. | 57 | dnl Argument checking. |
60 | ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , | 58 | ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], , |
61 | [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT | 59 | [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT |
62 | ])])])])]) | 60 | ])])])]) |
63 | ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], | 61 | ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], |
64 | [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) | 62 | [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported. |
63 | ])]) | ||
65 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , | 64 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , |
66 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT | 65 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT |
67 | ])])])]) | 66 | ])])])]) |
68 | define([gt_included_intl], | 67 | define([gt_included_intl], |
69 | ifelse([$1], [external], | 68 | ifelse([$1], [external], [no], [yes])) |
70 | ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), | ||
71 | [yes])) | ||
72 | define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) | ||
73 | gt_NEEDS_INIT | 69 | gt_NEEDS_INIT |
74 | AM_GNU_GETTEXT_NEED([$2]) | 70 | AM_GNU_GETTEXT_NEED([$2]) |
75 | 71 | ||
@@ -91,8 +87,7 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
91 | dnl again, outside any 'if'. There are two solutions: | 87 | dnl again, outside any 'if'. There are two solutions: |
92 | dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. | 88 | dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. |
93 | dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. | 89 | dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. |
94 | dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not | 90 | dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it. |
95 | dnl documented, we avoid it. | ||
96 | ifelse(gt_included_intl, yes, , [ | 91 | ifelse(gt_included_intl, yes, , [ |
97 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | 92 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
98 | ]) | 93 | ]) |
@@ -161,13 +156,18 @@ changequote([,])dnl | |||
161 | [AC_LANG_PROGRAM( | 156 | [AC_LANG_PROGRAM( |
162 | [[ | 157 | [[ |
163 | #include <libintl.h> | 158 | #include <libintl.h> |
164 | $gt_revision_test_code | 159 | #ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
165 | extern int _nl_msg_cat_cntr; | 160 | extern int _nl_msg_cat_cntr; |
166 | extern int *_nl_domain_bindings; | 161 | extern int *_nl_domain_bindings; |
162 | #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) | ||
163 | #else | ||
164 | #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 | ||
165 | #endif | ||
166 | $gt_revision_test_code | ||
167 | ]], | 167 | ]], |
168 | [[ | 168 | [[ |
169 | bindtextdomain ("", ""); | 169 | bindtextdomain ("", ""); |
170 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings | 170 | return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION |
171 | ]])], | 171 | ]])], |
172 | [eval "$gt_func_gnugettext_libc=yes"], | 172 | [eval "$gt_func_gnugettext_libc=yes"], |
173 | [eval "$gt_func_gnugettext_libc=no"])]) | 173 | [eval "$gt_func_gnugettext_libc=no"])]) |
@@ -193,17 +193,22 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_b | |||
193 | [AC_LANG_PROGRAM( | 193 | [AC_LANG_PROGRAM( |
194 | [[ | 194 | [[ |
195 | #include <libintl.h> | 195 | #include <libintl.h> |
196 | $gt_revision_test_code | 196 | #ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
197 | extern int _nl_msg_cat_cntr; | 197 | extern int _nl_msg_cat_cntr; |
198 | extern | 198 | extern |
199 | #ifdef __cplusplus | 199 | #ifdef __cplusplus |
200 | "C" | 200 | "C" |
201 | #endif | 201 | #endif |
202 | const char *_nl_expand_alias (const char *); | 202 | const char *_nl_expand_alias (const char *); |
203 | #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) | ||
204 | #else | ||
205 | #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 | ||
206 | #endif | ||
207 | $gt_revision_test_code | ||
203 | ]], | 208 | ]], |
204 | [[ | 209 | [[ |
205 | bindtextdomain ("", ""); | 210 | bindtextdomain ("", ""); |
206 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") | 211 | return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION |
207 | ]])], | 212 | ]])], |
208 | [eval "$gt_func_gnugettext_libintl=yes"], | 213 | [eval "$gt_func_gnugettext_libintl=yes"], |
209 | [eval "$gt_func_gnugettext_libintl=no"]) | 214 | [eval "$gt_func_gnugettext_libintl=no"]) |
@@ -214,17 +219,22 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
214 | [AC_LANG_PROGRAM( | 219 | [AC_LANG_PROGRAM( |
215 | [[ | 220 | [[ |
216 | #include <libintl.h> | 221 | #include <libintl.h> |
217 | $gt_revision_test_code | 222 | #ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
218 | extern int _nl_msg_cat_cntr; | 223 | extern int _nl_msg_cat_cntr; |
219 | extern | 224 | extern |
220 | #ifdef __cplusplus | 225 | #ifdef __cplusplus |
221 | "C" | 226 | "C" |
222 | #endif | 227 | #endif |
223 | const char *_nl_expand_alias (const char *); | 228 | const char *_nl_expand_alias (const char *); |
229 | #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) | ||
230 | #else | ||
231 | #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 | ||
232 | #endif | ||
233 | $gt_revision_test_code | ||
224 | ]], | 234 | ]], |
225 | [[ | 235 | [[ |
226 | bindtextdomain ("", ""); | 236 | bindtextdomain ("", ""); |
227 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") | 237 | return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION |
228 | ]])], | 238 | ]])], |
229 | [LIBINTL="$LIBINTL $LIBICONV" | 239 | [LIBINTL="$LIBINTL $LIBICONV" |
230 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" | 240 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" |
@@ -263,8 +273,8 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
263 | dnl Mark actions used to generate GNU NLS library. | 273 | dnl Mark actions used to generate GNU NLS library. |
264 | BUILD_INCLUDED_LIBINTL=yes | 274 | BUILD_INCLUDED_LIBINTL=yes |
265 | USE_INCLUDED_LIBINTL=yes | 275 | USE_INCLUDED_LIBINTL=yes |
266 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" | 276 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" |
267 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" | 277 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD" |
268 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | 278 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` |
269 | fi | 279 | fi |
270 | 280 | ||
@@ -332,43 +342,14 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
332 | fi | 342 | fi |
333 | 343 | ||
334 | ifelse(gt_included_intl, yes, [ | 344 | ifelse(gt_included_intl, yes, [ |
335 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL | 345 | dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes' |
336 | dnl to 'yes' because some of the testsuite requires it. | 346 | dnl because some of the testsuite requires it. |
337 | if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then | 347 | BUILD_INCLUDED_LIBINTL=yes |
338 | BUILD_INCLUDED_LIBINTL=yes | ||
339 | fi | ||
340 | 348 | ||
341 | dnl Make all variables we use known to autoconf. | 349 | dnl Make all variables we use known to autoconf. |
342 | AC_SUBST([BUILD_INCLUDED_LIBINTL]) | 350 | AC_SUBST([BUILD_INCLUDED_LIBINTL]) |
343 | AC_SUBST([USE_INCLUDED_LIBINTL]) | 351 | AC_SUBST([USE_INCLUDED_LIBINTL]) |
344 | AC_SUBST([CATOBJEXT]) | 352 | AC_SUBST([CATOBJEXT]) |
345 | |||
346 | dnl For backward compatibility. Some configure.ins may be using this. | ||
347 | nls_cv_header_intl= | ||
348 | nls_cv_header_libgt= | ||
349 | |||
350 | dnl For backward compatibility. Some Makefiles may be using this. | ||
351 | DATADIRNAME=share | ||
352 | AC_SUBST([DATADIRNAME]) | ||
353 | |||
354 | dnl For backward compatibility. Some Makefiles may be using this. | ||
355 | INSTOBJEXT=.mo | ||
356 | AC_SUBST([INSTOBJEXT]) | ||
357 | |||
358 | dnl For backward compatibility. Some Makefiles may be using this. | ||
359 | GENCAT=gencat | ||
360 | AC_SUBST([GENCAT]) | ||
361 | |||
362 | dnl For backward compatibility. Some Makefiles may be using this. | ||
363 | INTLOBJS= | ||
364 | if test "$USE_INCLUDED_LIBINTL" = yes; then | ||
365 | INTLOBJS="\$(GETTOBJS)" | ||
366 | fi | ||
367 | AC_SUBST([INTLOBJS]) | ||
368 | |||
369 | dnl Enable libtool support if the surrounding package wishes it. | ||
370 | INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix | ||
371 | AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) | ||
372 | ]) | 353 | ]) |
373 | 354 | ||
374 | dnl For backward compatibility. Some Makefiles may be using this. | 355 | dnl For backward compatibility. Some Makefiles may be using this. |
@@ -399,3 +380,7 @@ AC_DEFUN([AM_GNU_GETTEXT_NEED], | |||
399 | 380 | ||
400 | dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) | 381 | dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) |
401 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) | 382 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) |
383 | |||
384 | |||
385 | dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version]) | ||
386 | AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], []) | ||
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4 new file mode 100644 index 0000000..7eab4e1 --- /dev/null +++ b/gl/m4/gl-openssl.m4 | |||
@@ -0,0 +1,76 @@ | |||
1 | # gl-openssl.m4 serial 6 | ||
2 | dnl Copyright (C) 2013-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_SET_CRYPTO_CHECK_DEFAULT], | ||
8 | [ | ||
9 | m4_define([gl_CRYPTO_CHECK_DEFAULT], [$1]) | ||
10 | ]) | ||
11 | gl_SET_CRYPTO_CHECK_DEFAULT([no]) | ||
12 | |||
13 | AC_DEFUN([gl_CRYPTO_CHECK], | ||
14 | [ | ||
15 | dnl gnulib users set this before gl_INIT with gl_SET_CRYPTO_CHECK_DEFAULT() | ||
16 | m4_divert_once([DEFAULTS], [with_openssl_default='gl_CRYPTO_CHECK_DEFAULT']) | ||
17 | |||
18 | dnl Only clear once, so crypto routines can be checked for individually | ||
19 | m4_divert_once([DEFAULTS], [LIB_CRYPTO=]) | ||
20 | |||
21 | AC_ARG_WITH([openssl], | ||
22 | [[ --with-openssl[=ARG] use libcrypto hash routines for the hash functions | ||
23 | MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512. | ||
24 | Valid ARGs are: | ||
25 | 'yes', | ||
26 | 'no', | ||
27 | 'auto' => use if any version available, | ||
28 | 'auto-gpl-compat' => use if GPL compatible version | ||
29 | available, | ||
30 | 'optional' => use if available | ||
31 | and warn if not available; | ||
32 | Default is ']gl_CRYPTO_CHECK_DEFAULT['.]m4_ifdef([gl_AF_ALG], [ | ||
33 | Note also --with-linux-crypto, which will enable the | ||
34 | use of Linux kernel crypto routines (if available), | ||
35 | which has precedence for files.])], | ||
36 | [], | ||
37 | [with_openssl=$with_openssl_default]) | ||
38 | |||
39 | AC_SUBST([LIB_CRYPTO]) | ||
40 | if test "x$with_openssl" != xno; then | ||
41 | if test "x$with_openssl" = xauto-gpl-compat; then | ||
42 | AC_CACHE_CHECK([whether openssl is GPL compatible], | ||
43 | [gl_cv_openssl_gpl_compat], | ||
44 | [AC_COMPILE_IFELSE( | ||
45 | [AC_LANG_PROGRAM([[ | ||
46 | #include <openssl/opensslv.h> | ||
47 | #if OPENSSL_VERSION_MAJOR < 3 | ||
48 | #error "openssl >= version 3 not found" | ||
49 | #endif | ||
50 | ]])], | ||
51 | [gl_cv_openssl_gpl_compat=yes], | ||
52 | [gl_cv_openssl_gpl_compat=no])]) | ||
53 | fi | ||
54 | if test "x$with_openssl" != xauto-gpl-compat || | ||
55 | test "x$gl_cv_openssl_gpl_compat" = xyes; then | ||
56 | AC_CHECK_LIB([crypto], [$1], | ||
57 | [AC_CHECK_HEADERS( | ||
58 | m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]), | ||
59 | [LIB_CRYPTO=-lcrypto | ||
60 | AC_DEFINE([HAVE_OPENSSL_$1], [1], | ||
61 | [Define to 1 if libcrypto is used for $1.])])]) | ||
62 | fi | ||
63 | if test "x$LIB_CRYPTO" = x; then | ||
64 | message='openssl development library not found for $1. | ||
65 | If you want to install it, first find the pre-built package name: | ||
66 | - On Debian and Debian-based systems: libssl-dev, | ||
67 | - On Red Hat distributions: openssl-devel. | ||
68 | - Other: https://repology.org/project/openssl/versions' | ||
69 | if test "x$with_openssl" = xyes; then | ||
70 | AC_MSG_ERROR([$message]) | ||
71 | elif test "x$with_openssl" = xoptional; then | ||
72 | AC_MSG_WARN([$message]) | ||
73 | fi | ||
74 | fi | ||
75 | fi | ||
76 | ]) | ||
diff --git a/gl/m4/glibc2.m4 b/gl/m4/glibc2.m4 deleted file mode 100644 index 0e50682..0000000 --- a/gl/m4/glibc2.m4 +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | # glibc2.m4 serial 3 | ||
2 | dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation, | ||
3 | dnl 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 | |||
8 | # Test for the GNU C Library, version 2.0 or newer. | ||
9 | # From Bruno Haible. | ||
10 | |||
11 | AC_DEFUN([gt_GLIBC2], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer], | ||
14 | [ac_cv_gnu_library_2], | ||
15 | [AC_EGREP_CPP([Lucky GNU user], | ||
16 | [ | ||
17 | #include <features.h> | ||
18 | #ifdef __GNU_LIBRARY__ | ||
19 | #if (__GLIBC__ >= 2) && !defined __UCLIBC__ | ||
20 | Lucky GNU user | ||
21 | #endif | ||
22 | #endif | ||
23 | ], | ||
24 | [ac_cv_gnu_library_2=yes], | ||
25 | [ac_cv_gnu_library_2=no]) | ||
26 | ] | ||
27 | ) | ||
28 | AC_SUBST([GLIBC2]) | ||
29 | GLIBC2="$ac_cv_gnu_library_2" | ||
30 | ] | ||
31 | ) | ||
diff --git a/gl/m4/glibc21.m4 b/gl/m4/glibc21.m4 deleted file mode 100644 index 613fb2a..0000000 --- a/gl/m4/glibc21.m4 +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | # glibc21.m4 serial 5 | ||
2 | dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation, | ||
3 | dnl 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 | |||
8 | # Test for the GNU C Library, version 2.1 or newer, or uClibc. | ||
9 | # From Bruno Haible. | ||
10 | |||
11 | AC_DEFUN([gl_GLIBC21], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], | ||
14 | [ac_cv_gnu_library_2_1], | ||
15 | [AC_EGREP_CPP([Lucky], | ||
16 | [ | ||
17 | #include <features.h> | ||
18 | #ifdef __GNU_LIBRARY__ | ||
19 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) | ||
20 | Lucky GNU user | ||
21 | #endif | ||
22 | #endif | ||
23 | #ifdef __UCLIBC__ | ||
24 | Lucky user | ||
25 | #endif | ||
26 | ], | ||
27 | [ac_cv_gnu_library_2_1=yes], | ||
28 | [ac_cv_gnu_library_2_1=no]) | ||
29 | ] | ||
30 | ) | ||
31 | AC_SUBST([GLIBC21]) | ||
32 | GLIBC21="$ac_cv_gnu_library_2_1" | ||
33 | ] | ||
34 | ) | ||
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 90ad4aa..ee4756e 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 | |||
@@ -1,8 +1,8 @@ | |||
1 | # Copyright (C) 2002-2013 Free Software Foundation, Inc. | 1 | # Copyright (C) 2002-2023 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 |
5 | # the Free Software Foundation; either version 3 of the License, or | 5 | # the Free Software Foundation, either version 3 of the License, or |
6 | # (at your option) any later version. | 6 | # (at your option) any later version. |
7 | # | 7 | # |
8 | # This file is distributed in the hope that it will be useful, | 8 | # This file is distributed in the hope that it will be useful, |
@@ -11,7 +11,7 @@ | |||
11 | # GNU General Public License for more details. | 11 | # GNU General Public License for more details. |
12 | # | 12 | # |
13 | # You should have received a copy of the GNU General Public License | 13 | # You should have received a copy of the GNU General Public License |
14 | # along with this file. If not, see <http://www.gnu.org/licenses/>. | 14 | # along with this file. If not, see <https://www.gnu.org/licenses/>. |
15 | # | 15 | # |
16 | # As a special exception to the GNU General Public License, | 16 | # As a special exception to the GNU General Public License, |
17 | # this file may be distributed as part of a program that | 17 | # this file may be distributed as part of a program that |
@@ -27,7 +27,39 @@ | |||
27 | 27 | ||
28 | 28 | ||
29 | # Specification in the form of a command-line invocation: | 29 | # Specification in the form of a command-line invocation: |
30 | # gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strcasestr strsep timegm unsetenv vasprintf vsnprintf | 30 | # gnulib-tool --import \ |
31 | # --lib=libgnu \ | ||
32 | # --source-base=gl \ | ||
33 | # --m4-base=gl/m4 \ | ||
34 | # --doc-base=doc \ | ||
35 | # --tests-base=tests \ | ||
36 | # --aux-dir=build-aux \ | ||
37 | # --no-conditional-dependencies \ | ||
38 | # --no-libtool \ | ||
39 | # --macro-prefix=gl \ | ||
40 | # --no-vc-files \ | ||
41 | # base64 \ | ||
42 | # crypto/sha1 \ | ||
43 | # dirname \ | ||
44 | # environ \ | ||
45 | # floorf \ | ||
46 | # fsusage \ | ||
47 | # getaddrinfo \ | ||
48 | # gethostname \ | ||
49 | # getloadavg \ | ||
50 | # getopt-gnu \ | ||
51 | # gettext \ | ||
52 | # idpriv-droptemp \ | ||
53 | # mountlist \ | ||
54 | # regex \ | ||
55 | # setenv \ | ||
56 | # strcase \ | ||
57 | # strcasestr \ | ||
58 | # strsep \ | ||
59 | # timegm \ | ||
60 | # unsetenv \ | ||
61 | # vasprintf \ | ||
62 | # vsnprintf | ||
31 | 63 | ||
32 | # Specification in the form of a few gnulib-tool.m4 macro invocations: | 64 | # Specification in the form of a few gnulib-tool.m4 macro invocations: |
33 | gl_LOCAL_DIR([]) | 65 | gl_LOCAL_DIR([]) |
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index 0ae5a9e..facc340 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 | |||
@@ -1,25 +1,59 @@ | |||
1 | # gnulib-common.m4 serial 33 | 1 | # gnulib-common.m4 serial 75a |
2 | dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_PREREQ([2.62]) | ||
8 | |||
7 | # gl_COMMON | 9 | # gl_COMMON |
8 | # is expanded unconditionally through gnulib-tool magic. | 10 | # is expanded unconditionally through gnulib-tool magic. |
9 | AC_DEFUN([gl_COMMON], [ | 11 | AC_DEFUN([gl_COMMON], [ |
10 | dnl Use AC_REQUIRE here, so that the code is expanded once only. | 12 | dnl Use AC_REQUIRE here, so that the code is expanded once only. |
11 | AC_REQUIRE([gl_00GNULIB]) | 13 | AC_REQUIRE([gl_00GNULIB]) |
12 | AC_REQUIRE([gl_COMMON_BODY]) | 14 | AC_REQUIRE([gl_COMMON_BODY]) |
15 | AC_REQUIRE([gl_ZZGNULIB]) | ||
13 | ]) | 16 | ]) |
14 | AC_DEFUN([gl_COMMON_BODY], [ | 17 | AC_DEFUN([gl_COMMON_BODY], [ |
18 | AH_VERBATIM([_GL_GNUC_PREREQ], | ||
19 | [/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ | ||
20 | #if defined __GNUC__ && defined __GNUC_MINOR__ | ||
21 | # define _GL_GNUC_PREREQ(major, minor) \ | ||
22 | ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) | ||
23 | #else | ||
24 | # define _GL_GNUC_PREREQ(major, minor) 0 | ||
25 | #endif | ||
26 | ]) | ||
15 | AH_VERBATIM([_Noreturn], | 27 | AH_VERBATIM([_Noreturn], |
16 | [/* The _Noreturn keyword of C11. */ | 28 | [/* The _Noreturn keyword of C11. */ |
17 | #if ! (defined _Noreturn \ | 29 | #ifndef _Noreturn |
18 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | 30 | # if (defined __cplusplus \ |
19 | # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ | 31 | && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ |
20 | || 0x5110 <= __SUNPRO_C) | 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. */ | ||
54 | # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C | ||
21 | # define _Noreturn __attribute__ ((__noreturn__)) | 55 | # define _Noreturn __attribute__ ((__noreturn__)) |
22 | # elif defined _MSC_VER && 1200 <= _MSC_VER | 56 | # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) |
23 | # define _Noreturn __declspec (noreturn) | 57 | # define _Noreturn __declspec (noreturn) |
24 | # else | 58 | # else |
25 | # define _Noreturn | 59 | # define _Noreturn |
@@ -36,33 +70,519 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
36 | #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ | 70 | #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ |
37 | # define __GNUC_STDC_INLINE__ 1 | 71 | # define __GNUC_STDC_INLINE__ 1 |
38 | #endif]) | 72 | #endif]) |
39 | AH_VERBATIM([unused_parameter], | 73 | AH_VERBATIM([attribute], |
40 | [/* Define as a marker that can be attached to declarations that might not | 74 | [/* Attributes. */ |
41 | be used. This helps to reduce warnings, such as from | 75 | #if (defined __has_attribute \ |
42 | GCC -Wunused-parameter. */ | 76 | && (!defined __clang_minor__ \ |
43 | #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | 77 | || (defined __apple_build_version__ \ |
44 | # define _GL_UNUSED __attribute__ ((__unused__)) | 78 | ? 6000000 <= __apple_build_version__ \ |
79 | : 3 < __clang_major__ + (5 <= __clang_minor__)))) | ||
80 | # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) | ||
45 | #else | 81 | #else |
46 | # define _GL_UNUSED | 82 | # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr |
83 | # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) | ||
84 | # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) | ||
85 | # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) | ||
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 | ||
99 | # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) | ||
100 | # 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) | ||
47 | #endif | 111 | #endif |
48 | /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name | ||
49 | is a misnomer outside of parameter lists. */ | ||
50 | #define _UNUSED_PARAMETER_ _GL_UNUSED | ||
51 | 112 | ||
52 | /* The __pure__ attribute was added in gcc 2.96. */ | 113 | /* Disable GCC -Wpedantic if using __has_c_attribute and this is not C23+. */ |
53 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) | 114 | #if (defined __has_c_attribute && _GL_GNUC_PREREQ (4, 6) \ |
54 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | 115 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710) |
55 | #else | 116 | # pragma GCC diagnostic ignored "-Wpedantic" |
56 | # define _GL_ATTRIBUTE_PURE /* empty */ | ||
57 | #endif | 117 | #endif |
58 | 118 | ||
59 | /* The __const__ attribute was added in gcc 2.95. */ | 119 | ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. |
60 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | 120 | [ |
61 | # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) | 121 | /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function |
62 | #else | 122 | is the size of the returned memory block. |
63 | # define _GL_ATTRIBUTE_CONST /* empty */ | 123 | _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. | ||
125 | */ | ||
126 | /* Applies to: function, pointer to function, function types. */ | ||
127 | #ifndef _GL_ATTRIBUTE_ALLOC_SIZE | ||
128 | # if _GL_HAS_ATTRIBUTE (alloc_size) | ||
129 | # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) | ||
130 | # else | ||
131 | # define _GL_ATTRIBUTE_ALLOC_SIZE(args) | ||
132 | # endif | ||
133 | #endif | ||
134 | |||
135 | /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the | ||
136 | function and report an error if it cannot do so. */ | ||
137 | /* Applies to: function. */ | ||
138 | #ifndef _GL_ATTRIBUTE_ALWAYS_INLINE | ||
139 | # if _GL_HAS_ATTRIBUTE (always_inline) | ||
140 | # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) | ||
141 | # else | ||
142 | # define _GL_ATTRIBUTE_ALWAYS_INLINE | ||
143 | # endif | ||
144 | #endif | ||
145 | |||
146 | /* _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 | ||
148 | stack traces. */ | ||
149 | /* Applies to: function. */ | ||
150 | #ifndef _GL_ATTRIBUTE_ARTIFICIAL | ||
151 | # if _GL_HAS_ATTRIBUTE (artificial) | ||
152 | # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) | ||
153 | # else | ||
154 | # define _GL_ATTRIBUTE_ARTIFICIAL | ||
155 | # endif | ||
156 | #endif | ||
157 | |||
158 | /* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */ | ||
159 | /* Applies to: functions. */ | ||
160 | /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at | ||
161 | <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. | ||
162 | Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ | ||
163 | #ifndef _GL_ATTRIBUTE_COLD | ||
164 | # if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ | ||
165 | # ifndef __SUNPRO_C | ||
166 | # define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) | ||
167 | # else | ||
168 | # define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) | ||
169 | # endif | ||
170 | # else | ||
171 | # define _GL_ATTRIBUTE_COLD | ||
172 | # endif | ||
173 | #endif | ||
174 | |||
175 | /* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate | ||
176 | calls to the function with the same arguments. | ||
177 | This attribute is safe for a function that neither depends on nor affects | ||
178 | observable state, and always returns exactly once - e.g., does not loop | ||
179 | forever, and does not call longjmp. | ||
180 | (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ | ||
181 | /* Applies to: functions. */ | ||
182 | #ifndef _GL_ATTRIBUTE_CONST | ||
183 | # if _GL_HAS_ATTRIBUTE (const) | ||
184 | # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) | ||
185 | # else | ||
186 | # define _GL_ATTRIBUTE_CONST | ||
187 | # endif | ||
188 | #endif | ||
189 | |||
190 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | ||
191 | that can be freed by passing them as the Ith argument to the | ||
192 | function F. | ||
193 | _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that | ||
194 | can be freed via 'free'; it can be used only after declaring 'free'. */ | ||
195 | /* Applies to: functions. Cannot be used on inline functions. */ | ||
196 | #ifndef _GL_ATTRIBUTE_DEALLOC | ||
197 | # if _GL_GNUC_PREREQ (11, 0) | ||
198 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) | ||
199 | # else | ||
200 | # define _GL_ATTRIBUTE_DEALLOC(f, i) | ||
201 | # endif | ||
202 | #endif | ||
203 | /* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue | ||
204 | to use this earlier definition, since <stdlib.h> may not have been included | ||
205 | yet. */ | ||
206 | #ifndef _GL_ATTRIBUTE_DEALLOC_FREE | ||
207 | # if defined __cplusplus && defined __GNUC__ && !defined __clang__ | ||
208 | /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ | ||
209 | # define _GL_ATTRIBUTE_DEALLOC_FREE \ | ||
210 | _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) | ||
211 | # else | ||
212 | # define _GL_ATTRIBUTE_DEALLOC_FREE \ | ||
213 | _GL_ATTRIBUTE_DEALLOC (free, 1) | ||
214 | # endif | ||
215 | #endif | ||
216 | |||
217 | /* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated. | ||
218 | The compiler may warn if the entity is used. */ | ||
219 | /* Applies to: | ||
220 | - function, variable, | ||
221 | - struct, union, struct/union member, | ||
222 | - enumeration, enumeration item, | ||
223 | - typedef, | ||
224 | in C++ also: namespace, class, template specialization. */ | ||
225 | #ifndef _GL_ATTRIBUTE_DEPRECATED | ||
226 | # ifdef __has_c_attribute | ||
227 | # if __has_c_attribute (__deprecated__) | ||
228 | # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] | ||
229 | # endif | ||
230 | # endif | ||
231 | # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) | ||
232 | # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) | ||
233 | # endif | ||
234 | # ifndef _GL_ATTRIBUTE_DEPRECATED | ||
235 | # define _GL_ATTRIBUTE_DEPRECATED | ||
236 | # endif | ||
237 | #endif | ||
238 | |||
239 | /* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and | ||
240 | the function call is not optimized away. | ||
241 | _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and | ||
242 | the function call is not optimized away. */ | ||
243 | /* Applies to: functions. */ | ||
244 | #if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING) | ||
245 | # if _GL_HAS_ATTRIBUTE (error) | ||
246 | # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) | ||
247 | # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) | ||
248 | # elif _GL_HAS_ATTRIBUTE (diagnose_if) | ||
249 | # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) | ||
250 | # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) | ||
251 | # else | ||
252 | # define _GL_ATTRIBUTE_ERROR(msg) | ||
253 | # define _GL_ATTRIBUTE_WARNING(msg) | ||
254 | # endif | ||
255 | #endif | ||
256 | |||
257 | /* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain | ||
258 | visible to debuggers etc., even with '-fwhole-program'. */ | ||
259 | /* Applies to: functions, variables. */ | ||
260 | #ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE | ||
261 | # if _GL_HAS_ATTRIBUTE (externally_visible) | ||
262 | # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) | ||
263 | # else | ||
264 | # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE | ||
265 | # endif | ||
266 | #endif | ||
267 | |||
268 | /* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if | ||
269 | the control flow falls through to the immediately following 'case' or | ||
270 | 'default' label. The compiler should not warn in this case. */ | ||
271 | /* Applies to: Empty statement (;), inside a 'switch' statement. */ | ||
272 | /* Always expands to something. */ | ||
273 | #ifndef _GL_ATTRIBUTE_FALLTHROUGH | ||
274 | # ifdef __has_c_attribute | ||
275 | # if __has_c_attribute (__fallthrough__) | ||
276 | # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] | ||
277 | # endif | ||
278 | # endif | ||
279 | # if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough) | ||
280 | # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) | ||
281 | # endif | ||
282 | # ifndef _GL_ATTRIBUTE_FALLTHROUGH | ||
283 | # define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) | ||
284 | # endif | ||
285 | #endif | ||
286 | |||
287 | /* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) | ||
288 | declares that the STRING-INDEXth function argument is a format string of | ||
289 | style ARCHETYPE, which is one of: | ||
290 | printf, gnu_printf | ||
291 | scanf, gnu_scanf, | ||
292 | strftime, gnu_strftime, | ||
293 | strfmon, | ||
294 | or the same thing prefixed and suffixed with '__'. | ||
295 | If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK | ||
296 | are suitable for the format string. */ | ||
297 | /* Applies to: functions. */ | ||
298 | #ifndef _GL_ATTRIBUTE_FORMAT | ||
299 | # if _GL_HAS_ATTRIBUTE (format) | ||
300 | # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) | ||
301 | # else | ||
302 | # define _GL_ATTRIBUTE_FORMAT(spec) | ||
303 | # endif | ||
304 | #endif | ||
305 | |||
306 | /* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other | ||
307 | compilation unit, it executes code from that unit only by return or by | ||
308 | exception handling. This declaration lets the compiler optimize that unit | ||
309 | more aggressively. */ | ||
310 | /* Applies to: functions. */ | ||
311 | #ifndef _GL_ATTRIBUTE_LEAF | ||
312 | # if _GL_HAS_ATTRIBUTE (leaf) | ||
313 | # define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) | ||
314 | # else | ||
315 | # define _GL_ATTRIBUTE_LEAF | ||
316 | # endif | ||
317 | #endif | ||
318 | |||
319 | /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly | ||
320 | allocated memory. */ | ||
321 | /* Applies to: functions. */ | ||
322 | #ifndef _GL_ATTRIBUTE_MALLOC | ||
323 | # if _GL_HAS_ATTRIBUTE (malloc) | ||
324 | # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) | ||
325 | # else | ||
326 | # define _GL_ATTRIBUTE_MALLOC | ||
327 | # endif | ||
328 | #endif | ||
329 | |||
330 | /* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the | ||
331 | same storage as pointers to other types. Thus this declaration disables | ||
332 | strict aliasing optimization. */ | ||
333 | /* Applies to: types. */ | ||
334 | /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ | ||
335 | #ifndef _GL_ATTRIBUTE_MAY_ALIAS | ||
336 | # if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C | ||
337 | # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) | ||
338 | # else | ||
339 | # define _GL_ATTRIBUTE_MAY_ALIAS | ||
340 | # endif | ||
341 | #endif | ||
342 | |||
343 | /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if | ||
344 | the entity is not used. The compiler should not warn if the entity is not | ||
345 | used. */ | ||
346 | /* Applies to: | ||
347 | - function, variable, | ||
348 | - struct, union, struct/union member, | ||
349 | - enumeration, enumeration item, | ||
350 | - typedef, | ||
351 | in C++ also: class. */ | ||
352 | /* In C++ and C23, this is spelled [[__maybe_unused__]]. | ||
353 | GCC's syntax is __attribute__ ((__unused__)). | ||
354 | clang supports both syntaxes. */ | ||
355 | #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | ||
356 | # ifdef __has_c_attribute | ||
357 | # if __has_c_attribute (__maybe_unused__) | ||
358 | # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | ||
359 | # endif | ||
360 | # endif | ||
361 | # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | ||
362 | # define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED | ||
363 | # endif | ||
364 | #endif | ||
365 | /* Alternative spelling of this macro, for convenience and for | ||
366 | compatibility with glibc/include/libc-symbols.h. */ | ||
367 | #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED | ||
368 | /* Earlier spellings of this macro. */ | ||
369 | #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED | ||
370 | |||
371 | /* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not | ||
372 | discard the return value. The compiler may warn if the caller does not use | ||
373 | the return value, unless the caller uses something like ignore_value. */ | ||
374 | /* Applies to: function, enumeration, class. */ | ||
375 | #ifndef _GL_ATTRIBUTE_NODISCARD | ||
376 | # ifdef __has_c_attribute | ||
377 | # if __has_c_attribute (__nodiscard__) | ||
378 | # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] | ||
379 | # endif | ||
380 | # endif | ||
381 | # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) | ||
382 | # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) | ||
383 | # endif | ||
384 | # ifndef _GL_ATTRIBUTE_NODISCARD | ||
385 | # define _GL_ATTRIBUTE_NODISCARD | ||
386 | # endif | ||
387 | #endif | ||
388 | |||
389 | /* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the | ||
390 | function. */ | ||
391 | /* Applies to: functions. */ | ||
392 | #ifndef _GL_ATTRIBUTE_NOINLINE | ||
393 | # if _GL_HAS_ATTRIBUTE (noinline) | ||
394 | # define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) | ||
395 | # else | ||
396 | # define _GL_ATTRIBUTE_NOINLINE | ||
397 | # endif | ||
398 | #endif | ||
399 | |||
400 | /* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,... | ||
401 | must not be NULL. | ||
402 | _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be | ||
403 | null. */ | ||
404 | /* Applies to: functions. */ | ||
405 | #ifndef _GL_ATTRIBUTE_NONNULL | ||
406 | # if _GL_HAS_ATTRIBUTE (nonnull) | ||
407 | # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) | ||
408 | # else | ||
409 | # define _GL_ATTRIBUTE_NONNULL(args) | ||
410 | # endif | ||
411 | #endif | ||
412 | |||
413 | /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is | ||
414 | not meant to be NUL-terminated. */ | ||
415 | /* Applies to: struct/union members and variables that are arrays of element | ||
416 | type '[[un]signed] char'. */ | ||
417 | #ifndef _GL_ATTRIBUTE_NONSTRING | ||
418 | # if _GL_HAS_ATTRIBUTE (nonstring) | ||
419 | # define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) | ||
420 | # else | ||
421 | # define _GL_ATTRIBUTE_NONSTRING | ||
422 | # endif | ||
423 | #endif | ||
424 | |||
425 | /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ | ||
426 | |||
427 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
428 | */ | ||
429 | /* Applies to: functions. */ | ||
430 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
431 | # if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus | ||
432 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
433 | # else | ||
434 | # define _GL_ATTRIBUTE_NOTHROW | ||
435 | # endif | ||
436 | #endif | ||
437 | |||
438 | /* _GL_ATTRIBUTE_PACKED declares: | ||
439 | For struct members: The member has the smallest possible alignment. | ||
440 | For struct, union, class: All members have the smallest possible alignment, | ||
441 | minimizing the memory required. */ | ||
442 | /* Applies to: struct members, struct, union, | ||
443 | in C++ also: class. */ | ||
444 | #ifndef _GL_ATTRIBUTE_PACKED | ||
445 | # if _GL_HAS_ATTRIBUTE (packed) | ||
446 | # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) | ||
447 | # else | ||
448 | # define _GL_ATTRIBUTE_PACKED | ||
449 | # endif | ||
450 | #endif | ||
451 | |||
452 | /* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate | ||
453 | calls to the function with the same arguments if observable state is not | ||
454 | changed between calls. | ||
455 | This attribute is safe for a function that does not affect | ||
456 | observable state, and always returns exactly once. | ||
457 | (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ | ||
458 | /* Applies to: functions. */ | ||
459 | #ifndef _GL_ATTRIBUTE_PURE | ||
460 | # if _GL_HAS_ATTRIBUTE (pure) | ||
461 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | ||
462 | # else | ||
463 | # define _GL_ATTRIBUTE_PURE | ||
464 | # endif | ||
465 | #endif | ||
466 | |||
467 | /* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is | ||
468 | a non-NULL pointer. */ | ||
469 | /* Applies to: functions. */ | ||
470 | #ifndef _GL_ATTRIBUTE_RETURNS_NONNULL | ||
471 | # if _GL_HAS_ATTRIBUTE (returns_nonnull) | ||
472 | # define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) | ||
473 | # else | ||
474 | # define _GL_ATTRIBUTE_RETURNS_NONNULL | ||
475 | # endif | ||
476 | #endif | ||
477 | |||
478 | /* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a | ||
479 | trailing NULL argument. | ||
480 | _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). | ||
481 | _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ | ||
482 | /* Applies to: functions. */ | ||
483 | #ifndef _GL_ATTRIBUTE_SENTINEL | ||
484 | # if _GL_HAS_ATTRIBUTE (sentinel) | ||
485 | # define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) | ||
486 | # else | ||
487 | # define _GL_ATTRIBUTE_SENTINEL(pos) | ||
488 | # endif | ||
489 | #endif | ||
490 | |||
491 | /* A helper macro. Don't use it directly. */ | ||
492 | #ifndef _GL_ATTRIBUTE_UNUSED | ||
493 | # if _GL_HAS_ATTRIBUTE (unused) | ||
494 | # define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) | ||
495 | # else | ||
496 | # define _GL_ATTRIBUTE_UNUSED | ||
497 | # endif | ||
498 | #endif | ||
499 | |||
500 | ]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead. | ||
501 | [ | ||
502 | /* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the | ||
503 | immediately preceding label is not used. The compiler should not warn | ||
504 | if the label is not used. */ | ||
505 | /* Applies to: label (both in C and C++). */ | ||
506 | /* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;' | ||
507 | syntax. But clang does. */ | ||
508 | #ifndef _GL_UNUSED_LABEL | ||
509 | # if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__ | ||
510 | # define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED | ||
511 | # else | ||
512 | # define _GL_UNUSED_LABEL | ||
513 | # endif | ||
64 | #endif | 514 | #endif |
65 | ]) | 515 | ]) |
516 | AH_VERBATIM([async_safe], | ||
517 | [/* The _GL_ASYNC_SAFE marker should be attached to functions that are | ||
518 | signal handlers (for signals other than SIGABRT, SIGPIPE) or can be | ||
519 | invoked from such signal handlers. Such functions have some restrictions: | ||
520 | * All functions that it calls should be marked _GL_ASYNC_SAFE as well, | ||
521 | or should be listed as async-signal-safe in POSIX | ||
522 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> | ||
523 | section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in | ||
524 | particular, are NOT async-signal-safe. | ||
525 | * All memory locations (variables and struct fields) that these functions | ||
526 | access must be marked 'volatile'. This holds for both read and write | ||
527 | accesses. Otherwise the compiler might optimize away stores to and | ||
528 | reads from such locations that occur in the program, depending on its | ||
529 | data flow analysis. For example, when the program contains a loop | ||
530 | that is intended to inspect a variable set from within a signal handler | ||
531 | while (!signal_occurred) | ||
532 | ; | ||
533 | the compiler is allowed to transform this into an endless loop if the | ||
534 | variable 'signal_occurred' is not declared 'volatile'. | ||
535 | Additionally, recall that: | ||
536 | * A signal handler should not modify errno (except if it is a handler | ||
537 | for a fatal signal and ends by raising the same signal again, thus | ||
538 | provoking the termination of the process). If it invokes a function | ||
539 | that may clobber errno, it needs to save and restore the value of | ||
540 | errno. */ | ||
541 | #define _GL_ASYNC_SAFE | ||
542 | ]) | ||
543 | AH_VERBATIM([micro_optimizations], | ||
544 | [/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where | ||
545 | n1 and n2 are expressions without side effects, that evaluate to real | ||
546 | numbers (excluding NaN). | ||
547 | It returns | ||
548 | 1 if n1 > n2 | ||
549 | 0 if n1 == n2 | ||
550 | -1 if n1 < n2 | ||
551 | 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. | ||
553 | This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many | ||
554 | GCC versions up to GCC 9. | ||
555 | The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 | ||
556 | avoids conditional jumps in all GCC versions >= 3.4. */ | ||
557 | #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) | ||
558 | ]) | ||
559 | dnl Hint which direction to take regarding cross-compilation guesses: | ||
560 | dnl When a user installs a program on a platform they are not intimately | ||
561 | dnl familiar with, --enable-cross-guesses=conservative is the appropriate | ||
562 | dnl choice. It implements the "If we don't know, assume the worst" principle. | ||
563 | dnl However, when an operating system developer (on a platform which is not | ||
564 | dnl yet known to gnulib) builds packages for their platform, they want to | ||
565 | dnl expose, not hide, possible platform bugs; in this case, | ||
566 | dnl --enable-cross-guesses=risky is the appropriate choice. | ||
567 | dnl Sets the variables | ||
568 | 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). | ||
570 | AC_ARG_ENABLE([cross-guesses], | ||
571 | [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], | ||
572 | [specify policy for cross-compilation guesses])], | ||
573 | [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then | ||
574 | AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) | ||
575 | enableval=conservative | ||
576 | fi | ||
577 | gl_cross_guesses="$enableval"], | ||
578 | [gl_cross_guesses=conservative]) | ||
579 | if test $gl_cross_guesses = risky; then | ||
580 | gl_cross_guess_normal="guessing yes" | ||
581 | gl_cross_guess_inverted="guessing no" | ||
582 | else | ||
583 | gl_cross_guess_normal="guessing no" | ||
584 | gl_cross_guess_inverted="guessing yes" | ||
585 | fi | ||
66 | dnl Preparation for running test programs: | 586 | dnl Preparation for running test programs: |
67 | dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not | 587 | dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not |
68 | dnl to /dev/tty, so they can be redirected to log files. Such diagnostics | 588 | dnl to /dev/tty, so they can be redirected to log files. Such diagnostics |
@@ -71,6 +591,16 @@ AC_DEFUN([gl_COMMON_BODY], [ | |||
71 | export LIBC_FATAL_STDERR_ | 591 | export LIBC_FATAL_STDERR_ |
72 | ]) | 592 | ]) |
73 | 593 | ||
594 | # gl_MODULE_INDICATOR_INIT_VARIABLE([variablename]) | ||
595 | # gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue]) | ||
596 | # initializes the shell variable that indicates the presence of the given module | ||
597 | # as a C preprocessor expression. | ||
598 | AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE], | ||
599 | [ | ||
600 | GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2]) | ||
601 | AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1]) | ||
602 | ]) | ||
603 | |||
74 | # gl_MODULE_INDICATOR_CONDITION | 604 | # gl_MODULE_INDICATOR_CONDITION |
75 | # expands to a C preprocessor expression that evaluates to 1 or 0, depending | 605 | # expands to a C preprocessor expression that evaluates to 1 or 0, depending |
76 | # whether a gnulib module that has been requested shall be considered present | 606 | # whether a gnulib module that has been requested shall be considered present |
@@ -83,9 +613,9 @@ m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) | |||
83 | AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], | 613 | AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], |
84 | [ | 614 | [ |
85 | gl_MODULE_INDICATOR_SET_VARIABLE_AUX( | 615 | gl_MODULE_INDICATOR_SET_VARIABLE_AUX( |
86 | [GNULIB_[]m4_translit([[$1]], | 616 | [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]], |
87 | [abcdefghijklmnopqrstuvwxyz./-], | 617 | [abcdefghijklmnopqrstuvwxyz./-], |
88 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], | 618 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], |
89 | [gl_MODULE_INDICATOR_CONDITION]) | 619 | [gl_MODULE_INDICATOR_CONDITION]) |
90 | ]) | 620 | ]) |
91 | 621 | ||
@@ -197,42 +727,20 @@ AC_DEFUN([gl_FEATURES_H], | |||
197 | AC_SUBST([HAVE_FEATURES_H]) | 727 | AC_SUBST([HAVE_FEATURES_H]) |
198 | ]) | 728 | ]) |
199 | 729 | ||
200 | # m4_foreach_w | ||
201 | # is a backport of autoconf-2.59c's m4_foreach_w. | ||
202 | # Remove this macro when we can assume autoconf >= 2.60. | ||
203 | m4_ifndef([m4_foreach_w], | ||
204 | [m4_define([m4_foreach_w], | ||
205 | [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) | ||
206 | |||
207 | # AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) | ||
208 | # ---------------------------------------------------- | ||
209 | # Backport of autoconf-2.63b's macro. | ||
210 | # Remove this macro when we can assume autoconf >= 2.64. | ||
211 | m4_ifndef([AS_VAR_IF], | ||
212 | [m4_define([AS_VAR_IF], | ||
213 | [AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) | ||
214 | |||
215 | # gl_PROG_CC_C99 | 730 | # gl_PROG_CC_C99 |
216 | # Modifies the value of the shell variable CC in an attempt to make $CC | 731 | # Modifies the value of the shell variable CC in an attempt to make $CC |
217 | # understand ISO C99 source code. | 732 | # understand ISO C99 source code. |
218 | # This is like AC_PROG_CC_C99, except that | ||
219 | # - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60, | ||
220 | # - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC | ||
221 | # <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>, | ||
222 | # but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99 | ||
223 | # <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>. | ||
224 | # Remaining problems: | ||
225 | # - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options | ||
226 | # to CC twice | ||
227 | # <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>. | ||
228 | # - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard. | ||
229 | AC_DEFUN([gl_PROG_CC_C99], | 733 | AC_DEFUN([gl_PROG_CC_C99], |
230 | [ | 734 | [ |
231 | dnl Change that version number to the minimum Autoconf version that supports | 735 | dnl Just use AC_PROG_CC_C99. |
232 | dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls. | 736 | dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the substituted |
233 | m4_version_prereq([9.0], | 737 | dnl value of CC will contain the C99 enabling options twice. But this is only |
234 | [AC_REQUIRE([AC_PROG_CC_C99])], | 738 | dnl a cosmetic problem. |
235 | [AC_REQUIRE([AC_PROG_CC_STDC])]) | 739 | dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99; |
740 | dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete." | ||
741 | m4_version_prereq([2.70], | ||
742 | [AC_REQUIRE([AC_PROG_CC])], | ||
743 | [AC_REQUIRE([AC_PROG_CC_C99])]) | ||
236 | ]) | 744 | ]) |
237 | 745 | ||
238 | # gl_PROG_AR_RANLIB | 746 | # gl_PROG_AR_RANLIB |
@@ -243,9 +751,11 @@ AC_DEFUN([gl_PROG_AR_RANLIB], | |||
243 | [ | 751 | [ |
244 | dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler | 752 | dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler |
245 | dnl as "cc", and GCC as "gcc". They have different object file formats and | 753 | dnl as "cc", and GCC as "gcc". They have different object file formats and |
246 | dnl library formats. In particular, the GNU binutils programs ar, ranlib | 754 | dnl library formats. In particular, the GNU binutils programs ar and ranlib |
247 | dnl produce libraries that work only with gcc, not with cc. | 755 | dnl produce libraries that work only with gcc, not with cc. |
248 | AC_REQUIRE([AC_PROG_CC]) | 756 | AC_REQUIRE([AC_PROG_CC]) |
757 | dnl The '][' hides this use from 'aclocal'. | ||
758 | AC_BEFORE([$0], [A][M_PROG_AR]) | ||
249 | AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], | 759 | AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], |
250 | [ | 760 | [ |
251 | AC_EGREP_CPP([Amsterdam], | 761 | AC_EGREP_CPP([Amsterdam], |
@@ -257,25 +767,39 @@ Amsterdam | |||
257 | [gl_cv_c_amsterdam_compiler=yes], | 767 | [gl_cv_c_amsterdam_compiler=yes], |
258 | [gl_cv_c_amsterdam_compiler=no]) | 768 | [gl_cv_c_amsterdam_compiler=no]) |
259 | ]) | 769 | ]) |
260 | if test -z "$AR"; then | 770 | |
261 | if test $gl_cv_c_amsterdam_compiler = yes; then | 771 | dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not |
772 | dnl building with __ACK__. | ||
773 | if test $gl_cv_c_amsterdam_compiler = yes; then | ||
774 | if test -z "$AR"; then | ||
262 | AR='cc -c.a' | 775 | AR='cc -c.a' |
263 | if test -z "$ARFLAGS"; then | ||
264 | ARFLAGS='-o' | ||
265 | fi | ||
266 | else | ||
267 | dnl Use the Automake-documented default values for AR and ARFLAGS, | ||
268 | dnl but prefer ${host}-ar over ar (useful for cross-compiling). | ||
269 | AC_CHECK_TOOL([AR], [ar], [ar]) | ||
270 | if test -z "$ARFLAGS"; then | ||
271 | ARFLAGS='cru' | ||
272 | fi | ||
273 | fi | 776 | fi |
274 | else | ||
275 | if test -z "$ARFLAGS"; then | 777 | if test -z "$ARFLAGS"; then |
276 | ARFLAGS='cru' | 778 | ARFLAGS='-o' |
277 | fi | 779 | fi |
780 | else | ||
781 | dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST | ||
782 | dnl ARFLAGS variable (it is filed into Makefile.in directly by automake | ||
783 | dnl script on-demand, if not specified by ./configure of course). | ||
784 | dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above | ||
785 | dnl will be ignored. Also, pay attention to call AM_PROG_AR in else block | ||
786 | dnl because AM_PROG_AR is written so it could re-set AR variable even for | ||
787 | dnl __ACK__. It may seem like its easier to avoid calling the macro here, | ||
788 | dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good | ||
789 | dnl default value and automake should usually know them). | ||
790 | dnl | ||
791 | dnl The '][' hides this use from 'aclocal'. | ||
792 | m4_ifdef([A][M_PROG_AR], [A][M_PROG_AR], [:]) | ||
278 | fi | 793 | fi |
794 | |||
795 | dnl In case the code above has not helped with setting AR/ARFLAGS, use | ||
796 | dnl Automake-documented default values for AR and ARFLAGS, but prefer | ||
797 | dnl ${host}-ar over ar (useful for cross-compiling). | ||
798 | AC_CHECK_TOOL([AR], [ar], [ar]) | ||
799 | if test -z "$ARFLAGS"; then | ||
800 | ARFLAGS='cr' | ||
801 | fi | ||
802 | |||
279 | AC_SUBST([AR]) | 803 | AC_SUBST([AR]) |
280 | AC_SUBST([ARFLAGS]) | 804 | AC_SUBST([ARFLAGS]) |
281 | if test -z "$RANLIB"; then | 805 | if test -z "$RANLIB"; then |
@@ -289,46 +813,29 @@ Amsterdam | |||
289 | AC_SUBST([RANLIB]) | 813 | AC_SUBST([RANLIB]) |
290 | ]) | 814 | ]) |
291 | 815 | ||
292 | # AC_PROG_MKDIR_P | ||
293 | # is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix | ||
294 | # for interoperability with automake-1.9.6 from autoconf-2.62. | ||
295 | # Remove this macro when we can assume autoconf >= 2.62 or | ||
296 | # autoconf >= 2.60 && automake >= 1.10. | ||
297 | # AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. | ||
298 | m4_ifndef([AC_AUTOCONF_VERSION],[ | ||
299 | m4_ifdef([AC_PROG_MKDIR_P], [ | ||
300 | dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. | ||
301 | m4_define([AC_PROG_MKDIR_P], | ||
302 | m4_defn([AC_PROG_MKDIR_P])[ | ||
303 | AC_SUBST([MKDIR_P])])], [ | ||
304 | dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. | ||
305 | AC_DEFUN_ONCE([AC_PROG_MKDIR_P], | ||
306 | [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake | ||
307 | MKDIR_P='$(mkdir_p)' | ||
308 | AC_SUBST([MKDIR_P])])]) | ||
309 | ]) | ||
310 | |||
311 | # AC_C_RESTRICT | 816 | # AC_C_RESTRICT |
312 | # This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, | 817 | # This definition is copied from post-2.70 Autoconf and overrides the |
313 | # so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ | 818 | # AC_C_RESTRICT macro from autoconf 2.60..2.70. |
314 | # works. | 819 | m4_version_prereq([2.70.1], [], [ |
315 | # This definition can be removed once autoconf >= 2.62 can be assumed. | ||
316 | # AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. | ||
317 | m4_ifndef([AC_AUTOCONF_VERSION],[ | ||
318 | AC_DEFUN([AC_C_RESTRICT], | 820 | AC_DEFUN([AC_C_RESTRICT], |
319 | [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], | 821 | [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], |
320 | [ac_cv_c_restrict=no | 822 | [ac_cv_c_restrict=no |
321 | # The order here caters to the fact that C++ does not require restrict. | 823 | # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: |
322 | for ac_kw in __restrict __restrict__ _Restrict restrict; do | 824 | # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html |
323 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | 825 | # Put 'restrict' last, because C++ lacks it. |
324 | [[typedef int * int_ptr; | 826 | for ac_kw in __restrict__ __restrict _Restrict restrict; do |
325 | int foo (int_ptr $ac_kw ip) { | 827 | AC_COMPILE_IFELSE( |
326 | return ip[0]; | 828 | [AC_LANG_PROGRAM( |
327 | }]], | 829 | [[typedef int *int_ptr; |
328 | [[int s[1]; | 830 | int foo (int_ptr $ac_kw ip) { return ip[0]; } |
329 | int * $ac_kw t = s; | 831 | int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ |
330 | t[0] = 0; | 832 | int bar (int ip[$ac_kw]) { return ip[0]; } |
331 | return foo(t)]])], | 833 | ]], |
834 | [[int s[1]; | ||
835 | int *$ac_kw t = s; | ||
836 | t[0] = 0; | ||
837 | return foo (t) + bar (t); | ||
838 | ]])], | ||
332 | [ac_cv_c_restrict=$ac_kw]) | 839 | [ac_cv_c_restrict=$ac_kw]) |
333 | test "$ac_cv_c_restrict" != no && break | 840 | test "$ac_cv_c_restrict" != no && break |
334 | done | 841 | done |
@@ -336,22 +843,24 @@ AC_DEFUN([AC_C_RESTRICT], | |||
336 | AH_VERBATIM([restrict], | 843 | AH_VERBATIM([restrict], |
337 | [/* Define to the equivalent of the C99 'restrict' keyword, or to | 844 | [/* Define to the equivalent of the C99 'restrict' keyword, or to |
338 | nothing if this is not supported. Do not define if restrict is | 845 | nothing if this is not supported. Do not define if restrict is |
339 | supported directly. */ | 846 | supported only directly. */ |
340 | #undef restrict | 847 | #undef restrict |
341 | /* Work around a bug in Sun C++: it does not support _Restrict, even | 848 | /* Work around a bug in older versions of Sun C++, which did not |
342 | though the corresponding Sun C compiler does, which causes | 849 | #define __restrict__ or support _Restrict or __restrict__ |
343 | "#define restrict _Restrict" in the previous line. Perhaps some future | 850 | even though the corresponding Sun C compiler ended up with |
344 | version of Sun C++ will work with _Restrict; if so, it'll probably | 851 | "#define restrict _Restrict" or "#define restrict __restrict__" |
345 | define __RESTRICT, just as Sun C does. */ | 852 | in the previous line. This workaround can be removed once |
346 | #if defined __SUNPRO_CC && !defined __RESTRICT | 853 | we assume Oracle Developer Studio 12.5 (2016) or later. */ |
854 | #if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ | ||
347 | # define _Restrict | 855 | # define _Restrict |
856 | # define __restrict__ | ||
348 | #endif]) | 857 | #endif]) |
349 | case $ac_cv_c_restrict in | 858 | case $ac_cv_c_restrict in |
350 | restrict) ;; | 859 | restrict) ;; |
351 | no) AC_DEFINE([restrict], []) ;; | 860 | no) AC_DEFINE([restrict], []) ;; |
352 | *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; | 861 | *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; |
353 | esac | 862 | esac |
354 | ]) | 863 | ])# AC_C_RESTRICT |
355 | ]) | 864 | ]) |
356 | 865 | ||
357 | # gl_BIGENDIAN | 866 | # gl_BIGENDIAN |
@@ -363,6 +872,22 @@ AC_DEFUN([gl_BIGENDIAN], | |||
363 | AC_C_BIGENDIAN | 872 | AC_C_BIGENDIAN |
364 | ]) | 873 | ]) |
365 | 874 | ||
875 | # A temporary file descriptor. | ||
876 | # Must be less than 10, because dash 0.5.8 does not support redirections | ||
877 | # with multi-digit file descriptors. | ||
878 | m4_define([GL_TMP_FD], 9) | ||
879 | |||
880 | # gl_SILENT(command) | ||
881 | # executes command, but without the normal configure output. | ||
882 | # This is useful when you want to invoke AC_CACHE_CHECK (or AC_CHECK_FUNC etc.) | ||
883 | # inside another AC_CACHE_CHECK. | ||
884 | AC_DEFUN([gl_SILENT], | ||
885 | [ | ||
886 | exec GL_TMP_FD>&AS_MESSAGE_FD AS_MESSAGE_FD>/dev/null | ||
887 | $1 | ||
888 | exec AS_MESSAGE_FD>&GL_TMP_FD GL_TMP_FD>&- | ||
889 | ]) | ||
890 | |||
366 | # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) | 891 | # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) |
367 | # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not | 892 | # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not |
368 | # output a spurious "(cached)" mark in the midst of other configure output. | 893 | # output a spurious "(cached)" mark in the midst of other configure output. |
@@ -370,8 +895,257 @@ AC_DEFUN([gl_BIGENDIAN], | |||
370 | # by an AC_MSG_CHECKING/AC_MSG_RESULT pair. | 895 | # by an AC_MSG_CHECKING/AC_MSG_RESULT pair. |
371 | AC_DEFUN([gl_CACHE_VAL_SILENT], | 896 | AC_DEFUN([gl_CACHE_VAL_SILENT], |
372 | [ | 897 | [ |
373 | saved_as_echo_n="$as_echo_n" | 898 | gl_SILENT([ |
374 | as_echo_n=':' | 899 | AC_CACHE_VAL([$1], [$2]) |
375 | AC_CACHE_VAL([$1], [$2]) | 900 | ]) |
376 | as_echo_n="$saved_as_echo_n" | 901 | ]) |
902 | |||
903 | # gl_CONDITIONAL(conditional, condition) | ||
904 | # is like AM_CONDITIONAL(conditional, condition), except that it does not | ||
905 | # produce an error | ||
906 | # configure: error: conditional "..." was never defined. | ||
907 | # Usually this means the macro was only invoked conditionally. | ||
908 | # when only invoked conditionally. Instead, in that case, both the _TRUE | ||
909 | # and the _FALSE case are disabled. | ||
910 | AC_DEFUN([gl_CONDITIONAL], | ||
911 | [ | ||
912 | pushdef([AC_CONFIG_COMMANDS_PRE], [:])dnl | ||
913 | AM_CONDITIONAL([$1], [$2]) | ||
914 | popdef([AC_CONFIG_COMMANDS_PRE])dnl | ||
915 | if test -z "${[$1]_TRUE}" && test -z "${[$1]_FALSE}"; then | ||
916 | [$1]_TRUE='#' | ||
917 | [$1]_FALSE='#' | ||
918 | fi | ||
919 | ]) | ||
920 | |||
921 | # gl_CC_ALLOW_WARNINGS | ||
922 | # sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option | ||
923 | # that reverts a preceding '-Werror' option, if available. | ||
924 | # This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang | ||
925 | # and empty otherwise. | ||
926 | AC_DEFUN([gl_CC_ALLOW_WARNINGS], | ||
927 | [ | ||
928 | AC_REQUIRE([AC_PROG_CC]) | ||
929 | AC_CACHE_CHECK([for C compiler option to allow warnings], | ||
930 | [gl_cv_cc_wallow], | ||
931 | [rm -f conftest* | ||
932 | echo 'int dummy;' > conftest.c | ||
933 | 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 | ||
935 | dnl Test the number of error output lines, because AIX xlc accepts the | ||
936 | dnl option '-Wno-error', just to produce a warning | ||
937 | dnl "Option -Wno-error was incorrectly specified. The option will be ignored." | ||
938 | dnl afterwards. | ||
939 | if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then | ||
940 | gl_cv_cc_wallow='-Wno-error' | ||
941 | else | ||
942 | gl_cv_cc_wallow=none | ||
943 | fi | ||
944 | rm -f conftest* | ||
945 | ]) | ||
946 | case "$gl_cv_cc_wallow" in | ||
947 | none) GL_CFLAG_ALLOW_WARNINGS='' ;; | ||
948 | *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; | ||
949 | esac | ||
950 | AC_SUBST([GL_CFLAG_ALLOW_WARNINGS]) | ||
951 | ]) | ||
952 | |||
953 | # gl_CXX_ALLOW_WARNINGS | ||
954 | # sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option | ||
955 | # that reverts a preceding '-Werror' option, if available. | ||
956 | AC_DEFUN([gl_CXX_ALLOW_WARNINGS], | ||
957 | [ | ||
958 | dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX. | ||
959 | if test -n "$CXX" && test "$CXX" != no; then | ||
960 | AC_CACHE_CHECK([for C++ compiler option to allow warnings], | ||
961 | [gl_cv_cxx_wallow], | ||
962 | [rm -f conftest* | ||
963 | echo 'int dummy;' > conftest.cc | ||
964 | 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 | ||
966 | dnl Test the number of error output lines, because AIX xlC accepts the | ||
967 | dnl option '-Wno-error', just to produce a warning | ||
968 | dnl "Option -Wno-error was incorrectly specified. The option will be ignored." | ||
969 | dnl afterwards. | ||
970 | if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then | ||
971 | gl_cv_cxx_wallow='-Wno-error' | ||
972 | else | ||
973 | gl_cv_cxx_wallow=none | ||
974 | fi | ||
975 | rm -f conftest* | ||
976 | ]) | ||
977 | case "$gl_cv_cxx_wallow" in | ||
978 | none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; | ||
979 | *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; | ||
980 | esac | ||
981 | else | ||
982 | GL_CXXFLAG_ALLOW_WARNINGS='' | ||
983 | fi | ||
984 | AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS]) | ||
985 | ]) | ||
986 | |||
987 | # gl_CC_GNULIB_WARNINGS | ||
988 | # sets and substitutes a variable GL_CFLAG_GNULIB_WARNINGS, to a $(CC) option | ||
989 | # set that enables or disables warnings as suitable for the Gnulib coding style. | ||
990 | AC_DEFUN([gl_CC_GNULIB_WARNINGS], | ||
991 | [ | ||
992 | AC_REQUIRE([gl_CC_ALLOW_WARNINGS]) | ||
993 | dnl Assume that the compiler supports -Wno-* options only if it also supports | ||
994 | dnl -Wno-error. | ||
995 | GL_CFLAG_GNULIB_WARNINGS='' | ||
996 | if test -n "$GL_CFLAG_ALLOW_WARNINGS"; then | ||
997 | dnl Enable these warning options: | ||
998 | dnl | ||
999 | dnl GCC clang | ||
1000 | dnl -Wno-cast-qual >= 3 >= 3.9 | ||
1001 | dnl -Wno-conversion >= 3 >= 3.9 | ||
1002 | dnl -Wno-float-conversion >= 4.9 >= 3.9 | ||
1003 | dnl -Wno-float-equal >= 3 >= 3.9 | ||
1004 | dnl -Wimplicit-fallthrough >= 7 >= 3.9 | ||
1005 | dnl -Wno-pedantic >= 4.8 >= 3.9 | ||
1006 | dnl -Wno-sign-compare >= 3 >= 3.9 | ||
1007 | dnl -Wno-sign-conversion >= 4.3 >= 3.9 | ||
1008 | dnl -Wno-type-limits >= 4.3 >= 3.9 | ||
1009 | dnl -Wno-undef >= 3 >= 3.9 | ||
1010 | dnl -Wno-unsuffixed-float-constants >= 4.5 | ||
1011 | dnl -Wno-unused-function >= 3 >= 3.9 | ||
1012 | dnl -Wno-unused-parameter >= 3 >= 3.9 | ||
1013 | dnl | ||
1014 | cat > conftest.c <<\EOF | ||
1015 | #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | ||
1016 | -Wno-cast-qual | ||
1017 | -Wno-conversion | ||
1018 | -Wno-float-equal | ||
1019 | -Wno-sign-compare | ||
1020 | -Wno-undef | ||
1021 | -Wno-unused-function | ||
1022 | -Wno-unused-parameter | ||
1023 | #endif | ||
1024 | #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | ||
1025 | -Wno-float-conversion | ||
1026 | #endif | ||
1027 | #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | ||
1028 | -Wimplicit-fallthrough | ||
1029 | #endif | ||
1030 | #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | ||
1031 | -Wno-pedantic | ||
1032 | #endif | ||
1033 | #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) | ||
1034 | -Wno-sign-conversion | ||
1035 | -Wno-type-limits | ||
1036 | #endif | ||
1037 | #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 | ||
1038 | -Wno-unsuffixed-float-constants | ||
1039 | #endif | ||
1040 | EOF | ||
1041 | gl_command="$CC $CFLAGS $CPPFLAGS -E conftest.c > conftest.out" | ||
1042 | if AC_TRY_EVAL([gl_command]); then | ||
1043 | gl_options=`grep -v '#' conftest.out` | ||
1044 | for word in $gl_options; do | ||
1045 | GL_CFLAG_GNULIB_WARNINGS="$GL_CFLAG_GNULIB_WARNINGS $word" | ||
1046 | done | ||
1047 | fi | ||
1048 | rm -f conftest.c conftest.out | ||
1049 | fi | ||
1050 | AC_SUBST([GL_CFLAG_GNULIB_WARNINGS]) | ||
1051 | ]) | ||
1052 | |||
1053 | dnl gl_CONDITIONAL_HEADER([foo.h]) | ||
1054 | dnl takes a shell variable GL_GENERATE_FOO_H (with value true or false) as input | ||
1055 | dnl and produces | ||
1056 | dnl - an AC_SUBSTed variable FOO_H that is either a file name or empty, based | ||
1057 | dnl on whether GL_GENERATE_FOO_H is true or false, | ||
1058 | dnl - an Automake conditional GL_GENERATE_FOO_H that evaluates to the value of | ||
1059 | dnl the shell variable GL_GENERATE_FOO_H. | ||
1060 | AC_DEFUN([gl_CONDITIONAL_HEADER], | ||
1061 | [ | ||
1062 | m4_pushdef([gl_header_name], AS_TR_SH(m4_toupper($1))) | ||
1063 | m4_pushdef([gl_generate_var], [GL_GENERATE_]AS_TR_SH(m4_toupper($1))) | ||
1064 | m4_pushdef([gl_generate_cond], [GL_GENERATE_]AS_TR_SH(m4_toupper($1))) | ||
1065 | case "$gl_generate_var" in | ||
1066 | false) gl_header_name='' ;; | ||
1067 | true) | ||
1068 | dnl It is OK to use a .h file in lib/ from within tests/, but not vice | ||
1069 | dnl versa. | ||
1070 | if test -z "$gl_header_name"; then | ||
1071 | gl_header_name="${gl_source_base_prefix}$1" | ||
1072 | fi | ||
1073 | ;; | ||
1074 | *) echo "*** gl_generate_var is not set correctly" 1>&2; exit 1 ;; | ||
1075 | esac | ||
1076 | AC_SUBST(gl_header_name) | ||
1077 | gl_CONDITIONAL(gl_generate_cond, [$gl_generate_var]) | ||
1078 | m4_popdef([gl_generate_cond]) | ||
1079 | m4_popdef([gl_generate_var]) | ||
1080 | m4_popdef([gl_header_name]) | ||
1081 | ]) | ||
1082 | |||
1083 | 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 | ||
1085 | dnl actual function names. With this macro, these function names are available | ||
1086 | dnl without linking with '-loldnames' and without generating warnings. | ||
1087 | dnl Usage: Use it after all system header files are included. | ||
1088 | dnl #include <...> | ||
1089 | dnl #include <...> | ||
1090 | dnl ]GL_MDA_DEFINES[ | ||
1091 | dnl ... | ||
1092 | AC_DEFUN([GL_MDA_DEFINES],[ | ||
1093 | AC_REQUIRE([_GL_MDA_DEFINES]) | ||
1094 | [$gl_mda_defines] | ||
1095 | ]) | ||
1096 | AC_DEFUN([_GL_MDA_DEFINES], | ||
1097 | [gl_mda_defines=' | ||
1098 | #if defined _WIN32 && !defined __CYGWIN__ | ||
1099 | #define access _access | ||
1100 | #define chdir _chdir | ||
1101 | #define chmod _chmod | ||
1102 | #define close _close | ||
1103 | #define creat _creat | ||
1104 | #define dup _dup | ||
1105 | #define dup2 _dup2 | ||
1106 | #define ecvt _ecvt | ||
1107 | #define execl _execl | ||
1108 | #define execle _execle | ||
1109 | #define execlp _execlp | ||
1110 | #define execv _execv | ||
1111 | #define execve _execve | ||
1112 | #define execvp _execvp | ||
1113 | #define execvpe _execvpe | ||
1114 | #define fcloseall _fcloseall | ||
1115 | #define fcvt _fcvt | ||
1116 | #define fdopen _fdopen | ||
1117 | #define fileno _fileno | ||
1118 | #define gcvt _gcvt | ||
1119 | #define getcwd _getcwd | ||
1120 | #define getpid _getpid | ||
1121 | #define getw _getw | ||
1122 | #define isatty _isatty | ||
1123 | #define j0 _j0 | ||
1124 | #define j1 _j1 | ||
1125 | #define jn _jn | ||
1126 | #define lfind _lfind | ||
1127 | #define lsearch _lsearch | ||
1128 | #define lseek _lseek | ||
1129 | #define memccpy _memccpy | ||
1130 | #define mkdir _mkdir | ||
1131 | #define mktemp _mktemp | ||
1132 | #define open _open | ||
1133 | #define putenv _putenv | ||
1134 | #define putw _putw | ||
1135 | #define read _read | ||
1136 | #define rmdir _rmdir | ||
1137 | #define strdup _strdup | ||
1138 | #define swab _swab | ||
1139 | #define tempnam _tempnam | ||
1140 | #define tzset _tzset | ||
1141 | #define umask _umask | ||
1142 | #define unlink _unlink | ||
1143 | #define utime _utime | ||
1144 | #define wcsdup _wcsdup | ||
1145 | #define write _write | ||
1146 | #define y0 _y0 | ||
1147 | #define y1 _y1 | ||
1148 | #define yn _yn | ||
1149 | #endif | ||
1150 | ' | ||
377 | ]) | 1151 | ]) |
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 9a4f502..644b916 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 | |||
@@ -1,9 +1,9 @@ | |||
1 | # DO NOT EDIT! GENERATED AUTOMATICALLY! | 1 | # DO NOT EDIT! GENERATED AUTOMATICALLY! |
2 | # Copyright (C) 2002-2013 Free Software Foundation, Inc. | 2 | # Copyright (C) 2002-2023 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 |
6 | # the Free Software Foundation; either version 3 of the License, or | 6 | # the Free Software Foundation, either version 3 of the License, or |
7 | # (at your option) any later version. | 7 | # (at your option) any later version. |
8 | # | 8 | # |
9 | # This file is distributed in the hope that it will be useful, | 9 | # This file is distributed in the hope that it will be useful, |
@@ -12,7 +12,7 @@ | |||
12 | # GNU General Public License for more details. | 12 | # GNU General Public License for more details. |
13 | # | 13 | # |
14 | # You should have received a copy of the GNU General Public License | 14 | # You should have received a copy of the GNU General Public License |
15 | # along with this file. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with this file. If not, see <https://www.gnu.org/licenses/>. |
16 | # | 16 | # |
17 | # As a special exception to the GNU General Public License, | 17 | # As a special exception to the GNU General Public License, |
18 | # this file may be distributed as part of a program that | 18 | # this file may be distributed as part of a program that |
@@ -37,50 +37,93 @@ AC_DEFUN([gl_EARLY], | |||
37 | m4_pattern_allow([^gl_ES$])dnl a valid locale name | 37 | m4_pattern_allow([^gl_ES$])dnl a valid locale name |
38 | m4_pattern_allow([^gl_LIBOBJS$])dnl a variable | 38 | m4_pattern_allow([^gl_LIBOBJS$])dnl a variable |
39 | m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable | 39 | m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable |
40 | |||
41 | # Pre-early section. | ||
42 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
40 | AC_REQUIRE([gl_PROG_AR_RANLIB]) | 43 | AC_REQUIRE([gl_PROG_AR_RANLIB]) |
41 | AC_REQUIRE([AM_PROG_CC_C_O]) | 44 | |
45 | # Code from module absolute-header: | ||
42 | # Code from module alloca-opt: | 46 | # Code from module alloca-opt: |
43 | # Code from module arpa_inet: | 47 | # Code from module arpa_inet: |
48 | # Code from module assert-h: | ||
49 | # Code from module attribute: | ||
44 | # Code from module base64: | 50 | # Code from module base64: |
51 | # Code from module basename-lgpl: | ||
45 | # Code from module btowc: | 52 | # Code from module btowc: |
46 | # Code from module configmake: | 53 | # Code from module builtin-expect: |
54 | # Code from module byteswap: | ||
55 | # Code from module c99: | ||
56 | # Code from module calloc-gnu: | ||
57 | # Code from module calloc-posix: | ||
58 | # Code from module cloexec: | ||
59 | # Code from module close: | ||
60 | # Code from module crypto/af_alg: | ||
47 | # Code from module crypto/sha1: | 61 | # Code from module crypto/sha1: |
62 | # Code from module crypto/sha1-buffer: | ||
48 | # Code from module dirname: | 63 | # Code from module dirname: |
49 | # Code from module dirname-lgpl: | 64 | # Code from module dirname-lgpl: |
50 | # Code from module dosname: | ||
51 | # Code from module double-slash-root: | 65 | # Code from module double-slash-root: |
66 | # Code from module dup2: | ||
52 | # Code from module environ: | 67 | # Code from module environ: |
53 | # Code from module errno: | 68 | # Code from module errno: |
54 | # Code from module error: | 69 | # Code from module error: |
55 | # Code from module exitfail: | 70 | # Code from module exitfail: |
56 | # Code from module extensions: | 71 | # Code from module extensions: |
57 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
58 | # Code from module extern-inline: | 72 | # Code from module extern-inline: |
73 | # Code from module fcntl: | ||
74 | # Code from module fcntl-h: | ||
59 | # Code from module fd-hook: | 75 | # Code from module fd-hook: |
76 | # Code from module fflush: | ||
77 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) | ||
78 | # Code from module filename: | ||
60 | # Code from module float: | 79 | # Code from module float: |
61 | # Code from module floorf: | 80 | # Code from module floorf: |
81 | # Code from module fopen: | ||
82 | # Code from module fopen-gnu: | ||
83 | # Code from module fpurge: | ||
84 | # Code from module freading: | ||
85 | # Code from module free-posix: | ||
86 | # Code from module fseek: | ||
87 | # Code from module fseeko: | ||
88 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) | ||
89 | # Code from module fstat: | ||
62 | # Code from module fsusage: | 90 | # Code from module fsusage: |
63 | # Code from module full-read: | 91 | # Code from module ftell: |
92 | # Code from module ftello: | ||
93 | AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) | ||
94 | # Code from module gen-header: | ||
64 | # Code from module getaddrinfo: | 95 | # Code from module getaddrinfo: |
96 | # Code from module getdelim: | ||
97 | # Code from module getdtablesize: | ||
65 | # Code from module gethostname: | 98 | # Code from module gethostname: |
99 | # Code from module getline: | ||
66 | # Code from module getloadavg: | 100 | # Code from module getloadavg: |
67 | # Code from module getopt-gnu: | 101 | # Code from module getopt-gnu: |
68 | # Code from module getopt-posix: | 102 | # Code from module getopt-posix: |
103 | # Code from module getprogname: | ||
69 | # Code from module gettext: | 104 | # Code from module gettext: |
70 | # Code from module gettext-h: | 105 | # Code from module gettext-h: |
106 | # Code from module glibc-internal/dynarray: | ||
107 | # Code from module hard-locale: | ||
71 | # Code from module havelib: | 108 | # Code from module havelib: |
72 | # Code from module hostent: | 109 | # Code from module hostent: |
110 | # Code from module ialloc: | ||
73 | # Code from module idpriv-droptemp: | 111 | # Code from module idpriv-droptemp: |
112 | # Code from module idx: | ||
74 | # Code from module include_next: | 113 | # Code from module include_next: |
75 | # Code from module inet_ntop: | 114 | # Code from module inet_ntop: |
76 | # Code from module intprops: | 115 | # Code from module intprops: |
116 | # Code from module inttypes-incomplete: | ||
77 | # Code from module langinfo: | 117 | # Code from module langinfo: |
78 | # Code from module largefile: | 118 | # Code from module largefile: |
79 | AC_REQUIRE([AC_SYS_LARGEFILE]) | 119 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
120 | # Code from module libc-config: | ||
121 | # Code from module limits-h: | ||
80 | # Code from module localcharset: | 122 | # Code from module localcharset: |
81 | # Code from module locale: | 123 | # Code from module locale: |
82 | # Code from module localeconv: | 124 | # Code from module localeconv: |
83 | # Code from module lock: | 125 | # Code from module lock: |
126 | # Code from module lseek: | ||
84 | # Code from module malloc-gnu: | 127 | # Code from module malloc-gnu: |
85 | # Code from module malloc-posix: | 128 | # Code from module malloc-posix: |
86 | # Code from module malloca: | 129 | # Code from module malloca: |
@@ -89,6 +132,7 @@ AC_DEFUN([gl_EARLY], | |||
89 | # Code from module mbsinit: | 132 | # Code from module mbsinit: |
90 | # Code from module mbtowc: | 133 | # Code from module mbtowc: |
91 | # Code from module memchr: | 134 | # Code from module memchr: |
135 | # Code from module minmax: | ||
92 | # Code from module mktime: | 136 | # Code from module mktime: |
93 | # Code from module mktime-internal: | 137 | # Code from module mktime-internal: |
94 | # Code from module mountlist: | 138 | # Code from module mountlist: |
@@ -99,11 +143,15 @@ AC_DEFUN([gl_EARLY], | |||
99 | # Code from module netinet_in: | 143 | # Code from module netinet_in: |
100 | # Code from module nl_langinfo: | 144 | # Code from module nl_langinfo: |
101 | # Code from module nocrash: | 145 | # Code from module nocrash: |
102 | # Code from module read: | 146 | # Code from module open: |
147 | # Code from module pathmax: | ||
148 | # Code from module realloc-gnu: | ||
149 | # Code from module realloc-posix: | ||
150 | # Code from module reallocarray: | ||
103 | # Code from module regex: | 151 | # Code from module regex: |
104 | # Code from module safe-read: | ||
105 | # Code from module servent: | 152 | # Code from module servent: |
106 | # Code from module setenv: | 153 | # Code from module setenv: |
154 | # Code from module setlocale-null: | ||
107 | # Code from module size_max: | 155 | # Code from module size_max: |
108 | # Code from module snippet/_Noreturn: | 156 | # Code from module snippet/_Noreturn: |
109 | # Code from module snippet/arg-nonnull: | 157 | # Code from module snippet/arg-nonnull: |
@@ -114,8 +162,12 @@ AC_DEFUN([gl_EARLY], | |||
114 | # Code from module sockets: | 162 | # Code from module sockets: |
115 | # Code from module socklen: | 163 | # Code from module socklen: |
116 | # Code from module ssize_t: | 164 | # Code from module ssize_t: |
165 | # Code from module stat: | ||
166 | # Code from module stat-time: | ||
167 | # Code from module std-gnu11: | ||
117 | # Code from module stdalign: | 168 | # Code from module stdalign: |
118 | # Code from module stdbool: | 169 | # Code from module stdbool: |
170 | # Code from module stdckdint: | ||
119 | # Code from module stddef: | 171 | # Code from module stddef: |
120 | # Code from module stdint: | 172 | # Code from module stdint: |
121 | # Code from module stdio: | 173 | # Code from module stdio: |
@@ -128,11 +180,10 @@ AC_DEFUN([gl_EARLY], | |||
128 | # Code from module strerror-override: | 180 | # Code from module strerror-override: |
129 | # Code from module string: | 181 | # Code from module string: |
130 | # Code from module strings: | 182 | # Code from module strings: |
131 | # Code from module strndup: | ||
132 | # Code from module strnlen: | ||
133 | # Code from module strsep: | 183 | # Code from module strsep: |
134 | # Code from module strstr-simple: | 184 | # Code from module strstr-simple: |
135 | # Code from module sys_socket: | 185 | # Code from module sys_socket: |
186 | # Code from module sys_stat: | ||
136 | # Code from module sys_types: | 187 | # Code from module sys_types: |
137 | # Code from module sys_uio: | 188 | # Code from module sys_uio: |
138 | # Code from module threadlib: | 189 | # Code from module threadlib: |
@@ -141,7 +192,9 @@ AC_DEFUN([gl_EARLY], | |||
141 | # Code from module time_r: | 192 | # Code from module time_r: |
142 | # Code from module timegm: | 193 | # Code from module timegm: |
143 | # Code from module unistd: | 194 | # Code from module unistd: |
195 | # Code from module unlocked-io-internal: | ||
144 | # Code from module unsetenv: | 196 | # Code from module unsetenv: |
197 | # Code from module vararrays: | ||
145 | # Code from module vasnprintf: | 198 | # Code from module vasnprintf: |
146 | # Code from module vasprintf: | 199 | # Code from module vasprintf: |
147 | # Code from module verify: | 200 | # Code from module verify: |
@@ -149,11 +202,14 @@ AC_DEFUN([gl_EARLY], | |||
149 | # Code from module wchar: | 202 | # Code from module wchar: |
150 | # Code from module wcrtomb: | 203 | # Code from module wcrtomb: |
151 | # Code from module wctype-h: | 204 | # Code from module wctype-h: |
205 | # Code from module windows-mutex: | ||
206 | # Code from module windows-once: | ||
207 | # Code from module windows-recmutex: | ||
208 | # Code from module windows-rwlock: | ||
152 | # Code from module xalloc: | 209 | # Code from module xalloc: |
153 | # Code from module xalloc-die: | 210 | # Code from module xalloc-die: |
154 | # Code from module xalloc-oversized: | 211 | # Code from module xalloc-oversized: |
155 | # Code from module xsize: | 212 | # Code from module xsize: |
156 | # Code from module xstrndup: | ||
157 | ]) | 213 | ]) |
158 | 214 | ||
159 | # This macro should be invoked from ./configure.ac, in the section | 215 | # This macro should be invoked from ./configure.ac, in the section |
@@ -170,154 +226,303 @@ AC_DEFUN([gl_INIT], | |||
170 | m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) | 226 | m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) |
171 | m4_pushdef([gl_LIBSOURCES_LIST], []) | 227 | m4_pushdef([gl_LIBSOURCES_LIST], []) |
172 | m4_pushdef([gl_LIBSOURCES_DIR], []) | 228 | m4_pushdef([gl_LIBSOURCES_DIR], []) |
229 | m4_pushdef([GL_MACRO_PREFIX], [gl]) | ||
230 | m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) | ||
173 | gl_COMMON | 231 | gl_COMMON |
174 | gl_source_base='gl' | 232 | gl_source_base='gl' |
233 | gl_source_base_prefix= | ||
175 | gl_FUNC_ALLOCA | 234 | gl_FUNC_ALLOCA |
176 | gl_HEADER_ARPA_INET | 235 | gl_CONDITIONAL_HEADER([alloca.h]) |
236 | AC_PROG_MKDIR_P | ||
237 | gl_ARPA_INET_H | ||
238 | gl_ARPA_INET_H_REQUIRE_DEFAULTS | ||
239 | AC_PROG_MKDIR_P | ||
240 | gl_ASSERT_H | ||
241 | gl_CONDITIONAL_HEADER([assert.h]) | ||
177 | AC_PROG_MKDIR_P | 242 | AC_PROG_MKDIR_P |
178 | gl_FUNC_BASE64 | 243 | gl_FUNC_BASE64 |
179 | gl_FUNC_BTOWC | 244 | gl_FUNC_BTOWC |
180 | if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then | 245 | gl_CONDITIONAL([GL_COND_OBJ_BTOWC], |
181 | AC_LIBOBJ([btowc]) | 246 | [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) |
247 | AM_COND_IF([GL_COND_OBJ_BTOWC], [ | ||
182 | gl_PREREQ_BTOWC | 248 | gl_PREREQ_BTOWC |
183 | fi | 249 | ]) |
184 | gl_WCHAR_MODULE_INDICATOR([btowc]) | 250 | gl_WCHAR_MODULE_INDICATOR([btowc]) |
185 | gl_CONFIGMAKE_PREP | 251 | gl___BUILTIN_EXPECT |
252 | gl_BYTESWAP | ||
253 | gl_CONDITIONAL_HEADER([byteswap.h]) | ||
254 | AC_PROG_MKDIR_P | ||
255 | gl_FUNC_CALLOC_GNU | ||
256 | if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then | ||
257 | AC_LIBOBJ([calloc]) | ||
258 | fi | ||
259 | gl_STDLIB_MODULE_INDICATOR([calloc-gnu]) | ||
260 | gl_FUNC_CALLOC_POSIX | ||
261 | if test $REPLACE_CALLOC_FOR_CALLOC_POSIX = 1; then | ||
262 | AC_LIBOBJ([calloc]) | ||
263 | fi | ||
264 | gl_STDLIB_MODULE_INDICATOR([calloc-posix]) | ||
265 | gl_MODULE_INDICATOR_FOR_TESTS([cloexec]) | ||
266 | gl_FUNC_CLOSE | ||
267 | gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) | ||
268 | gl_UNISTD_MODULE_INDICATOR([close]) | ||
269 | gl_AF_ALG | ||
270 | AC_REQUIRE([AC_C_RESTRICT]) | ||
186 | gl_SHA1 | 271 | gl_SHA1 |
187 | gl_DIRNAME | ||
188 | gl_MODULE_INDICATOR([dirname]) | 272 | gl_MODULE_INDICATOR([dirname]) |
189 | gl_DIRNAME_LGPL | ||
190 | gl_DOUBLE_SLASH_ROOT | 273 | gl_DOUBLE_SLASH_ROOT |
274 | gl_FUNC_DUP2 | ||
275 | gl_CONDITIONAL([GL_COND_OBJ_DUP2], [test $REPLACE_DUP2 = 1]) | ||
276 | AM_COND_IF([GL_COND_OBJ_DUP2], [ | ||
277 | gl_PREREQ_DUP2 | ||
278 | ]) | ||
279 | gl_UNISTD_MODULE_INDICATOR([dup2]) | ||
191 | gl_ENVIRON | 280 | gl_ENVIRON |
192 | gl_UNISTD_MODULE_INDICATOR([environ]) | 281 | gl_UNISTD_MODULE_INDICATOR([environ]) |
193 | gl_HEADER_ERRNO_H | 282 | gl_HEADER_ERRNO_H |
283 | gl_CONDITIONAL_HEADER([errno.h]) | ||
284 | AC_PROG_MKDIR_P | ||
194 | gl_ERROR | 285 | gl_ERROR |
195 | if test $ac_cv_lib_error_at_line = no; then | 286 | gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test "$ac_cv_lib_error_at_line" = no]) |
196 | AC_LIBOBJ([error]) | 287 | AM_COND_IF([GL_COND_OBJ_ERROR], [ |
197 | gl_PREREQ_ERROR | 288 | gl_PREREQ_ERROR |
198 | fi | 289 | ]) |
199 | m4_ifdef([AM_XGETTEXT_OPTION], | 290 | m4_ifdef([AM_XGETTEXT_OPTION], |
200 | [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) | 291 | [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) |
201 | AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) | 292 | AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) |
202 | AC_REQUIRE([gl_EXTERN_INLINE]) | 293 | AC_REQUIRE([gl_EXTERN_INLINE]) |
294 | gl_FUNC_FCNTL | ||
295 | gl_CONDITIONAL([GL_COND_OBJ_FCNTL], | ||
296 | [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1]) | ||
297 | gl_FCNTL_MODULE_INDICATOR([fcntl]) | ||
298 | gl_FCNTL_H | ||
299 | gl_FCNTL_H_REQUIRE_DEFAULTS | ||
300 | AC_PROG_MKDIR_P | ||
301 | gl_FUNC_FFLUSH | ||
302 | gl_CONDITIONAL([GL_COND_OBJ_FFLUSH], [test $REPLACE_FFLUSH = 1]) | ||
303 | AM_COND_IF([GL_COND_OBJ_FFLUSH], [ | ||
304 | gl_PREREQ_FFLUSH | ||
305 | ]) | ||
306 | gl_MODULE_INDICATOR([fflush]) | ||
307 | gl_STDIO_MODULE_INDICATOR([fflush]) | ||
203 | gl_FLOAT_H | 308 | gl_FLOAT_H |
204 | if test $REPLACE_FLOAT_LDBL = 1; then | 309 | gl_CONDITIONAL_HEADER([float.h]) |
205 | AC_LIBOBJ([float]) | 310 | AC_PROG_MKDIR_P |
206 | fi | 311 | gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) |
207 | if test $REPLACE_ITOLD = 1; then | 312 | gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) |
208 | AC_LIBOBJ([itold]) | ||
209 | fi | ||
210 | gl_FUNC_FLOORF | 313 | gl_FUNC_FLOORF |
211 | if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then | 314 | gl_CONDITIONAL([GL_COND_OBJ_FLOORF], |
212 | AC_LIBOBJ([floorf]) | 315 | [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) |
213 | fi | ||
214 | gl_MATH_MODULE_INDICATOR([floorf]) | 316 | gl_MATH_MODULE_INDICATOR([floorf]) |
317 | gl_FUNC_FOPEN | ||
318 | if test $REPLACE_FOPEN = 1; then | ||
319 | AC_LIBOBJ([fopen]) | ||
320 | gl_PREREQ_FOPEN | ||
321 | fi | ||
322 | gl_STDIO_MODULE_INDICATOR([fopen]) | ||
323 | gl_FUNC_FOPEN_GNU | ||
324 | if test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1; then | ||
325 | AC_LIBOBJ([fopen]) | ||
326 | gl_PREREQ_FOPEN | ||
327 | fi | ||
328 | gl_MODULE_INDICATOR([fopen-gnu]) | ||
329 | gl_STDIO_MODULE_INDICATOR([fopen-gnu]) | ||
330 | gl_FUNC_FPURGE | ||
331 | gl_CONDITIONAL([GL_COND_OBJ_FPURGE], | ||
332 | [test $HAVE_FPURGE = 0 || test $REPLACE_FPURGE = 1]) | ||
333 | gl_STDIO_MODULE_INDICATOR([fpurge]) | ||
334 | gl_FUNC_FREADING | ||
335 | gl_FUNC_FREE | ||
336 | gl_CONDITIONAL([GL_COND_OBJ_FREE], [test $REPLACE_FREE = 1]) | ||
337 | AM_COND_IF([GL_COND_OBJ_FREE], [ | ||
338 | gl_PREREQ_FREE | ||
339 | ]) | ||
340 | gl_STDLIB_MODULE_INDICATOR([free-posix]) | ||
341 | gl_FUNC_FSEEK | ||
342 | gl_CONDITIONAL([GL_COND_OBJ_FSEEK], [test $REPLACE_FSEEK = 1]) | ||
343 | gl_STDIO_MODULE_INDICATOR([fseek]) | ||
344 | gl_FUNC_FSEEKO | ||
345 | gl_CONDITIONAL([GL_COND_OBJ_FSEEKO], | ||
346 | [test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1]) | ||
347 | AM_COND_IF([GL_COND_OBJ_FSEEKO], [ | ||
348 | gl_PREREQ_FSEEKO | ||
349 | ]) | ||
350 | gl_STDIO_MODULE_INDICATOR([fseeko]) | ||
351 | gl_FUNC_FSTAT | ||
352 | gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) | ||
353 | AM_COND_IF([GL_COND_OBJ_FSTAT], [ | ||
354 | case "$host_os" in | ||
355 | mingw*) | ||
356 | AC_LIBOBJ([stat-w32]) | ||
357 | ;; | ||
358 | esac | ||
359 | gl_PREREQ_FSTAT | ||
360 | ]) | ||
361 | gl_SYS_STAT_MODULE_INDICATOR([fstat]) | ||
215 | gl_FSUSAGE | 362 | gl_FSUSAGE |
216 | if test $gl_cv_fs_space = yes; then | 363 | gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) |
217 | AC_LIBOBJ([fsusage]) | 364 | AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ |
218 | gl_PREREQ_FSUSAGE_EXTRA | 365 | gl_PREREQ_FSUSAGE_EXTRA |
219 | fi | 366 | ]) |
367 | gl_FUNC_FTELL | ||
368 | gl_CONDITIONAL([GL_COND_OBJ_FTELL], [test $REPLACE_FTELL = 1]) | ||
369 | gl_STDIO_MODULE_INDICATOR([ftell]) | ||
370 | gl_FUNC_FTELLO | ||
371 | gl_CONDITIONAL([GL_COND_OBJ_FTELLO], | ||
372 | [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1]) | ||
373 | AM_COND_IF([GL_COND_OBJ_FTELLO], [ | ||
374 | gl_PREREQ_FTELLO | ||
375 | ]) | ||
376 | gl_STDIO_MODULE_INDICATOR([ftello]) | ||
220 | gl_GETADDRINFO | 377 | gl_GETADDRINFO |
221 | if test $HAVE_GETADDRINFO = 0; then | 378 | gl_CONDITIONAL([GL_COND_OBJ_GETADDRINFO], |
222 | AC_LIBOBJ([getaddrinfo]) | 379 | [test $HAVE_GETADDRINFO = 0 || test $REPLACE_GETADDRINFO = 1]) |
223 | fi | 380 | gl_CONDITIONAL([GL_COND_OBJ_GAI_STRERROR], |
224 | if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then | 381 | [test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1]) |
225 | AC_LIBOBJ([gai_strerror]) | ||
226 | fi | ||
227 | gl_NETDB_MODULE_INDICATOR([getaddrinfo]) | 382 | gl_NETDB_MODULE_INDICATOR([getaddrinfo]) |
383 | gl_FUNC_GETDELIM | ||
384 | gl_CONDITIONAL([GL_COND_OBJ_GETDELIM], | ||
385 | [test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1]) | ||
386 | AM_COND_IF([GL_COND_OBJ_GETDELIM], [ | ||
387 | gl_PREREQ_GETDELIM | ||
388 | ]) | ||
389 | gl_STDIO_MODULE_INDICATOR([getdelim]) | ||
390 | gl_FUNC_GETDTABLESIZE | ||
391 | gl_CONDITIONAL([GL_COND_OBJ_GETDTABLESIZE], | ||
392 | [test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1]) | ||
393 | AM_COND_IF([GL_COND_OBJ_GETDTABLESIZE], [ | ||
394 | gl_PREREQ_GETDTABLESIZE | ||
395 | ]) | ||
396 | gl_UNISTD_MODULE_INDICATOR([getdtablesize]) | ||
228 | gl_FUNC_GETHOSTNAME | 397 | gl_FUNC_GETHOSTNAME |
229 | if test $HAVE_GETHOSTNAME = 0; then | 398 | gl_CONDITIONAL([GL_COND_OBJ_GETHOSTNAME], [test $HAVE_GETHOSTNAME = 0]) |
230 | AC_LIBOBJ([gethostname]) | 399 | AM_COND_IF([GL_COND_OBJ_GETHOSTNAME], [ |
231 | gl_PREREQ_GETHOSTNAME | 400 | gl_PREREQ_GETHOSTNAME |
232 | fi | 401 | ]) |
233 | gl_UNISTD_MODULE_INDICATOR([gethostname]) | 402 | gl_UNISTD_MODULE_INDICATOR([gethostname]) |
403 | gl_FUNC_GETLINE | ||
404 | gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) | ||
405 | AM_COND_IF([GL_COND_OBJ_GETLINE], [ | ||
406 | gl_PREREQ_GETLINE | ||
407 | ]) | ||
408 | gl_STDIO_MODULE_INDICATOR([getline]) | ||
409 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
234 | gl_GETLOADAVG | 410 | gl_GETLOADAVG |
235 | if test $HAVE_GETLOADAVG = 0; then | 411 | gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0]) |
236 | AC_LIBOBJ([getloadavg]) | 412 | AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [ |
237 | gl_PREREQ_GETLOADAVG | 413 | gl_PREREQ_GETLOADAVG |
238 | fi | 414 | ]) |
239 | gl_STDLIB_MODULE_INDICATOR([getloadavg]) | 415 | gl_STDLIB_MODULE_INDICATOR([getloadavg]) |
240 | gl_FUNC_GETOPT_GNU | 416 | gl_FUNC_GETOPT_GNU |
241 | if test $REPLACE_GETOPT = 1; then | 417 | dnl Because of the way gl_FUNC_GETOPT_GNU is implemented (the gl_getopt_required |
242 | AC_LIBOBJ([getopt]) | 418 | dnl mechanism), there is no need to do any AC_LIBOBJ or AC_SUBST here; they are |
243 | AC_LIBOBJ([getopt1]) | 419 | dnl done in the getopt-posix module. |
244 | gl_PREREQ_GETOPT | ||
245 | dnl Arrange for unistd.h to include getopt.h. | ||
246 | GNULIB_GL_UNISTD_H_GETOPT=1 | ||
247 | fi | ||
248 | AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) | ||
249 | gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) | ||
250 | gl_FUNC_GETOPT_POSIX | 420 | gl_FUNC_GETOPT_POSIX |
251 | if test $REPLACE_GETOPT = 1; then | 421 | gl_CONDITIONAL_HEADER([getopt.h]) |
252 | AC_LIBOBJ([getopt]) | 422 | gl_CONDITIONAL_HEADER([getopt-cdefs.h]) |
253 | AC_LIBOBJ([getopt1]) | 423 | AC_PROG_MKDIR_P |
254 | gl_PREREQ_GETOPT | 424 | gl_CONDITIONAL([GL_COND_OBJ_GETOPT], [test $REPLACE_GETOPT = 1]) |
255 | dnl Arrange for unistd.h to include getopt.h. | 425 | AM_COND_IF([GL_COND_OBJ_GETOPT], [ |
256 | GNULIB_GL_UNISTD_H_GETOPT=1 | 426 | dnl Define the substituted variable GNULIB_UNISTD_H_GETOPT to 1. |
257 | fi | 427 | gl_UNISTD_H_REQUIRE_DEFAULTS |
258 | AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) | 428 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) |
429 | ]) | ||
430 | gl_UNISTD_MODULE_INDICATOR([getopt-posix]) | ||
431 | gl_FUNC_GETPROGNAME | ||
259 | dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. | 432 | dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. |
260 | AM_GNU_GETTEXT_VERSION([0.18.1]) | 433 | AM_GNU_GETTEXT_VERSION([0.20]) |
261 | AC_SUBST([LIBINTL]) | 434 | AC_SUBST([LIBINTL]) |
262 | AC_SUBST([LTLIBINTL]) | 435 | AC_SUBST([LTLIBINTL]) |
436 | AC_PROG_MKDIR_P | ||
437 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) | ||
438 | LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" | ||
439 | AC_SUBST([LIB_HARD_LOCALE]) | ||
440 | AC_DEFUN([gl_HAVE_MODULE_HAVELIB]) | ||
263 | gl_HOSTENT | 441 | gl_HOSTENT |
264 | gl_IDPRIV | 442 | gl_IDPRIV |
265 | gl_FUNC_INET_NTOP | 443 | gl_FUNC_INET_NTOP |
266 | if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then | 444 | gl_CONDITIONAL([GL_COND_OBJ_INET_NTOP], |
267 | AC_LIBOBJ([inet_ntop]) | 445 | [test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1]) |
446 | AM_COND_IF([GL_COND_OBJ_INET_NTOP], [ | ||
268 | gl_PREREQ_INET_NTOP | 447 | gl_PREREQ_INET_NTOP |
269 | fi | 448 | ]) |
270 | gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) | 449 | gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) |
450 | gl_INTTYPES_INCOMPLETE | ||
451 | gl_INTTYPES_H_REQUIRE_DEFAULTS | ||
452 | AC_PROG_MKDIR_P | ||
271 | gl_LANGINFO_H | 453 | gl_LANGINFO_H |
454 | gl_LANGINFO_H_REQUIRE_DEFAULTS | ||
455 | AC_PROG_MKDIR_P | ||
272 | AC_REQUIRE([gl_LARGEFILE]) | 456 | AC_REQUIRE([gl_LARGEFILE]) |
457 | gl___INLINE | ||
458 | gl_LIMITS_H | ||
459 | gl_CONDITIONAL_HEADER([limits.h]) | ||
460 | AC_PROG_MKDIR_P | ||
273 | gl_LOCALCHARSET | 461 | gl_LOCALCHARSET |
274 | LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" | 462 | dnl For backward compatibility. Some packages still use this. |
463 | LOCALCHARSET_TESTS_ENVIRONMENT= | ||
275 | AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) | 464 | AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) |
276 | gl_LOCALE_H | 465 | gl_LOCALE_H |
466 | gl_LOCALE_H_REQUIRE_DEFAULTS | ||
467 | AC_PROG_MKDIR_P | ||
277 | gl_FUNC_LOCALECONV | 468 | gl_FUNC_LOCALECONV |
278 | if test $REPLACE_LOCALECONV = 1; then | 469 | gl_CONDITIONAL([GL_COND_OBJ_LOCALECONV], [test $REPLACE_LOCALECONV = 1]) |
279 | AC_LIBOBJ([localeconv]) | 470 | AM_COND_IF([GL_COND_OBJ_LOCALECONV], [ |
280 | gl_PREREQ_LOCALECONV | 471 | gl_PREREQ_LOCALECONV |
281 | fi | 472 | ]) |
282 | gl_LOCALE_MODULE_INDICATOR([localeconv]) | 473 | gl_LOCALE_MODULE_INDICATOR([localeconv]) |
283 | gl_LOCK | 474 | gl_LOCK |
284 | gl_MODULE_INDICATOR([lock]) | 475 | gl_MODULE_INDICATOR([lock]) |
476 | gl_FUNC_LSEEK | ||
477 | gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) | ||
478 | gl_UNISTD_MODULE_INDICATOR([lseek]) | ||
285 | gl_FUNC_MALLOC_GNU | 479 | gl_FUNC_MALLOC_GNU |
286 | if test $REPLACE_MALLOC = 1; then | 480 | if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then |
287 | AC_LIBOBJ([malloc]) | 481 | AC_LIBOBJ([malloc]) |
288 | fi | 482 | fi |
289 | gl_MODULE_INDICATOR([malloc-gnu]) | 483 | gl_STDLIB_MODULE_INDICATOR([malloc-gnu]) |
290 | gl_FUNC_MALLOC_POSIX | 484 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) |
291 | if test $REPLACE_MALLOC = 1; then | 485 | if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then |
292 | AC_LIBOBJ([malloc]) | 486 | AC_LIBOBJ([malloc]) |
293 | fi | 487 | fi |
294 | gl_STDLIB_MODULE_INDICATOR([malloc-posix]) | 488 | gl_STDLIB_MODULE_INDICATOR([malloc-posix]) |
295 | gl_MALLOCA | 489 | gl_MALLOCA |
296 | gl_MATH_H | 490 | gl_MATH_H |
491 | gl_MATH_H_REQUIRE_DEFAULTS | ||
492 | AC_PROG_MKDIR_P | ||
297 | gl_FUNC_MBRTOWC | 493 | gl_FUNC_MBRTOWC |
298 | if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then | 494 | gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], |
299 | AC_LIBOBJ([mbrtowc]) | 495 | [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) |
496 | AM_COND_IF([GL_COND_OBJ_MBRTOWC], [ | ||
497 | if test $REPLACE_MBSTATE_T = 1; then | ||
498 | AC_LIBOBJ([lc-charset-dispatch]) | ||
499 | AC_LIBOBJ([mbtowc-lock]) | ||
500 | gl_PREREQ_MBTOWC_LOCK | ||
501 | fi | ||
300 | gl_PREREQ_MBRTOWC | 502 | gl_PREREQ_MBRTOWC |
301 | fi | 503 | ]) |
302 | gl_WCHAR_MODULE_INDICATOR([mbrtowc]) | 504 | gl_WCHAR_MODULE_INDICATOR([mbrtowc]) |
303 | gl_FUNC_MBSINIT | 505 | gl_FUNC_MBSINIT |
304 | if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then | 506 | gl_CONDITIONAL([GL_COND_OBJ_MBSINIT], |
305 | AC_LIBOBJ([mbsinit]) | 507 | [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1]) |
508 | AM_COND_IF([GL_COND_OBJ_MBSINIT], [ | ||
306 | gl_PREREQ_MBSINIT | 509 | gl_PREREQ_MBSINIT |
307 | fi | 510 | ]) |
308 | gl_WCHAR_MODULE_INDICATOR([mbsinit]) | 511 | gl_WCHAR_MODULE_INDICATOR([mbsinit]) |
309 | gl_FUNC_MBTOWC | 512 | gl_FUNC_MBTOWC |
310 | if test $REPLACE_MBTOWC = 1; then | 513 | gl_CONDITIONAL([GL_COND_OBJ_MBTOWC], |
311 | AC_LIBOBJ([mbtowc]) | 514 | [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]) |
515 | AM_COND_IF([GL_COND_OBJ_MBTOWC], [ | ||
312 | gl_PREREQ_MBTOWC | 516 | gl_PREREQ_MBTOWC |
313 | fi | 517 | ]) |
314 | gl_STDLIB_MODULE_INDICATOR([mbtowc]) | 518 | gl_STDLIB_MODULE_INDICATOR([mbtowc]) |
315 | gl_FUNC_MEMCHR | 519 | gl_FUNC_MEMCHR |
316 | if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then | 520 | gl_CONDITIONAL([GL_COND_OBJ_MEMCHR], [test $REPLACE_MEMCHR = 1]) |
317 | AC_LIBOBJ([memchr]) | 521 | AM_COND_IF([GL_COND_OBJ_MEMCHR], [ |
318 | gl_PREREQ_MEMCHR | 522 | gl_PREREQ_MEMCHR |
319 | fi | 523 | ]) |
320 | gl_STRING_MODULE_INDICATOR([memchr]) | 524 | gl_STRING_MODULE_INDICATOR([memchr]) |
525 | gl_MINMAX | ||
321 | gl_FUNC_MKTIME | 526 | gl_FUNC_MKTIME |
322 | if test $REPLACE_MKTIME = 1; then | 527 | if test $REPLACE_MKTIME = 1; then |
323 | AC_LIBOBJ([mktime]) | 528 | AC_LIBOBJ([mktime]) |
@@ -325,73 +530,162 @@ AC_DEFUN([gl_INIT], | |||
325 | fi | 530 | fi |
326 | gl_TIME_MODULE_INDICATOR([mktime]) | 531 | gl_TIME_MODULE_INDICATOR([mktime]) |
327 | gl_FUNC_MKTIME_INTERNAL | 532 | gl_FUNC_MKTIME_INTERNAL |
328 | if test $REPLACE_MKTIME = 1; then | 533 | if test $WANT_MKTIME_INTERNAL = 1; then |
329 | AC_LIBOBJ([mktime]) | 534 | AC_LIBOBJ([mktime]) |
330 | gl_PREREQ_MKTIME | 535 | gl_PREREQ_MKTIME |
331 | fi | 536 | fi |
332 | gl_MOUNTLIST | 537 | gl_MOUNTLIST |
333 | if test $gl_cv_list_mounted_fs = yes; then | 538 | gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) |
334 | AC_LIBOBJ([mountlist]) | 539 | AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [ |
335 | gl_PREREQ_MOUNTLIST_EXTRA | 540 | gl_PREREQ_MOUNTLIST_EXTRA |
336 | fi | 541 | ]) |
337 | gl_MSVC_INVAL | 542 | AC_REQUIRE([gl_MSVC_INVAL]) |
338 | if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then | 543 | gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], |
339 | AC_LIBOBJ([msvc-inval]) | 544 | [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) |
340 | fi | 545 | AC_REQUIRE([gl_MSVC_NOTHROW]) |
341 | gl_MSVC_NOTHROW | 546 | gl_CONDITIONAL([GL_COND_OBJ_MSVC_NOTHROW], |
342 | if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then | 547 | [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) |
343 | AC_LIBOBJ([msvc-nothrow]) | 548 | gl_MODULE_INDICATOR([msvc-nothrow]) |
344 | fi | ||
345 | gl_MULTIARCH | 549 | gl_MULTIARCH |
346 | gl_HEADER_NETDB | 550 | gl_NETDB_H |
551 | gl_NETDB_H_REQUIRE_DEFAULTS | ||
552 | AC_PROG_MKDIR_P | ||
347 | gl_HEADER_NETINET_IN | 553 | gl_HEADER_NETINET_IN |
554 | gl_CONDITIONAL_HEADER([netinet/in.h]) | ||
348 | AC_PROG_MKDIR_P | 555 | AC_PROG_MKDIR_P |
349 | gl_FUNC_NL_LANGINFO | 556 | gl_FUNC_NL_LANGINFO |
350 | if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then | 557 | gl_CONDITIONAL([GL_COND_OBJ_NL_LANGINFO], |
351 | AC_LIBOBJ([nl_langinfo]) | 558 | [test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1]) |
559 | gl_CONDITIONAL([GL_COND_OBJ_NL_LANGINFO_LOCK], | ||
560 | [test $REPLACE_NL_LANGINFO = 1 && test $NL_LANGINFO_MTSAFE = 0]) | ||
561 | if test $REPLACE_NL_LANGINFO = 1 && test $NL_LANGINFO_MTSAFE = 0; then | ||
562 | gl_PREREQ_NL_LANGINFO_LOCK | ||
352 | fi | 563 | fi |
353 | gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) | 564 | gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) |
354 | gl_FUNC_READ | 565 | gl_FUNC_OPEN |
355 | if test $REPLACE_READ = 1; then | 566 | gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) |
356 | AC_LIBOBJ([read]) | 567 | AM_COND_IF([GL_COND_OBJ_OPEN], [ |
357 | gl_PREREQ_READ | 568 | gl_PREREQ_OPEN |
569 | ]) | ||
570 | gl_FCNTL_MODULE_INDICATOR([open]) | ||
571 | gl_PATHMAX | ||
572 | gl_FUNC_REALLOC_GNU | ||
573 | if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then | ||
574 | AC_LIBOBJ([realloc]) | ||
575 | fi | ||
576 | gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) | ||
577 | gl_FUNC_REALLOC_POSIX | ||
578 | if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then | ||
579 | AC_LIBOBJ([realloc]) | ||
358 | fi | 580 | fi |
359 | gl_UNISTD_MODULE_INDICATOR([read]) | 581 | gl_STDLIB_MODULE_INDICATOR([realloc-posix]) |
582 | gl_FUNC_REALLOCARRAY | ||
583 | gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], | ||
584 | [test $HAVE_REALLOCARRAY = 0 || test $REPLACE_REALLOCARRAY = 1]) | ||
585 | AM_COND_IF([GL_COND_OBJ_REALLOCARRAY], [ | ||
586 | gl_PREREQ_REALLOCARRAY | ||
587 | ]) | ||
588 | gl_MODULE_INDICATOR([reallocarray]) | ||
589 | gl_STDLIB_MODULE_INDICATOR([reallocarray]) | ||
360 | gl_REGEX | 590 | gl_REGEX |
361 | if test $ac_use_included_regex = yes; then | 591 | gl_CONDITIONAL([GL_COND_OBJ_REGEX], [test $ac_use_included_regex = yes]) |
362 | AC_LIBOBJ([regex]) | 592 | AM_COND_IF([GL_COND_OBJ_REGEX], [ |
363 | gl_PREREQ_REGEX | 593 | gl_PREREQ_REGEX |
364 | fi | 594 | ]) |
365 | gl_PREREQ_SAFE_READ | ||
366 | gl_SERVENT | 595 | gl_SERVENT |
367 | gl_FUNC_SETENV | 596 | gl_FUNC_SETENV |
368 | if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then | 597 | gl_CONDITIONAL([GL_COND_OBJ_SETENV], |
369 | AC_LIBOBJ([setenv]) | 598 | [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1]) |
370 | fi | ||
371 | gl_STDLIB_MODULE_INDICATOR([setenv]) | 599 | gl_STDLIB_MODULE_INDICATOR([setenv]) |
600 | gl_FUNC_SETLOCALE_NULL | ||
601 | gl_CONDITIONAL([GL_COND_OBJ_SETLOCALE_LOCK], | ||
602 | [test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0]) | ||
603 | AM_COND_IF([GL_COND_OBJ_SETLOCALE_LOCK], [ | ||
604 | gl_PREREQ_SETLOCALE_LOCK | ||
605 | ]) | ||
606 | gl_LOCALE_MODULE_INDICATOR([setlocale_null]) | ||
372 | gl_SIZE_MAX | 607 | gl_SIZE_MAX |
373 | gl_FUNC_SNPRINTF | 608 | gl_FUNC_SNPRINTF |
374 | gl_STDIO_MODULE_INDICATOR([snprintf]) | 609 | gl_STDIO_MODULE_INDICATOR([snprintf]) |
375 | gl_MODULE_INDICATOR([snprintf]) | 610 | gl_MODULE_INDICATOR([snprintf]) |
376 | gl_SOCKETLIB | 611 | AC_REQUIRE([gl_SOCKETLIB]) |
377 | gl_SOCKETS | 612 | AC_REQUIRE([gl_SOCKETS]) |
378 | gl_TYPE_SOCKLEN_T | 613 | gl_TYPE_SOCKLEN_T |
379 | gt_TYPE_SSIZE_T | 614 | gt_TYPE_SSIZE_T |
615 | gl_FUNC_STAT | ||
616 | gl_CONDITIONAL([GL_COND_OBJ_STAT], [test $REPLACE_STAT = 1]) | ||
617 | AM_COND_IF([GL_COND_OBJ_STAT], [ | ||
618 | case "$host_os" in | ||
619 | mingw*) | ||
620 | AC_LIBOBJ([stat-w32]) | ||
621 | ;; | ||
622 | esac | ||
623 | gl_PREREQ_STAT | ||
624 | ]) | ||
625 | gl_SYS_STAT_MODULE_INDICATOR([stat]) | ||
626 | gl_STAT_TIME | ||
627 | gl_STAT_BIRTHTIME | ||
380 | gl_STDALIGN_H | 628 | gl_STDALIGN_H |
381 | AM_STDBOOL_H | 629 | gl_CONDITIONAL_HEADER([stdalign.h]) |
630 | AC_PROG_MKDIR_P | ||
631 | gl_C_BOOL | ||
632 | AC_CHECK_HEADERS_ONCE([stdckdint.h]) | ||
633 | if test $ac_cv_header_stdckdint_h = yes; then | ||
634 | GL_GENERATE_STDCKDINT_H=false | ||
635 | else | ||
636 | GL_GENERATE_STDCKDINT_H=true | ||
637 | fi | ||
638 | gl_CONDITIONAL_HEADER([stdckdint.h]) | ||
639 | AC_PROG_MKDIR_P | ||
382 | gl_STDDEF_H | 640 | gl_STDDEF_H |
641 | gl_STDDEF_H_REQUIRE_DEFAULTS | ||
642 | gl_CONDITIONAL_HEADER([stddef.h]) | ||
643 | AC_PROG_MKDIR_P | ||
383 | gl_STDINT_H | 644 | gl_STDINT_H |
645 | gl_CONDITIONAL_HEADER([stdint.h]) | ||
646 | dnl Because of gl_REPLACE_LIMITS_H: | ||
647 | gl_CONDITIONAL_HEADER([limits.h]) | ||
648 | AC_PROG_MKDIR_P | ||
384 | gl_STDIO_H | 649 | gl_STDIO_H |
650 | gl_STDIO_H_REQUIRE_DEFAULTS | ||
651 | AC_PROG_MKDIR_P | ||
652 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) | ||
653 | gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) | ||
654 | dnl No need to create extra modules for these functions. Everyone who uses | ||
655 | dnl <stdio.h> likely needs them. | ||
656 | gl_STDIO_MODULE_INDICATOR([fscanf]) | ||
657 | gl_MODULE_INDICATOR([fscanf]) | ||
658 | gl_STDIO_MODULE_INDICATOR([scanf]) | ||
659 | gl_MODULE_INDICATOR([scanf]) | ||
660 | gl_STDIO_MODULE_INDICATOR([fgetc]) | ||
661 | gl_STDIO_MODULE_INDICATOR([getc]) | ||
662 | gl_STDIO_MODULE_INDICATOR([getchar]) | ||
663 | gl_STDIO_MODULE_INDICATOR([fgets]) | ||
664 | gl_STDIO_MODULE_INDICATOR([fread]) | ||
665 | dnl No need to create extra modules for these functions. Everyone who uses | ||
666 | dnl <stdio.h> likely needs them. | ||
667 | gl_STDIO_MODULE_INDICATOR([fprintf]) | ||
668 | gl_STDIO_MODULE_INDICATOR([printf]) | ||
669 | gl_STDIO_MODULE_INDICATOR([vfprintf]) | ||
670 | gl_STDIO_MODULE_INDICATOR([vprintf]) | ||
671 | gl_STDIO_MODULE_INDICATOR([fputc]) | ||
672 | gl_STDIO_MODULE_INDICATOR([putc]) | ||
673 | gl_STDIO_MODULE_INDICATOR([putchar]) | ||
674 | gl_STDIO_MODULE_INDICATOR([fputs]) | ||
675 | gl_STDIO_MODULE_INDICATOR([puts]) | ||
676 | gl_STDIO_MODULE_INDICATOR([fwrite]) | ||
385 | gl_STDLIB_H | 677 | gl_STDLIB_H |
678 | gl_STDLIB_H_REQUIRE_DEFAULTS | ||
679 | AC_PROG_MKDIR_P | ||
386 | gl_STRCASE | 680 | gl_STRCASE |
387 | if test $HAVE_STRCASECMP = 0; then | 681 | gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) |
388 | AC_LIBOBJ([strcasecmp]) | 682 | AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ |
389 | gl_PREREQ_STRCASECMP | 683 | gl_PREREQ_STRCASECMP |
390 | fi | 684 | ]) |
391 | if test $HAVE_STRNCASECMP = 0; then | 685 | gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) |
392 | AC_LIBOBJ([strncasecmp]) | 686 | AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ |
393 | gl_PREREQ_STRNCASECMP | 687 | gl_PREREQ_STRNCASECMP |
394 | fi | 688 | ]) |
395 | gl_FUNC_STRCASESTR | 689 | gl_FUNC_STRCASESTR |
396 | if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then | 690 | if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then |
397 | AC_LIBOBJ([strcasestr]) | 691 | AC_LIBOBJ([strcasestr]) |
@@ -404,68 +698,76 @@ AC_DEFUN([gl_INIT], | |||
404 | fi | 698 | fi |
405 | gl_STRING_MODULE_INDICATOR([strcasestr]) | 699 | gl_STRING_MODULE_INDICATOR([strcasestr]) |
406 | gl_FUNC_STRERROR | 700 | gl_FUNC_STRERROR |
407 | if test $REPLACE_STRERROR = 1; then | 701 | gl_CONDITIONAL([GL_COND_OBJ_STRERROR], [test $REPLACE_STRERROR = 1]) |
408 | AC_LIBOBJ([strerror]) | ||
409 | fi | ||
410 | gl_MODULE_INDICATOR([strerror]) | 702 | gl_MODULE_INDICATOR([strerror]) |
411 | gl_STRING_MODULE_INDICATOR([strerror]) | 703 | gl_STRING_MODULE_INDICATOR([strerror]) |
412 | AC_REQUIRE([gl_HEADER_ERRNO_H]) | 704 | AC_REQUIRE([gl_HEADER_ERRNO_H]) |
413 | AC_REQUIRE([gl_FUNC_STRERROR_0]) | 705 | AC_REQUIRE([gl_FUNC_STRERROR_0]) |
414 | if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then | 706 | gl_CONDITIONAL([GL_COND_OBJ_STRERROR_OVERRIDE], |
415 | AC_LIBOBJ([strerror-override]) | 707 | [test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1]) |
708 | AM_COND_IF([GL_COND_OBJ_STRERROR_OVERRIDE], [ | ||
416 | gl_PREREQ_SYS_H_WINSOCK2 | 709 | gl_PREREQ_SYS_H_WINSOCK2 |
417 | fi | 710 | ]) |
418 | gl_HEADER_STRING_H | 711 | gl_STRING_H |
419 | gl_HEADER_STRINGS_H | 712 | gl_STRING_H_REQUIRE_DEFAULTS |
420 | gl_FUNC_STRNDUP | 713 | AC_PROG_MKDIR_P |
421 | if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then | 714 | gl_STRINGS_H |
422 | AC_LIBOBJ([strndup]) | 715 | gl_STRINGS_H_REQUIRE_DEFAULTS |
423 | fi | 716 | AC_PROG_MKDIR_P |
424 | gl_STRING_MODULE_INDICATOR([strndup]) | ||
425 | gl_FUNC_STRNLEN | ||
426 | if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then | ||
427 | AC_LIBOBJ([strnlen]) | ||
428 | gl_PREREQ_STRNLEN | ||
429 | fi | ||
430 | gl_STRING_MODULE_INDICATOR([strnlen]) | ||
431 | gl_FUNC_STRSEP | 717 | gl_FUNC_STRSEP |
432 | if test $HAVE_STRSEP = 0; then | 718 | gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) |
433 | AC_LIBOBJ([strsep]) | 719 | AM_COND_IF([GL_COND_OBJ_STRSEP], [ |
434 | gl_PREREQ_STRSEP | 720 | gl_PREREQ_STRSEP |
435 | fi | 721 | ]) |
436 | gl_STRING_MODULE_INDICATOR([strsep]) | 722 | gl_STRING_MODULE_INDICATOR([strsep]) |
437 | gl_FUNC_STRSTR_SIMPLE | 723 | gl_FUNC_STRSTR_SIMPLE |
438 | if test $REPLACE_STRSTR = 1; then | 724 | if test $REPLACE_STRSTR = 1; then |
439 | AC_LIBOBJ([strstr]) | 725 | AC_LIBOBJ([strstr]) |
440 | fi | 726 | fi |
441 | gl_STRING_MODULE_INDICATOR([strstr]) | 727 | gl_STRING_MODULE_INDICATOR([strstr]) |
442 | gl_HEADER_SYS_SOCKET | 728 | gl_SYS_SOCKET_H |
729 | gl_SYS_SOCKET_H_REQUIRE_DEFAULTS | ||
730 | AC_PROG_MKDIR_P | ||
731 | gl_SYS_STAT_H | ||
732 | gl_SYS_STAT_H_REQUIRE_DEFAULTS | ||
443 | AC_PROG_MKDIR_P | 733 | AC_PROG_MKDIR_P |
444 | gl_SYS_TYPES_H | 734 | gl_SYS_TYPES_H |
735 | gl_SYS_TYPES_H_REQUIRE_DEFAULTS | ||
736 | AC_PROG_MKDIR_P | ||
737 | gl_SYS_UIO_H | ||
738 | gl_SYS_UIO_H_REQUIRE_DEFAULTS | ||
445 | AC_PROG_MKDIR_P | 739 | AC_PROG_MKDIR_P |
446 | gl_HEADER_SYS_UIO | 740 | AC_REQUIRE([gl_THREADLIB]) |
741 | gl_TIME_H | ||
742 | gl_TIME_H_REQUIRE_DEFAULTS | ||
447 | AC_PROG_MKDIR_P | 743 | AC_PROG_MKDIR_P |
448 | gl_THREADLIB | ||
449 | gl_HEADER_TIME_H | ||
450 | gl_TIME_R | 744 | gl_TIME_R |
451 | if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then | 745 | gl_CONDITIONAL([GL_COND_OBJ_TIME_R], |
452 | AC_LIBOBJ([time_r]) | 746 | [test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1]) |
747 | AM_COND_IF([GL_COND_OBJ_TIME_R], [ | ||
453 | gl_PREREQ_TIME_R | 748 | gl_PREREQ_TIME_R |
454 | fi | 749 | ]) |
455 | gl_TIME_MODULE_INDICATOR([time_r]) | 750 | gl_TIME_MODULE_INDICATOR([time_r]) |
456 | gl_FUNC_TIMEGM | 751 | gl_FUNC_TIMEGM |
457 | if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then | 752 | gl_CONDITIONAL([GL_COND_OBJ_TIMEGM], |
458 | AC_LIBOBJ([timegm]) | 753 | [test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1]) |
754 | AM_COND_IF([GL_COND_OBJ_TIMEGM], [ | ||
459 | gl_PREREQ_TIMEGM | 755 | gl_PREREQ_TIMEGM |
460 | fi | 756 | ]) |
461 | gl_TIME_MODULE_INDICATOR([timegm]) | 757 | gl_TIME_MODULE_INDICATOR([timegm]) |
462 | gl_UNISTD_H | 758 | gl_UNISTD_H |
759 | gl_UNISTD_H_REQUIRE_DEFAULTS | ||
760 | AC_PROG_MKDIR_P | ||
761 | gl_FUNC_GLIBC_UNLOCKED_IO | ||
463 | gl_FUNC_UNSETENV | 762 | gl_FUNC_UNSETENV |
464 | if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then | 763 | gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], |
465 | AC_LIBOBJ([unsetenv]) | 764 | [test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1]) |
765 | AM_COND_IF([GL_COND_OBJ_UNSETENV], [ | ||
466 | gl_PREREQ_UNSETENV | 766 | gl_PREREQ_UNSETENV |
467 | fi | 767 | ]) |
468 | gl_STDLIB_MODULE_INDICATOR([unsetenv]) | 768 | gl_STDLIB_MODULE_INDICATOR([unsetenv]) |
769 | AC_C_VARARRAYS | ||
770 | AC_REQUIRE([AC_C_RESTRICT]) | ||
469 | gl_FUNC_VASNPRINTF | 771 | gl_FUNC_VASNPRINTF |
470 | gl_FUNC_VASPRINTF | 772 | gl_FUNC_VASPRINTF |
471 | gl_STDIO_MODULE_INDICATOR([vasprintf]) | 773 | gl_STDIO_MODULE_INDICATOR([vasprintf]) |
@@ -475,16 +777,34 @@ AC_DEFUN([gl_INIT], | |||
475 | gl_FUNC_VSNPRINTF | 777 | gl_FUNC_VSNPRINTF |
476 | gl_STDIO_MODULE_INDICATOR([vsnprintf]) | 778 | gl_STDIO_MODULE_INDICATOR([vsnprintf]) |
477 | gl_WCHAR_H | 779 | gl_WCHAR_H |
780 | gl_WCHAR_H_REQUIRE_DEFAULTS | ||
781 | AC_PROG_MKDIR_P | ||
478 | gl_FUNC_WCRTOMB | 782 | gl_FUNC_WCRTOMB |
479 | if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then | 783 | gl_CONDITIONAL([GL_COND_OBJ_WCRTOMB], |
480 | AC_LIBOBJ([wcrtomb]) | 784 | [test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1]) |
785 | AM_COND_IF([GL_COND_OBJ_WCRTOMB], [ | ||
481 | gl_PREREQ_WCRTOMB | 786 | gl_PREREQ_WCRTOMB |
482 | fi | 787 | ]) |
483 | gl_WCHAR_MODULE_INDICATOR([wcrtomb]) | 788 | gl_WCHAR_MODULE_INDICATOR([wcrtomb]) |
484 | gl_WCTYPE_H | 789 | gl_WCTYPE_H |
790 | gl_WCTYPE_H_REQUIRE_DEFAULTS | ||
791 | AC_PROG_MKDIR_P | ||
792 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
793 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], | ||
794 | [case "$host_os" in mingw*) true;; *) false;; esac]) | ||
795 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
796 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_ONCE], | ||
797 | [case "$host_os" in mingw*) true;; *) false;; esac]) | ||
798 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
799 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RECMUTEX], | ||
800 | [case "$host_os" in mingw*) true;; *) false;; esac]) | ||
801 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
802 | gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RWLOCK], | ||
803 | [case "$host_os" in mingw*) true;; *) false;; esac]) | ||
485 | gl_XALLOC | 804 | gl_XALLOC |
805 | gl_MODULE_INDICATOR([xalloc]) | ||
806 | gl_MODULE_INDICATOR([xalloc-die]) | ||
486 | gl_XSIZE | 807 | gl_XSIZE |
487 | gl_XSTRNDUP | ||
488 | # End of code from modules | 808 | # End of code from modules |
489 | m4_ifval(gl_LIBSOURCES_LIST, [ | 809 | m4_ifval(gl_LIBSOURCES_LIST, [ |
490 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || | 810 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || |
@@ -497,6 +817,8 @@ AC_DEFUN([gl_INIT], | |||
497 | m4_if(m4_sysval, [0], [], | 817 | m4_if(m4_sysval, [0], [], |
498 | [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) | 818 | [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) |
499 | ]) | 819 | ]) |
820 | m4_popdef([GL_MODULE_INDICATOR_PREFIX]) | ||
821 | m4_popdef([GL_MACRO_PREFIX]) | ||
500 | m4_popdef([gl_LIBSOURCES_DIR]) | 822 | m4_popdef([gl_LIBSOURCES_DIR]) |
501 | m4_popdef([gl_LIBSOURCES_LIST]) | 823 | m4_popdef([gl_LIBSOURCES_LIST]) |
502 | m4_popdef([AC_LIBSOURCES]) | 824 | m4_popdef([AC_LIBSOURCES]) |
@@ -505,16 +827,28 @@ AC_DEFUN([gl_INIT], | |||
505 | AC_CONFIG_COMMANDS_PRE([ | 827 | AC_CONFIG_COMMANDS_PRE([ |
506 | gl_libobjs= | 828 | gl_libobjs= |
507 | gl_ltlibobjs= | 829 | gl_ltlibobjs= |
830 | gl_libobjdeps= | ||
508 | if test -n "$gl_LIBOBJS"; then | 831 | if test -n "$gl_LIBOBJS"; then |
509 | # Remove the extension. | 832 | # Remove the extension. |
833 | changequote(,)dnl | ||
510 | sed_drop_objext='s/\.o$//;s/\.obj$//' | 834 | sed_drop_objext='s/\.o$//;s/\.obj$//' |
835 | sed_dirname1='s,//*,/,g' | ||
836 | sed_dirname2='s,\(.\)/$,\1,' | ||
837 | sed_dirname3='s,^[^/]*$,.,' | ||
838 | sed_dirname4='s,\(.\)/[^/]*$,\1,' | ||
839 | sed_basename1='s,.*/,,' | ||
840 | changequote([, ])dnl | ||
511 | for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do | 841 | for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do |
512 | gl_libobjs="$gl_libobjs $i.$ac_objext" | 842 | gl_libobjs="$gl_libobjs $i.$ac_objext" |
513 | gl_ltlibobjs="$gl_ltlibobjs $i.lo" | 843 | gl_ltlibobjs="$gl_ltlibobjs $i.lo" |
844 | i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` | ||
845 | i_base=`echo "$i" | sed -e "$sed_basename1"` | ||
846 | gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" | ||
514 | done | 847 | done |
515 | fi | 848 | fi |
516 | AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) | 849 | AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) |
517 | AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) | 850 | AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) |
851 | AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) | ||
518 | ]) | 852 | ]) |
519 | gltests_libdeps= | 853 | gltests_libdeps= |
520 | gltests_ltlibdeps= | 854 | gltests_ltlibdeps= |
@@ -523,8 +857,11 @@ AC_DEFUN([gl_INIT], | |||
523 | m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) | 857 | m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) |
524 | m4_pushdef([gltests_LIBSOURCES_LIST], []) | 858 | m4_pushdef([gltests_LIBSOURCES_LIST], []) |
525 | m4_pushdef([gltests_LIBSOURCES_DIR], []) | 859 | m4_pushdef([gltests_LIBSOURCES_DIR], []) |
860 | m4_pushdef([GL_MACRO_PREFIX], [gltests]) | ||
861 | m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) | ||
526 | gl_COMMON | 862 | gl_COMMON |
527 | gl_source_base='tests' | 863 | gl_source_base='tests' |
864 | gl_source_base_prefix= | ||
528 | changequote(,)dnl | 865 | changequote(,)dnl |
529 | gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS | 866 | gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS |
530 | changequote([, ])dnl | 867 | changequote([, ])dnl |
@@ -543,6 +880,8 @@ changequote([, ])dnl | |||
543 | m4_if(m4_sysval, [0], [], | 880 | m4_if(m4_sysval, [0], [], |
544 | [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) | 881 | [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) |
545 | ]) | 882 | ]) |
883 | m4_popdef([GL_MODULE_INDICATOR_PREFIX]) | ||
884 | m4_popdef([GL_MACRO_PREFIX]) | ||
546 | m4_popdef([gltests_LIBSOURCES_DIR]) | 885 | m4_popdef([gltests_LIBSOURCES_DIR]) |
547 | m4_popdef([gltests_LIBSOURCES_LIST]) | 886 | m4_popdef([gltests_LIBSOURCES_LIST]) |
548 | m4_popdef([AC_LIBSOURCES]) | 887 | m4_popdef([AC_LIBSOURCES]) |
@@ -551,17 +890,30 @@ changequote([, ])dnl | |||
551 | AC_CONFIG_COMMANDS_PRE([ | 890 | AC_CONFIG_COMMANDS_PRE([ |
552 | gltests_libobjs= | 891 | gltests_libobjs= |
553 | gltests_ltlibobjs= | 892 | gltests_ltlibobjs= |
893 | gltests_libobjdeps= | ||
554 | if test -n "$gltests_LIBOBJS"; then | 894 | if test -n "$gltests_LIBOBJS"; then |
555 | # Remove the extension. | 895 | # Remove the extension. |
896 | changequote(,)dnl | ||
556 | sed_drop_objext='s/\.o$//;s/\.obj$//' | 897 | sed_drop_objext='s/\.o$//;s/\.obj$//' |
898 | sed_dirname1='s,//*,/,g' | ||
899 | sed_dirname2='s,\(.\)/$,\1,' | ||
900 | sed_dirname3='s,^[^/]*$,.,' | ||
901 | sed_dirname4='s,\(.\)/[^/]*$,\1,' | ||
902 | sed_basename1='s,.*/,,' | ||
903 | changequote([, ])dnl | ||
557 | for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do | 904 | for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do |
558 | gltests_libobjs="$gltests_libobjs $i.$ac_objext" | 905 | gltests_libobjs="$gltests_libobjs $i.$ac_objext" |
559 | gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" | 906 | gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" |
907 | i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` | ||
908 | i_base=`echo "$i" | sed -e "$sed_basename1"` | ||
909 | gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" | ||
560 | done | 910 | done |
561 | fi | 911 | fi |
562 | AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) | 912 | AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) |
563 | AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) | 913 | AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) |
914 | AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) | ||
564 | ]) | 915 | ]) |
916 | AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) | ||
565 | LIBGNU_LIBDEPS="$gl_libdeps" | 917 | LIBGNU_LIBDEPS="$gl_libdeps" |
566 | AC_SUBST([LIBGNU_LIBDEPS]) | 918 | AC_SUBST([LIBGNU_LIBDEPS]) |
567 | LIBGNU_LTLIBDEPS="$gl_ltlibdeps" | 919 | LIBGNU_LTLIBDEPS="$gl_ltlibdeps" |
@@ -626,75 +978,130 @@ AC_DEFUN([gltests_LIBSOURCES], [ | |||
626 | # gnulib-tool and may be removed by future gnulib-tool invocations. | 978 | # gnulib-tool and may be removed by future gnulib-tool invocations. |
627 | AC_DEFUN([gl_FILE_LIST], [ | 979 | AC_DEFUN([gl_FILE_LIST], [ |
628 | build-aux/config.rpath | 980 | build-aux/config.rpath |
629 | build-aux/snippet/_Noreturn.h | 981 | lib/_Noreturn.h |
630 | build-aux/snippet/arg-nonnull.h | 982 | lib/af_alg.c |
631 | build-aux/snippet/c++defs.h | 983 | lib/af_alg.h |
632 | build-aux/snippet/warn-on-use.h | ||
633 | lib/alloca.in.h | 984 | lib/alloca.in.h |
985 | lib/arg-nonnull.h | ||
634 | lib/arpa_inet.in.h | 986 | lib/arpa_inet.in.h |
635 | lib/asnprintf.c | 987 | lib/asnprintf.c |
636 | lib/asprintf.c | 988 | lib/asprintf.c |
989 | lib/assert.in.h | ||
990 | lib/attribute.h | ||
637 | lib/base64.c | 991 | lib/base64.c |
638 | lib/base64.h | 992 | lib/base64.h |
639 | lib/basename-lgpl.c | 993 | lib/basename-lgpl.c |
994 | lib/basename-lgpl.h | ||
640 | lib/basename.c | 995 | lib/basename.c |
641 | lib/btowc.c | 996 | lib/btowc.c |
642 | lib/config.charset | 997 | lib/byteswap.in.h |
998 | lib/c++defs.h | ||
999 | lib/calloc.c | ||
1000 | lib/cdefs.h | ||
1001 | lib/cloexec.c | ||
1002 | lib/cloexec.h | ||
1003 | lib/close.c | ||
643 | lib/dirname-lgpl.c | 1004 | lib/dirname-lgpl.c |
644 | lib/dirname.c | 1005 | lib/dirname.c |
645 | lib/dirname.h | 1006 | lib/dirname.h |
646 | lib/dosname.h | 1007 | lib/dup2.c |
1008 | lib/dynarray.h | ||
647 | lib/errno.in.h | 1009 | lib/errno.in.h |
648 | lib/error.c | 1010 | lib/error.c |
649 | lib/error.h | 1011 | lib/error.h |
650 | lib/exitfail.c | 1012 | lib/exitfail.c |
651 | lib/exitfail.h | 1013 | lib/exitfail.h |
1014 | lib/fcntl.c | ||
1015 | lib/fcntl.in.h | ||
652 | lib/fd-hook.c | 1016 | lib/fd-hook.c |
653 | lib/fd-hook.h | 1017 | lib/fd-hook.h |
1018 | lib/fflush.c | ||
1019 | lib/filename.h | ||
654 | lib/float+.h | 1020 | lib/float+.h |
655 | lib/float.c | 1021 | lib/float.c |
656 | lib/float.in.h | 1022 | lib/float.in.h |
657 | lib/floor.c | 1023 | lib/floor.c |
658 | lib/floorf.c | 1024 | lib/floorf.c |
1025 | lib/fopen.c | ||
1026 | lib/fpurge.c | ||
1027 | lib/freading.c | ||
1028 | lib/freading.h | ||
1029 | lib/free.c | ||
1030 | lib/fseek.c | ||
1031 | lib/fseeko.c | ||
1032 | lib/fstat.c | ||
659 | lib/fsusage.c | 1033 | lib/fsusage.c |
660 | lib/fsusage.h | 1034 | lib/fsusage.h |
661 | lib/full-read.c | 1035 | lib/ftell.c |
662 | lib/full-read.h | 1036 | lib/ftello.c |
663 | lib/full-write.c | ||
664 | lib/gai_strerror.c | 1037 | lib/gai_strerror.c |
665 | lib/getaddrinfo.c | 1038 | lib/getaddrinfo.c |
1039 | lib/getdelim.c | ||
1040 | lib/getdtablesize.c | ||
666 | lib/gethostname.c | 1041 | lib/gethostname.c |
1042 | lib/getline.c | ||
667 | lib/getloadavg.c | 1043 | lib/getloadavg.c |
1044 | lib/getopt-cdefs.in.h | ||
1045 | lib/getopt-core.h | ||
1046 | lib/getopt-ext.h | ||
1047 | lib/getopt-pfx-core.h | ||
1048 | lib/getopt-pfx-ext.h | ||
668 | lib/getopt.c | 1049 | lib/getopt.c |
669 | lib/getopt.in.h | 1050 | lib/getopt.in.h |
670 | lib/getopt1.c | 1051 | lib/getopt1.c |
671 | lib/getopt_int.h | 1052 | lib/getopt_int.h |
1053 | lib/getprogname.c | ||
1054 | lib/getprogname.h | ||
672 | lib/gettext.h | 1055 | lib/gettext.h |
1056 | lib/gl_openssl.h | ||
673 | lib/glthread/lock.c | 1057 | lib/glthread/lock.c |
674 | lib/glthread/lock.h | 1058 | lib/glthread/lock.h |
675 | lib/glthread/threadlib.c | 1059 | lib/glthread/threadlib.c |
1060 | lib/hard-locale.c | ||
1061 | lib/hard-locale.h | ||
1062 | lib/ialloc.c | ||
1063 | lib/ialloc.h | ||
676 | lib/idpriv-droptemp.c | 1064 | lib/idpriv-droptemp.c |
677 | lib/idpriv.h | 1065 | lib/idpriv.h |
1066 | lib/idx.h | ||
678 | lib/inet_ntop.c | 1067 | lib/inet_ntop.c |
1068 | lib/intprops-internal.h | ||
679 | lib/intprops.h | 1069 | lib/intprops.h |
1070 | lib/inttypes.in.h | ||
680 | lib/itold.c | 1071 | lib/itold.c |
681 | lib/langinfo.in.h | 1072 | lib/langinfo.in.h |
1073 | lib/lc-charset-dispatch.c | ||
1074 | lib/lc-charset-dispatch.h | ||
1075 | lib/libc-config.h | ||
1076 | lib/limits.in.h | ||
682 | lib/localcharset.c | 1077 | lib/localcharset.c |
683 | lib/localcharset.h | 1078 | lib/localcharset.h |
684 | lib/locale.in.h | 1079 | lib/locale.in.h |
685 | lib/localeconv.c | 1080 | lib/localeconv.c |
1081 | lib/lseek.c | ||
686 | lib/malloc.c | 1082 | lib/malloc.c |
1083 | lib/malloc/dynarray-skeleton.c | ||
1084 | lib/malloc/dynarray.h | ||
1085 | lib/malloc/dynarray_at_failure.c | ||
1086 | lib/malloc/dynarray_emplace_enlarge.c | ||
1087 | lib/malloc/dynarray_finalize.c | ||
1088 | lib/malloc/dynarray_resize.c | ||
1089 | lib/malloc/dynarray_resize_clear.c | ||
687 | lib/malloca.c | 1090 | lib/malloca.c |
688 | lib/malloca.h | 1091 | lib/malloca.h |
689 | lib/malloca.valgrind | ||
690 | lib/math.c | 1092 | lib/math.c |
691 | lib/math.in.h | 1093 | lib/math.in.h |
1094 | lib/mbrtowc-impl-utf8.h | ||
1095 | lib/mbrtowc-impl.h | ||
692 | lib/mbrtowc.c | 1096 | lib/mbrtowc.c |
693 | lib/mbsinit.c | 1097 | lib/mbsinit.c |
694 | lib/mbtowc-impl.h | 1098 | lib/mbtowc-impl.h |
1099 | lib/mbtowc-lock.c | ||
1100 | lib/mbtowc-lock.h | ||
695 | lib/mbtowc.c | 1101 | lib/mbtowc.c |
696 | lib/memchr.c | 1102 | lib/memchr.c |
697 | lib/memchr.valgrind | 1103 | lib/memchr.valgrind |
1104 | lib/minmax.h | ||
698 | lib/mktime-internal.h | 1105 | lib/mktime-internal.h |
699 | lib/mktime.c | 1106 | lib/mktime.c |
700 | lib/mountlist.c | 1107 | lib/mountlist.c |
@@ -705,33 +1112,45 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
705 | lib/msvc-nothrow.h | 1112 | lib/msvc-nothrow.h |
706 | lib/netdb.in.h | 1113 | lib/netdb.in.h |
707 | lib/netinet_in.in.h | 1114 | lib/netinet_in.in.h |
1115 | lib/nl_langinfo-lock.c | ||
708 | lib/nl_langinfo.c | 1116 | lib/nl_langinfo.c |
1117 | lib/open.c | ||
1118 | lib/pathmax.h | ||
709 | lib/printf-args.c | 1119 | lib/printf-args.c |
710 | lib/printf-args.h | 1120 | lib/printf-args.h |
711 | lib/printf-parse.c | 1121 | lib/printf-parse.c |
712 | lib/printf-parse.h | 1122 | lib/printf-parse.h |
713 | lib/read.c | 1123 | lib/realloc.c |
714 | lib/ref-add.sin | 1124 | lib/reallocarray.c |
715 | lib/ref-del.sin | ||
716 | lib/regcomp.c | 1125 | lib/regcomp.c |
717 | lib/regex.c | 1126 | lib/regex.c |
718 | lib/regex.h | 1127 | lib/regex.h |
719 | lib/regex_internal.c | 1128 | lib/regex_internal.c |
720 | lib/regex_internal.h | 1129 | lib/regex_internal.h |
721 | lib/regexec.c | 1130 | lib/regexec.c |
722 | lib/safe-read.c | ||
723 | lib/safe-read.h | ||
724 | lib/setenv.c | 1131 | lib/setenv.c |
1132 | lib/setlocale-lock.c | ||
1133 | lib/setlocale_null.c | ||
1134 | lib/setlocale_null.h | ||
1135 | lib/sha1-stream.c | ||
725 | lib/sha1.c | 1136 | lib/sha1.c |
726 | lib/sha1.h | 1137 | lib/sha1.h |
727 | lib/size_max.h | 1138 | lib/size_max.h |
728 | lib/snprintf.c | 1139 | lib/snprintf.c |
729 | lib/sockets.c | 1140 | lib/sockets.c |
730 | lib/sockets.h | 1141 | lib/sockets.h |
1142 | lib/stat-time.c | ||
1143 | lib/stat-time.h | ||
1144 | lib/stat-w32.c | ||
1145 | lib/stat-w32.h | ||
1146 | lib/stat.c | ||
731 | lib/stdalign.in.h | 1147 | lib/stdalign.in.h |
732 | lib/stdbool.in.h | 1148 | lib/stdckdint.in.h |
733 | lib/stddef.in.h | 1149 | lib/stddef.in.h |
734 | lib/stdint.in.h | 1150 | lib/stdint.in.h |
1151 | lib/stdio-impl.h | ||
1152 | lib/stdio-read.c | ||
1153 | lib/stdio-write.c | ||
735 | lib/stdio.in.h | 1154 | lib/stdio.in.h |
736 | lib/stdlib.in.h | 1155 | lib/stdlib.in.h |
737 | lib/str-two-way.h | 1156 | lib/str-two-way.h |
@@ -745,12 +1164,12 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
745 | lib/strings.in.h | 1164 | lib/strings.in.h |
746 | lib/stripslash.c | 1165 | lib/stripslash.c |
747 | lib/strncasecmp.c | 1166 | lib/strncasecmp.c |
748 | lib/strndup.c | ||
749 | lib/strnlen.c | ||
750 | lib/strsep.c | 1167 | lib/strsep.c |
751 | lib/strstr.c | 1168 | lib/strstr.c |
1169 | lib/sys-limits.h | ||
752 | lib/sys_socket.c | 1170 | lib/sys_socket.c |
753 | lib/sys_socket.in.h | 1171 | lib/sys_socket.in.h |
1172 | lib/sys_stat.in.h | ||
754 | lib/sys_types.in.h | 1173 | lib/sys_types.in.h |
755 | lib/sys_uio.in.h | 1174 | lib/sys_uio.in.h |
756 | lib/time.in.h | 1175 | lib/time.in.h |
@@ -758,6 +1177,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
758 | lib/timegm.c | 1177 | lib/timegm.c |
759 | lib/unistd.c | 1178 | lib/unistd.c |
760 | lib/unistd.in.h | 1179 | lib/unistd.in.h |
1180 | lib/unlocked-io.h | ||
761 | lib/unsetenv.c | 1181 | lib/unsetenv.c |
762 | lib/vasnprintf.c | 1182 | lib/vasnprintf.c |
763 | lib/vasnprintf.h | 1183 | lib/vasnprintf.h |
@@ -765,27 +1185,43 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
765 | lib/verify.h | 1185 | lib/verify.h |
766 | lib/vsnprintf.c | 1186 | lib/vsnprintf.c |
767 | lib/w32sock.h | 1187 | lib/w32sock.h |
1188 | lib/warn-on-use.h | ||
768 | lib/wchar.in.h | 1189 | lib/wchar.in.h |
769 | lib/wcrtomb.c | 1190 | lib/wcrtomb.c |
770 | lib/wctype-h.c | 1191 | lib/wctype-h.c |
771 | lib/wctype.in.h | 1192 | lib/wctype.in.h |
1193 | lib/windows-initguard.h | ||
1194 | lib/windows-mutex.c | ||
1195 | lib/windows-mutex.h | ||
1196 | lib/windows-once.c | ||
1197 | lib/windows-once.h | ||
1198 | lib/windows-recmutex.c | ||
1199 | lib/windows-recmutex.h | ||
1200 | lib/windows-rwlock.c | ||
1201 | lib/windows-rwlock.h | ||
772 | lib/xalloc-die.c | 1202 | lib/xalloc-die.c |
773 | lib/xalloc-oversized.h | 1203 | lib/xalloc-oversized.h |
774 | lib/xalloc.h | 1204 | lib/xalloc.h |
775 | lib/xmalloc.c | 1205 | lib/xmalloc.c |
776 | lib/xsize.c | 1206 | lib/xsize.c |
777 | lib/xsize.h | 1207 | lib/xsize.h |
778 | lib/xstrndup.c | ||
779 | lib/xstrndup.h | ||
780 | m4/00gnulib.m4 | 1208 | m4/00gnulib.m4 |
1209 | m4/__inline.m4 | ||
1210 | m4/absolute-header.m4 | ||
1211 | m4/af_alg.m4 | ||
781 | m4/alloca.m4 | 1212 | m4/alloca.m4 |
782 | m4/arpa_inet_h.m4 | 1213 | m4/arpa_inet_h.m4 |
1214 | m4/assert_h.m4 | ||
783 | m4/base64.m4 | 1215 | m4/base64.m4 |
784 | m4/btowc.m4 | 1216 | m4/btowc.m4 |
1217 | m4/builtin-expect.m4 | ||
1218 | m4/byteswap.m4 | ||
1219 | m4/c-bool.m4 | ||
1220 | m4/calloc.m4 | ||
1221 | m4/close.m4 | ||
785 | m4/codeset.m4 | 1222 | m4/codeset.m4 |
786 | m4/configmake.m4 | ||
787 | m4/dirname.m4 | ||
788 | m4/double-slash-root.m4 | 1223 | m4/double-slash-root.m4 |
1224 | m4/dup2.m4 | ||
789 | m4/eealloc.m4 | 1225 | m4/eealloc.m4 |
790 | m4/environ.m4 | 1226 | m4/environ.m4 |
791 | m4/errno_h.m4 | 1227 | m4/errno_h.m4 |
@@ -794,37 +1230,50 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
794 | m4/extensions.m4 | 1230 | m4/extensions.m4 |
795 | m4/extern-inline.m4 | 1231 | m4/extern-inline.m4 |
796 | m4/fcntl-o.m4 | 1232 | m4/fcntl-o.m4 |
1233 | m4/fcntl.m4 | ||
1234 | m4/fcntl_h.m4 | ||
1235 | m4/fflush.m4 | ||
797 | m4/float_h.m4 | 1236 | m4/float_h.m4 |
798 | m4/floorf.m4 | 1237 | m4/floorf.m4 |
1238 | m4/fopen.m4 | ||
1239 | m4/fpurge.m4 | ||
1240 | m4/freading.m4 | ||
1241 | m4/free.m4 | ||
1242 | m4/fseek.m4 | ||
1243 | m4/fseeko.m4 | ||
1244 | m4/fstat.m4 | ||
799 | m4/fstypename.m4 | 1245 | m4/fstypename.m4 |
800 | m4/fsusage.m4 | 1246 | m4/fsusage.m4 |
1247 | m4/ftell.m4 | ||
1248 | m4/ftello.m4 | ||
801 | m4/getaddrinfo.m4 | 1249 | m4/getaddrinfo.m4 |
1250 | m4/getdelim.m4 | ||
1251 | m4/getdtablesize.m4 | ||
802 | m4/gethostname.m4 | 1252 | m4/gethostname.m4 |
1253 | m4/getline.m4 | ||
803 | m4/getloadavg.m4 | 1254 | m4/getloadavg.m4 |
804 | m4/getopt.m4 | 1255 | m4/getopt.m4 |
1256 | m4/getprogname.m4 | ||
805 | m4/gettext.m4 | 1257 | m4/gettext.m4 |
806 | m4/glibc2.m4 | 1258 | m4/gl-openssl.m4 |
807 | m4/glibc21.m4 | ||
808 | m4/gnulib-common.m4 | 1259 | m4/gnulib-common.m4 |
1260 | m4/host-cpu-c-abi.m4 | ||
809 | m4/hostent.m4 | 1261 | m4/hostent.m4 |
810 | m4/iconv.m4 | 1262 | m4/iconv.m4 |
811 | m4/idpriv.m4 | 1263 | m4/idpriv.m4 |
812 | m4/include_next.m4 | 1264 | m4/include_next.m4 |
813 | m4/inet_ntop.m4 | 1265 | m4/inet_ntop.m4 |
814 | m4/intdiv0.m4 | 1266 | m4/intl-thread-locale.m4 |
815 | m4/intl.m4 | ||
816 | m4/intldir.m4 | ||
817 | m4/intlmacosx.m4 | 1267 | m4/intlmacosx.m4 |
818 | m4/intmax.m4 | ||
819 | m4/intmax_t.m4 | 1268 | m4/intmax_t.m4 |
820 | m4/inttypes-pri.m4 | 1269 | m4/inttypes.m4 |
821 | m4/inttypes_h.m4 | 1270 | m4/inttypes_h.m4 |
822 | m4/langinfo_h.m4 | 1271 | m4/langinfo_h.m4 |
823 | m4/largefile.m4 | 1272 | m4/largefile.m4 |
824 | m4/lcmessage.m4 | ||
825 | m4/lib-ld.m4 | 1273 | m4/lib-ld.m4 |
826 | m4/lib-link.m4 | 1274 | m4/lib-link.m4 |
827 | m4/lib-prefix.m4 | 1275 | m4/lib-prefix.m4 |
1276 | m4/limits-h.m4 | ||
828 | m4/localcharset.m4 | 1277 | m4/localcharset.m4 |
829 | m4/locale-fr.m4 | 1278 | m4/locale-fr.m4 |
830 | m4/locale-ja.m4 | 1279 | m4/locale-ja.m4 |
@@ -832,8 +1281,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
832 | m4/locale_h.m4 | 1281 | m4/locale_h.m4 |
833 | m4/localeconv.m4 | 1282 | m4/localeconv.m4 |
834 | m4/lock.m4 | 1283 | m4/lock.m4 |
835 | m4/longlong.m4 | 1284 | m4/lseek.m4 |
836 | m4/ls-mntd-fs.m4 | ||
837 | m4/malloc.m4 | 1285 | m4/malloc.m4 |
838 | m4/malloca.m4 | 1286 | m4/malloca.m4 |
839 | m4/math_h.m4 | 1287 | m4/math_h.m4 |
@@ -842,8 +1290,10 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
842 | m4/mbstate_t.m4 | 1290 | m4/mbstate_t.m4 |
843 | m4/mbtowc.m4 | 1291 | m4/mbtowc.m4 |
844 | m4/memchr.m4 | 1292 | m4/memchr.m4 |
1293 | m4/minmax.m4 | ||
845 | m4/mktime.m4 | 1294 | m4/mktime.m4 |
846 | m4/mmap-anon.m4 | 1295 | m4/mmap-anon.m4 |
1296 | m4/mode_t.m4 | ||
847 | m4/mountlist.m4 | 1297 | m4/mountlist.m4 |
848 | m4/msvc-inval.m4 | 1298 | m4/msvc-inval.m4 |
849 | m4/msvc-nothrow.m4 | 1299 | m4/msvc-nothrow.m4 |
@@ -854,16 +1304,21 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
854 | m4/nls.m4 | 1304 | m4/nls.m4 |
855 | m4/nocrash.m4 | 1305 | m4/nocrash.m4 |
856 | m4/off_t.m4 | 1306 | m4/off_t.m4 |
857 | m4/onceonly.m4 | 1307 | m4/open-cloexec.m4 |
1308 | m4/open-slash.m4 | ||
1309 | m4/open.m4 | ||
1310 | m4/pathmax.m4 | ||
1311 | m4/pid_t.m4 | ||
858 | m4/po.m4 | 1312 | m4/po.m4 |
859 | m4/printf-posix.m4 | ||
860 | m4/printf.m4 | 1313 | m4/printf.m4 |
861 | m4/progtest.m4 | 1314 | m4/progtest.m4 |
862 | m4/read.m4 | 1315 | m4/pthread_rwlock_rdlock.m4 |
1316 | m4/realloc.m4 | ||
1317 | m4/reallocarray.m4 | ||
863 | m4/regex.m4 | 1318 | m4/regex.m4 |
864 | m4/safe-read.m4 | ||
865 | m4/servent.m4 | 1319 | m4/servent.m4 |
866 | m4/setenv.m4 | 1320 | m4/setenv.m4 |
1321 | m4/setlocale_null.m4 | ||
867 | m4/sha1.m4 | 1322 | m4/sha1.m4 |
868 | m4/size_max.m4 | 1323 | m4/size_max.m4 |
869 | m4/snprintf.m4 | 1324 | m4/snprintf.m4 |
@@ -872,8 +1327,10 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
872 | m4/socklen.m4 | 1327 | m4/socklen.m4 |
873 | m4/sockpfaf.m4 | 1328 | m4/sockpfaf.m4 |
874 | m4/ssize_t.m4 | 1329 | m4/ssize_t.m4 |
1330 | m4/stat-time.m4 | ||
1331 | m4/stat.m4 | ||
1332 | m4/std-gnu11.m4 | ||
875 | m4/stdalign.m4 | 1333 | m4/stdalign.m4 |
876 | m4/stdbool.m4 | ||
877 | m4/stddef_h.m4 | 1334 | m4/stddef_h.m4 |
878 | m4/stdint.m4 | 1335 | m4/stdint.m4 |
879 | m4/stdint_h.m4 | 1336 | m4/stdint_h.m4 |
@@ -884,19 +1341,20 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
884 | m4/strerror.m4 | 1341 | m4/strerror.m4 |
885 | m4/string_h.m4 | 1342 | m4/string_h.m4 |
886 | m4/strings_h.m4 | 1343 | m4/strings_h.m4 |
887 | m4/strndup.m4 | ||
888 | m4/strnlen.m4 | ||
889 | m4/strsep.m4 | 1344 | m4/strsep.m4 |
890 | m4/strstr.m4 | 1345 | m4/strstr.m4 |
891 | m4/sys_socket_h.m4 | 1346 | m4/sys_socket_h.m4 |
1347 | m4/sys_stat_h.m4 | ||
892 | m4/sys_types_h.m4 | 1348 | m4/sys_types_h.m4 |
893 | m4/sys_uio_h.m4 | 1349 | m4/sys_uio_h.m4 |
894 | m4/threadlib.m4 | 1350 | m4/threadlib.m4 |
895 | m4/time_h.m4 | 1351 | m4/time_h.m4 |
896 | m4/time_r.m4 | 1352 | m4/time_r.m4 |
897 | m4/timegm.m4 | 1353 | m4/timegm.m4 |
898 | m4/uintmax_t.m4 | 1354 | m4/ungetc.m4 |
899 | m4/unistd_h.m4 | 1355 | m4/unistd_h.m4 |
1356 | m4/unlocked-io.m4 | ||
1357 | m4/vararrays.m4 | ||
900 | m4/vasnprintf.m4 | 1358 | m4/vasnprintf.m4 |
901 | m4/vasprintf.m4 | 1359 | m4/vasprintf.m4 |
902 | m4/visibility.m4 | 1360 | m4/visibility.m4 |
@@ -909,5 +1367,5 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
909 | m4/wint_t.m4 | 1367 | m4/wint_t.m4 |
910 | m4/xalloc.m4 | 1368 | m4/xalloc.m4 |
911 | m4/xsize.m4 | 1369 | m4/xsize.m4 |
912 | m4/xstrndup.m4 | 1370 | m4/zzgnulib.m4 |
913 | ]) | 1371 | ]) |
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index f3dea1a..a9dd569 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # gnulib-tool.m4 serial 2 | 1 | # gnulib-tool.m4 serial 4 |
2 | dnl Copyright (C) 2004-2005, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004-2005, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -44,6 +44,12 @@ AC_DEFUN([gl_LGPL], []) | |||
44 | dnl Usage: gl_MAKEFILE_NAME([FILENAME]) | 44 | dnl Usage: gl_MAKEFILE_NAME([FILENAME]) |
45 | AC_DEFUN([gl_MAKEFILE_NAME], []) | 45 | AC_DEFUN([gl_MAKEFILE_NAME], []) |
46 | 46 | ||
47 | dnl Usage: gl_TESTS_MAKEFILE_NAME([FILENAME]) | ||
48 | AC_DEFUN([gl_TESTS_MAKEFILE_NAME], []) | ||
49 | |||
50 | dnl Usage: gl_AUTOMAKE_SUBDIR | ||
51 | AC_DEFUN([gl_AUTOMAKE_SUBDIR], []) | ||
52 | |||
47 | dnl Usage: gl_LIBTOOL | 53 | dnl Usage: gl_LIBTOOL |
48 | AC_DEFUN([gl_LIBTOOL], []) | 54 | AC_DEFUN([gl_LIBTOOL], []) |
49 | 55 | ||
diff --git a/gl/m4/host-cpu-c-abi.m4 b/gl/m4/host-cpu-c-abi.m4 new file mode 100644 index 0000000..134f228 --- /dev/null +++ b/gl/m4/host-cpu-c-abi.m4 | |||
@@ -0,0 +1,678 @@ | |||
1 | # host-cpu-c-abi.m4 serial 15 | ||
2 | dnl Copyright (C) 2002-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 and Sam Steingold. | ||
8 | |||
9 | dnl Sets the HOST_CPU variable to the canonical name of the CPU. | ||
10 | dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its | ||
11 | dnl C language ABI (application binary interface). | ||
12 | dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in | ||
13 | dnl config.h. | ||
14 | dnl | ||
15 | dnl This canonical name can be used to select a particular assembly language | ||
16 | dnl source file that will interoperate with C code on the given host. | ||
17 | dnl | ||
18 | dnl For example: | ||
19 | dnl * 'i386' and 'sparc' are different canonical names, because code for i386 | ||
20 | dnl will not run on SPARC CPUs and vice versa. They have different | ||
21 | dnl instruction sets. | ||
22 | dnl * 'sparc' and 'sparc64' are different canonical names, because code for | ||
23 | dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code | ||
24 | dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit | ||
25 | dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit | ||
26 | dnl mode, but not both. | ||
27 | dnl * 'mips' and 'mipsn32' are different canonical names, because they use | ||
28 | dnl different argument passing and return conventions for C functions, and | ||
29 | dnl although the instruction set of 'mips' is a large subset of the | ||
30 | dnl instruction set of 'mipsn32'. | ||
31 | dnl * 'mipsn32' and 'mips64' are different canonical names, because they use | ||
32 | dnl different sizes for the C types like 'int' and 'void *', and although | ||
33 | dnl the instruction sets of 'mipsn32' and 'mips64' are the same. | ||
34 | dnl * The same canonical name is used for different endiannesses. You can | ||
35 | dnl determine the endianness through preprocessor symbols: | ||
36 | dnl - 'arm': test __ARMEL__. | ||
37 | dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. | ||
38 | dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. | ||
39 | dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 | ||
40 | dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because | ||
41 | dnl - Instructions that do not exist on all of these CPUs (cmpxchg, | ||
42 | dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your | ||
43 | dnl assembly language source files use such instructions, you will | ||
44 | dnl need to make the distinction. | ||
45 | dnl - Speed of execution of the common instruction set is reasonable across | ||
46 | dnl the entire family of CPUs. If you have assembly language source files | ||
47 | dnl that are optimized for particular CPU types (like GNU gmp has), you | ||
48 | dnl will need to make the distinction. | ||
49 | dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>. | ||
50 | AC_DEFUN([gl_HOST_CPU_C_ABI], | ||
51 | [ | ||
52 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
53 | AC_REQUIRE([gl_C_ASM]) | ||
54 | AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], | ||
55 | [case "$host_cpu" in | ||
56 | |||
57 | changequote(,)dnl | ||
58 | i[34567]86 ) | ||
59 | changequote([,])dnl | ||
60 | gl_cv_host_cpu_c_abi=i386 | ||
61 | ;; | ||
62 | |||
63 | x86_64 ) | ||
64 | # On x86_64 systems, the C compiler may be generating code in one of | ||
65 | # these ABIs: | ||
66 | # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. | ||
67 | # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 | ||
68 | # with native Windows (mingw, MSVC). | ||
69 | # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. | ||
70 | # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. | ||
71 | AC_COMPILE_IFELSE( | ||
72 | [AC_LANG_SOURCE( | ||
73 | [[#if (defined __x86_64__ || defined __amd64__ \ | ||
74 | || defined _M_X64 || defined _M_AMD64) | ||
75 | int ok; | ||
76 | #else | ||
77 | error fail | ||
78 | #endif | ||
79 | ]])], | ||
80 | [AC_COMPILE_IFELSE( | ||
81 | [AC_LANG_SOURCE( | ||
82 | [[#if defined __ILP32__ || defined _ILP32 | ||
83 | int ok; | ||
84 | #else | ||
85 | error fail | ||
86 | #endif | ||
87 | ]])], | ||
88 | [gl_cv_host_cpu_c_abi=x86_64-x32], | ||
89 | [gl_cv_host_cpu_c_abi=x86_64])], | ||
90 | [gl_cv_host_cpu_c_abi=i386]) | ||
91 | ;; | ||
92 | |||
93 | changequote(,)dnl | ||
94 | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) | ||
95 | changequote([,])dnl | ||
96 | gl_cv_host_cpu_c_abi=alpha | ||
97 | ;; | ||
98 | |||
99 | arm* | aarch64 ) | ||
100 | # Assume arm with EABI. | ||
101 | # On arm64 systems, the C compiler may be generating code in one of | ||
102 | # these ABIs: | ||
103 | # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. | ||
104 | # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. | ||
105 | # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. | ||
106 | AC_COMPILE_IFELSE( | ||
107 | [AC_LANG_SOURCE( | ||
108 | [[#ifdef __aarch64__ | ||
109 | int ok; | ||
110 | #else | ||
111 | error fail | ||
112 | #endif | ||
113 | ]])], | ||
114 | [AC_COMPILE_IFELSE( | ||
115 | [AC_LANG_SOURCE( | ||
116 | [[#if defined __ILP32__ || defined _ILP32 | ||
117 | int ok; | ||
118 | #else | ||
119 | error fail | ||
120 | #endif | ||
121 | ]])], | ||
122 | [gl_cv_host_cpu_c_abi=arm64-ilp32], | ||
123 | [gl_cv_host_cpu_c_abi=arm64])], | ||
124 | [# Don't distinguish little-endian and big-endian arm, since they | ||
125 | # don't require different machine code for simple operations and | ||
126 | # since the user can distinguish them through the preprocessor | ||
127 | # defines __ARMEL__ vs. __ARMEB__. | ||
128 | # But distinguish arm which passes floating-point arguments and | ||
129 | # return values in integer registers (r0, r1, ...) - this is | ||
130 | # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which | ||
131 | # passes them in float registers (s0, s1, ...) and double registers | ||
132 | # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer | ||
133 | # sets the preprocessor defines __ARM_PCS (for the first case) and | ||
134 | # __ARM_PCS_VFP (for the second case), but older GCC does not. | ||
135 | echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c | ||
136 | # Look for a reference to the register d0 in the .s file. | ||
137 | AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 | ||
138 | if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then | ||
139 | gl_cv_host_cpu_c_abi=armhf | ||
140 | else | ||
141 | gl_cv_host_cpu_c_abi=arm | ||
142 | fi | ||
143 | rm -f conftest* | ||
144 | ]) | ||
145 | ;; | ||
146 | |||
147 | hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) | ||
148 | # On hppa, the C compiler may be generating 32-bit code or 64-bit | ||
149 | # code. In the latter case, it defines _LP64 and __LP64__. | ||
150 | AC_COMPILE_IFELSE( | ||
151 | [AC_LANG_SOURCE( | ||
152 | [[#ifdef __LP64__ | ||
153 | int ok; | ||
154 | #else | ||
155 | error fail | ||
156 | #endif | ||
157 | ]])], | ||
158 | [gl_cv_host_cpu_c_abi=hppa64], | ||
159 | [gl_cv_host_cpu_c_abi=hppa]) | ||
160 | ;; | ||
161 | |||
162 | ia64* ) | ||
163 | # On ia64 on HP-UX, the C compiler may be generating 64-bit code or | ||
164 | # 32-bit code. In the latter case, it defines _ILP32. | ||
165 | AC_COMPILE_IFELSE( | ||
166 | [AC_LANG_SOURCE( | ||
167 | [[#ifdef _ILP32 | ||
168 | int ok; | ||
169 | #else | ||
170 | error fail | ||
171 | #endif | ||
172 | ]])], | ||
173 | [gl_cv_host_cpu_c_abi=ia64-ilp32], | ||
174 | [gl_cv_host_cpu_c_abi=ia64]) | ||
175 | ;; | ||
176 | |||
177 | mips* ) | ||
178 | # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this | ||
179 | # at 32. | ||
180 | AC_COMPILE_IFELSE( | ||
181 | [AC_LANG_SOURCE( | ||
182 | [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) | ||
183 | int ok; | ||
184 | #else | ||
185 | error fail | ||
186 | #endif | ||
187 | ]])], | ||
188 | [gl_cv_host_cpu_c_abi=mips64], | ||
189 | [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but | ||
190 | # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32. | ||
191 | # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but | ||
192 | # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32. | ||
193 | AC_COMPILE_IFELSE( | ||
194 | [AC_LANG_SOURCE( | ||
195 | [[#if (_MIPS_SIM == _ABIN32) | ||
196 | int ok; | ||
197 | #else | ||
198 | error fail | ||
199 | #endif | ||
200 | ]])], | ||
201 | [gl_cv_host_cpu_c_abi=mipsn32], | ||
202 | [gl_cv_host_cpu_c_abi=mips])]) | ||
203 | ;; | ||
204 | |||
205 | powerpc* ) | ||
206 | # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. | ||
207 | # No need to distinguish them here; the caller may distinguish | ||
208 | # them based on the OS. | ||
209 | # On powerpc64 systems, the C compiler may still be generating | ||
210 | # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may | ||
211 | # be generating 64-bit code. | ||
212 | AC_COMPILE_IFELSE( | ||
213 | [AC_LANG_SOURCE( | ||
214 | [[#if defined __powerpc64__ || defined __LP64__ | ||
215 | int ok; | ||
216 | #else | ||
217 | error fail | ||
218 | #endif | ||
219 | ]])], | ||
220 | [# On powerpc64, there are two ABIs on Linux: The AIX compatible | ||
221 | # one and the ELFv2 one. The latter defines _CALL_ELF=2. | ||
222 | AC_COMPILE_IFELSE( | ||
223 | [AC_LANG_SOURCE( | ||
224 | [[#if defined _CALL_ELF && _CALL_ELF == 2 | ||
225 | int ok; | ||
226 | #else | ||
227 | error fail | ||
228 | #endif | ||
229 | ]])], | ||
230 | [gl_cv_host_cpu_c_abi=powerpc64-elfv2], | ||
231 | [gl_cv_host_cpu_c_abi=powerpc64]) | ||
232 | ], | ||
233 | [gl_cv_host_cpu_c_abi=powerpc]) | ||
234 | ;; | ||
235 | |||
236 | rs6000 ) | ||
237 | gl_cv_host_cpu_c_abi=powerpc | ||
238 | ;; | ||
239 | |||
240 | riscv32 | riscv64 ) | ||
241 | # There are 2 architectures (with variants): rv32* and rv64*. | ||
242 | AC_COMPILE_IFELSE( | ||
243 | [AC_LANG_SOURCE( | ||
244 | [[#if __riscv_xlen == 64 | ||
245 | int ok; | ||
246 | #else | ||
247 | error fail | ||
248 | #endif | ||
249 | ]])], | ||
250 | [cpu=riscv64], | ||
251 | [cpu=riscv32]) | ||
252 | # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. | ||
253 | # Size of 'long' and 'void *': | ||
254 | AC_COMPILE_IFELSE( | ||
255 | [AC_LANG_SOURCE( | ||
256 | [[#if defined __LP64__ | ||
257 | int ok; | ||
258 | #else | ||
259 | error fail | ||
260 | #endif | ||
261 | ]])], | ||
262 | [main_abi=lp64], | ||
263 | [main_abi=ilp32]) | ||
264 | # Float ABIs: | ||
265 | # __riscv_float_abi_double: | ||
266 | # 'float' and 'double' are passed in floating-point registers. | ||
267 | # __riscv_float_abi_single: | ||
268 | # 'float' are passed in floating-point registers. | ||
269 | # __riscv_float_abi_soft: | ||
270 | # No values are passed in floating-point registers. | ||
271 | AC_COMPILE_IFELSE( | ||
272 | [AC_LANG_SOURCE( | ||
273 | [[#if defined __riscv_float_abi_double | ||
274 | int ok; | ||
275 | #else | ||
276 | error fail | ||
277 | #endif | ||
278 | ]])], | ||
279 | [float_abi=d], | ||
280 | [AC_COMPILE_IFELSE( | ||
281 | [AC_LANG_SOURCE( | ||
282 | [[#if defined __riscv_float_abi_single | ||
283 | int ok; | ||
284 | #else | ||
285 | error fail | ||
286 | #endif | ||
287 | ]])], | ||
288 | [float_abi=f], | ||
289 | [float_abi='']) | ||
290 | ]) | ||
291 | gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" | ||
292 | ;; | ||
293 | |||
294 | s390* ) | ||
295 | # On s390x, the C compiler may be generating 64-bit (= s390x) code | ||
296 | # or 31-bit (= s390) code. | ||
297 | AC_COMPILE_IFELSE( | ||
298 | [AC_LANG_SOURCE( | ||
299 | [[#if defined __LP64__ || defined __s390x__ | ||
300 | int ok; | ||
301 | #else | ||
302 | error fail | ||
303 | #endif | ||
304 | ]])], | ||
305 | [gl_cv_host_cpu_c_abi=s390x], | ||
306 | [gl_cv_host_cpu_c_abi=s390]) | ||
307 | ;; | ||
308 | |||
309 | sparc | sparc64 ) | ||
310 | # UltraSPARCs running Linux have `uname -m` = "sparc64", but the | ||
311 | # C compiler still generates 32-bit code. | ||
312 | AC_COMPILE_IFELSE( | ||
313 | [AC_LANG_SOURCE( | ||
314 | [[#if defined __sparcv9 || defined __arch64__ | ||
315 | int ok; | ||
316 | #else | ||
317 | error fail | ||
318 | #endif | ||
319 | ]])], | ||
320 | [gl_cv_host_cpu_c_abi=sparc64], | ||
321 | [gl_cv_host_cpu_c_abi=sparc]) | ||
322 | ;; | ||
323 | |||
324 | *) | ||
325 | gl_cv_host_cpu_c_abi="$host_cpu" | ||
326 | ;; | ||
327 | esac | ||
328 | ]) | ||
329 | |||
330 | dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. | ||
331 | HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` | ||
332 | HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" | ||
333 | AC_SUBST([HOST_CPU]) | ||
334 | AC_SUBST([HOST_CPU_C_ABI]) | ||
335 | |||
336 | # This was | ||
337 | # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) | ||
338 | # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) | ||
339 | # earlier, but KAI C++ 3.2d doesn't like this. | ||
340 | sed -e 's/-/_/g' >> confdefs.h <<EOF | ||
341 | #ifndef __${HOST_CPU}__ | ||
342 | #define __${HOST_CPU}__ 1 | ||
343 | #endif | ||
344 | #ifndef __${HOST_CPU_C_ABI}__ | ||
345 | #define __${HOST_CPU_C_ABI}__ 1 | ||
346 | #endif | ||
347 | EOF | ||
348 | AH_TOP([/* CPU and C ABI indicator */ | ||
349 | #ifndef __i386__ | ||
350 | #undef __i386__ | ||
351 | #endif | ||
352 | #ifndef __x86_64_x32__ | ||
353 | #undef __x86_64_x32__ | ||
354 | #endif | ||
355 | #ifndef __x86_64__ | ||
356 | #undef __x86_64__ | ||
357 | #endif | ||
358 | #ifndef __alpha__ | ||
359 | #undef __alpha__ | ||
360 | #endif | ||
361 | #ifndef __arm__ | ||
362 | #undef __arm__ | ||
363 | #endif | ||
364 | #ifndef __armhf__ | ||
365 | #undef __armhf__ | ||
366 | #endif | ||
367 | #ifndef __arm64_ilp32__ | ||
368 | #undef __arm64_ilp32__ | ||
369 | #endif | ||
370 | #ifndef __arm64__ | ||
371 | #undef __arm64__ | ||
372 | #endif | ||
373 | #ifndef __hppa__ | ||
374 | #undef __hppa__ | ||
375 | #endif | ||
376 | #ifndef __hppa64__ | ||
377 | #undef __hppa64__ | ||
378 | #endif | ||
379 | #ifndef __ia64_ilp32__ | ||
380 | #undef __ia64_ilp32__ | ||
381 | #endif | ||
382 | #ifndef __ia64__ | ||
383 | #undef __ia64__ | ||
384 | #endif | ||
385 | #ifndef __loongarch64__ | ||
386 | #undef __loongarch64__ | ||
387 | #endif | ||
388 | #ifndef __m68k__ | ||
389 | #undef __m68k__ | ||
390 | #endif | ||
391 | #ifndef __mips__ | ||
392 | #undef __mips__ | ||
393 | #endif | ||
394 | #ifndef __mipsn32__ | ||
395 | #undef __mipsn32__ | ||
396 | #endif | ||
397 | #ifndef __mips64__ | ||
398 | #undef __mips64__ | ||
399 | #endif | ||
400 | #ifndef __powerpc__ | ||
401 | #undef __powerpc__ | ||
402 | #endif | ||
403 | #ifndef __powerpc64__ | ||
404 | #undef __powerpc64__ | ||
405 | #endif | ||
406 | #ifndef __powerpc64_elfv2__ | ||
407 | #undef __powerpc64_elfv2__ | ||
408 | #endif | ||
409 | #ifndef __riscv32__ | ||
410 | #undef __riscv32__ | ||
411 | #endif | ||
412 | #ifndef __riscv64__ | ||
413 | #undef __riscv64__ | ||
414 | #endif | ||
415 | #ifndef __riscv32_ilp32__ | ||
416 | #undef __riscv32_ilp32__ | ||
417 | #endif | ||
418 | #ifndef __riscv32_ilp32f__ | ||
419 | #undef __riscv32_ilp32f__ | ||
420 | #endif | ||
421 | #ifndef __riscv32_ilp32d__ | ||
422 | #undef __riscv32_ilp32d__ | ||
423 | #endif | ||
424 | #ifndef __riscv64_ilp32__ | ||
425 | #undef __riscv64_ilp32__ | ||
426 | #endif | ||
427 | #ifndef __riscv64_ilp32f__ | ||
428 | #undef __riscv64_ilp32f__ | ||
429 | #endif | ||
430 | #ifndef __riscv64_ilp32d__ | ||
431 | #undef __riscv64_ilp32d__ | ||
432 | #endif | ||
433 | #ifndef __riscv64_lp64__ | ||
434 | #undef __riscv64_lp64__ | ||
435 | #endif | ||
436 | #ifndef __riscv64_lp64f__ | ||
437 | #undef __riscv64_lp64f__ | ||
438 | #endif | ||
439 | #ifndef __riscv64_lp64d__ | ||
440 | #undef __riscv64_lp64d__ | ||
441 | #endif | ||
442 | #ifndef __s390__ | ||
443 | #undef __s390__ | ||
444 | #endif | ||
445 | #ifndef __s390x__ | ||
446 | #undef __s390x__ | ||
447 | #endif | ||
448 | #ifndef __sh__ | ||
449 | #undef __sh__ | ||
450 | #endif | ||
451 | #ifndef __sparc__ | ||
452 | #undef __sparc__ | ||
453 | #endif | ||
454 | #ifndef __sparc64__ | ||
455 | #undef __sparc64__ | ||
456 | #endif | ||
457 | ]) | ||
458 | |||
459 | ]) | ||
460 | |||
461 | |||
462 | dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI | ||
463 | dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit | ||
464 | dnl one, or to 'unknown' if unknown. | ||
465 | dnl This is a simplified variant of gl_HOST_CPU_C_ABI. | ||
466 | AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], | ||
467 | [ | ||
468 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
469 | AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit], | ||
470 | [if test -n "$gl_cv_host_cpu_c_abi"; then | ||
471 | case "$gl_cv_host_cpu_c_abi" in | ||
472 | i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) | ||
473 | gl_cv_host_cpu_c_abi_32bit=yes ;; | ||
474 | x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) | ||
475 | gl_cv_host_cpu_c_abi_32bit=no ;; | ||
476 | *) | ||
477 | gl_cv_host_cpu_c_abi_32bit=unknown ;; | ||
478 | esac | ||
479 | else | ||
480 | case "$host_cpu" in | ||
481 | |||
482 | # CPUs that only support a 32-bit ABI. | ||
483 | arc \ | ||
484 | | bfin \ | ||
485 | | cris* \ | ||
486 | | csky \ | ||
487 | | epiphany \ | ||
488 | | ft32 \ | ||
489 | | h8300 \ | ||
490 | | m68k \ | ||
491 | | microblaze | microblazeel \ | ||
492 | | nds32 | nds32le | nds32be \ | ||
493 | | nios2 | nios2eb | nios2el \ | ||
494 | | or1k* \ | ||
495 | | or32 \ | ||
496 | | sh | sh[1234] | sh[1234]e[lb] \ | ||
497 | | tic6x \ | ||
498 | | xtensa* ) | ||
499 | gl_cv_host_cpu_c_abi_32bit=yes | ||
500 | ;; | ||
501 | |||
502 | # CPUs that only support a 64-bit ABI. | ||
503 | changequote(,)dnl | ||
504 | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ | ||
505 | | mmix ) | ||
506 | changequote([,])dnl | ||
507 | gl_cv_host_cpu_c_abi_32bit=no | ||
508 | ;; | ||
509 | |||
510 | changequote(,)dnl | ||
511 | i[34567]86 ) | ||
512 | changequote([,])dnl | ||
513 | gl_cv_host_cpu_c_abi_32bit=yes | ||
514 | ;; | ||
515 | |||
516 | x86_64 ) | ||
517 | # On x86_64 systems, the C compiler may be generating code in one of | ||
518 | # these ABIs: | ||
519 | # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. | ||
520 | # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 | ||
521 | # with native Windows (mingw, MSVC). | ||
522 | # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. | ||
523 | # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. | ||
524 | AC_COMPILE_IFELSE( | ||
525 | [AC_LANG_SOURCE( | ||
526 | [[#if (defined __x86_64__ || defined __amd64__ \ | ||
527 | || defined _M_X64 || defined _M_AMD64) \ | ||
528 | && !(defined __ILP32__ || defined _ILP32) | ||
529 | int ok; | ||
530 | #else | ||
531 | error fail | ||
532 | #endif | ||
533 | ]])], | ||
534 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
535 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
536 | ;; | ||
537 | |||
538 | arm* | aarch64 ) | ||
539 | # Assume arm with EABI. | ||
540 | # On arm64 systems, the C compiler may be generating code in one of | ||
541 | # these ABIs: | ||
542 | # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. | ||
543 | # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. | ||
544 | # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. | ||
545 | AC_COMPILE_IFELSE( | ||
546 | [AC_LANG_SOURCE( | ||
547 | [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) | ||
548 | int ok; | ||
549 | #else | ||
550 | error fail | ||
551 | #endif | ||
552 | ]])], | ||
553 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
554 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
555 | ;; | ||
556 | |||
557 | hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) | ||
558 | # On hppa, the C compiler may be generating 32-bit code or 64-bit | ||
559 | # code. In the latter case, it defines _LP64 and __LP64__. | ||
560 | AC_COMPILE_IFELSE( | ||
561 | [AC_LANG_SOURCE( | ||
562 | [[#ifdef __LP64__ | ||
563 | int ok; | ||
564 | #else | ||
565 | error fail | ||
566 | #endif | ||
567 | ]])], | ||
568 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
569 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
570 | ;; | ||
571 | |||
572 | ia64* ) | ||
573 | # On ia64 on HP-UX, the C compiler may be generating 64-bit code or | ||
574 | # 32-bit code. In the latter case, it defines _ILP32. | ||
575 | AC_COMPILE_IFELSE( | ||
576 | [AC_LANG_SOURCE( | ||
577 | [[#ifdef _ILP32 | ||
578 | int ok; | ||
579 | #else | ||
580 | error fail | ||
581 | #endif | ||
582 | ]])], | ||
583 | [gl_cv_host_cpu_c_abi_32bit=yes], | ||
584 | [gl_cv_host_cpu_c_abi_32bit=no]) | ||
585 | ;; | ||
586 | |||
587 | mips* ) | ||
588 | # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this | ||
589 | # at 32. | ||
590 | AC_COMPILE_IFELSE( | ||
591 | [AC_LANG_SOURCE( | ||
592 | [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) | ||
593 | int ok; | ||
594 | #else | ||
595 | error fail | ||
596 | #endif | ||
597 | ]])], | ||
598 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
599 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
600 | ;; | ||
601 | |||
602 | powerpc* ) | ||
603 | # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. | ||
604 | # No need to distinguish them here; the caller may distinguish | ||
605 | # them based on the OS. | ||
606 | # On powerpc64 systems, the C compiler may still be generating | ||
607 | # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may | ||
608 | # be generating 64-bit code. | ||
609 | AC_COMPILE_IFELSE( | ||
610 | [AC_LANG_SOURCE( | ||
611 | [[#if defined __powerpc64__ || defined __LP64__ | ||
612 | int ok; | ||
613 | #else | ||
614 | error fail | ||
615 | #endif | ||
616 | ]])], | ||
617 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
618 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
619 | ;; | ||
620 | |||
621 | rs6000 ) | ||
622 | gl_cv_host_cpu_c_abi_32bit=yes | ||
623 | ;; | ||
624 | |||
625 | riscv32 | riscv64 ) | ||
626 | # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. | ||
627 | # Size of 'long' and 'void *': | ||
628 | AC_COMPILE_IFELSE( | ||
629 | [AC_LANG_SOURCE( | ||
630 | [[#if defined __LP64__ | ||
631 | int ok; | ||
632 | #else | ||
633 | error fail | ||
634 | #endif | ||
635 | ]])], | ||
636 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
637 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
638 | ;; | ||
639 | |||
640 | s390* ) | ||
641 | # On s390x, the C compiler may be generating 64-bit (= s390x) code | ||
642 | # or 31-bit (= s390) code. | ||
643 | AC_COMPILE_IFELSE( | ||
644 | [AC_LANG_SOURCE( | ||
645 | [[#if defined __LP64__ || defined __s390x__ | ||
646 | int ok; | ||
647 | #else | ||
648 | error fail | ||
649 | #endif | ||
650 | ]])], | ||
651 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
652 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
653 | ;; | ||
654 | |||
655 | sparc | sparc64 ) | ||
656 | # UltraSPARCs running Linux have `uname -m` = "sparc64", but the | ||
657 | # C compiler still generates 32-bit code. | ||
658 | AC_COMPILE_IFELSE( | ||
659 | [AC_LANG_SOURCE( | ||
660 | [[#if defined __sparcv9 || defined __arch64__ | ||
661 | int ok; | ||
662 | #else | ||
663 | error fail | ||
664 | #endif | ||
665 | ]])], | ||
666 | [gl_cv_host_cpu_c_abi_32bit=no], | ||
667 | [gl_cv_host_cpu_c_abi_32bit=yes]) | ||
668 | ;; | ||
669 | |||
670 | *) | ||
671 | gl_cv_host_cpu_c_abi_32bit=unknown | ||
672 | ;; | ||
673 | esac | ||
674 | fi | ||
675 | ]) | ||
676 | |||
677 | HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" | ||
678 | ]) | ||
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 72be876..3b2cc2b 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # hostent.m4 serial 2 | 1 | # hostent.m4 serial 4 |
2 | dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,12 +8,12 @@ AC_DEFUN([gl_HOSTENT], | |||
8 | [ | 8 | [ |
9 | dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(), | 9 | dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(), |
10 | dnl gethostbyaddr() defined? | 10 | dnl gethostbyaddr() defined? |
11 | dnl - On Solaris, they are in libnsl. Ignore libxnet. | 11 | dnl - On Solaris < 11.4, they are in libnsl. Ignore libxnet. |
12 | dnl - On Haiku, they are in libnetwork. | 12 | dnl - On Haiku, they are in libnetwork. |
13 | dnl - On BeOS, they are in libnet. | 13 | dnl - On BeOS, they are in libnet. |
14 | dnl - On native Windows, they are in ws2_32.dll. | 14 | dnl - On native Windows, they are in ws2_32.dll. |
15 | dnl - Otherwise they are in libc. | 15 | dnl - Otherwise they are in libc. |
16 | AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 16 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
17 | HOSTENT_LIB= | 17 | HOSTENT_LIB= |
18 | gl_saved_libs="$LIBS" | 18 | gl_saved_libs="$LIBS" |
19 | AC_SEARCH_LIBS([gethostbyname], [nsl network net], | 19 | AC_SEARCH_LIBS([gethostbyname], [nsl network net], |
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4 index a503646..ff5d526 100644 --- a/gl/m4/iconv.m4 +++ b/gl/m4/iconv.m4 | |||
@@ -1,11 +1,18 @@ | |||
1 | # iconv.m4 serial 18 (gettext-0.18.2) | 1 | # iconv.m4 serial 26 |
2 | dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002, 2007-2014, 2016-2023 Free Software Foundation, |
3 | dnl 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 | ||
7 | dnl From Bruno Haible. | 8 | dnl From Bruno Haible. |
8 | 9 | ||
10 | AC_PREREQ([2.64]) | ||
11 | |||
12 | dnl Note: AM_ICONV is documented in the GNU gettext manual | ||
13 | dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>. | ||
14 | dnl Don't make changes that are incompatible with that documentation! | ||
15 | |||
9 | AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], | 16 | AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], |
10 | [ | 17 | [ |
11 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. | 18 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. |
@@ -72,27 +79,34 @@ AC_DEFUN([AM_ICONV_LINK], | |||
72 | if test $am_cv_lib_iconv = yes; then | 79 | if test $am_cv_lib_iconv = yes; then |
73 | LIBS="$LIBS $LIBICONV" | 80 | LIBS="$LIBS $LIBICONV" |
74 | fi | 81 | fi |
75 | AC_RUN_IFELSE( | 82 | am_cv_func_iconv_works=no |
76 | [AC_LANG_SOURCE([[ | 83 | for ac_iconv_const in '' 'const'; do |
84 | AC_RUN_IFELSE( | ||
85 | [AC_LANG_PROGRAM( | ||
86 | [[ | ||
77 | #include <iconv.h> | 87 | #include <iconv.h> |
78 | #include <string.h> | 88 | #include <string.h> |
79 | int main () | 89 | |
80 | { | 90 | #ifndef ICONV_CONST |
81 | int result = 0; | 91 | # define ICONV_CONST $ac_iconv_const |
82 | /* Test against AIX 5.1 bug: Failures are not distinguishable from successful | 92 | #endif |
83 | returns. */ | 93 | ]], |
94 | [[int result = 0; | ||
95 | /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from | ||
96 | successful returns. This is even documented in | ||
97 | <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */ | ||
84 | { | 98 | { |
85 | iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); | 99 | iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); |
86 | if (cd_utf8_to_88591 != (iconv_t)(-1)) | 100 | if (cd_utf8_to_88591 != (iconv_t)(-1)) |
87 | { | 101 | { |
88 | static const char input[] = "\342\202\254"; /* EURO SIGN */ | 102 | static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ |
89 | char buf[10]; | 103 | char buf[10]; |
90 | const char *inptr = input; | 104 | ICONV_CONST char *inptr = input; |
91 | size_t inbytesleft = strlen (input); | 105 | size_t inbytesleft = strlen (input); |
92 | char *outptr = buf; | 106 | char *outptr = buf; |
93 | size_t outbytesleft = sizeof (buf); | 107 | size_t outbytesleft = sizeof (buf); |
94 | size_t res = iconv (cd_utf8_to_88591, | 108 | size_t res = iconv (cd_utf8_to_88591, |
95 | (char **) &inptr, &inbytesleft, | 109 | &inptr, &inbytesleft, |
96 | &outptr, &outbytesleft); | 110 | &outptr, &outbytesleft); |
97 | if (res == 0) | 111 | if (res == 0) |
98 | result |= 1; | 112 | result |= 1; |
@@ -105,14 +119,14 @@ int main () | |||
105 | iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); | 119 | iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); |
106 | if (cd_ascii_to_88591 != (iconv_t)(-1)) | 120 | if (cd_ascii_to_88591 != (iconv_t)(-1)) |
107 | { | 121 | { |
108 | static const char input[] = "\263"; | 122 | static ICONV_CONST char input[] = "\263"; |
109 | char buf[10]; | 123 | char buf[10]; |
110 | const char *inptr = input; | 124 | ICONV_CONST char *inptr = input; |
111 | size_t inbytesleft = strlen (input); | 125 | size_t inbytesleft = strlen (input); |
112 | char *outptr = buf; | 126 | char *outptr = buf; |
113 | size_t outbytesleft = sizeof (buf); | 127 | size_t outbytesleft = sizeof (buf); |
114 | size_t res = iconv (cd_ascii_to_88591, | 128 | size_t res = iconv (cd_ascii_to_88591, |
115 | (char **) &inptr, &inbytesleft, | 129 | &inptr, &inbytesleft, |
116 | &outptr, &outbytesleft); | 130 | &outptr, &outbytesleft); |
117 | if (res == 0) | 131 | if (res == 0) |
118 | result |= 2; | 132 | result |= 2; |
@@ -124,14 +138,14 @@ int main () | |||
124 | iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); | 138 | iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); |
125 | if (cd_88591_to_utf8 != (iconv_t)(-1)) | 139 | if (cd_88591_to_utf8 != (iconv_t)(-1)) |
126 | { | 140 | { |
127 | static const char input[] = "\304"; | 141 | static ICONV_CONST char input[] = "\304"; |
128 | static char buf[2] = { (char)0xDE, (char)0xAD }; | 142 | static char buf[2] = { (char)0xDE, (char)0xAD }; |
129 | const char *inptr = input; | 143 | ICONV_CONST char *inptr = input; |
130 | size_t inbytesleft = 1; | 144 | size_t inbytesleft = 1; |
131 | char *outptr = buf; | 145 | char *outptr = buf; |
132 | size_t outbytesleft = 1; | 146 | size_t outbytesleft = 1; |
133 | size_t res = iconv (cd_88591_to_utf8, | 147 | size_t res = iconv (cd_88591_to_utf8, |
134 | (char **) &inptr, &inbytesleft, | 148 | &inptr, &inbytesleft, |
135 | &outptr, &outbytesleft); | 149 | &outptr, &outbytesleft); |
136 | if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) | 150 | if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) |
137 | result |= 4; | 151 | result |= 4; |
@@ -144,14 +158,14 @@ int main () | |||
144 | iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); | 158 | iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); |
145 | if (cd_88591_to_utf8 != (iconv_t)(-1)) | 159 | if (cd_88591_to_utf8 != (iconv_t)(-1)) |
146 | { | 160 | { |
147 | static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; | 161 | static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; |
148 | char buf[50]; | 162 | char buf[50]; |
149 | const char *inptr = input; | 163 | ICONV_CONST char *inptr = input; |
150 | size_t inbytesleft = strlen (input); | 164 | size_t inbytesleft = strlen (input); |
151 | char *outptr = buf; | 165 | char *outptr = buf; |
152 | size_t outbytesleft = sizeof (buf); | 166 | size_t outbytesleft = sizeof (buf); |
153 | size_t res = iconv (cd_88591_to_utf8, | 167 | size_t res = iconv (cd_88591_to_utf8, |
154 | (char **) &inptr, &inbytesleft, | 168 | &inptr, &inbytesleft, |
155 | &outptr, &outbytesleft); | 169 | &outptr, &outbytesleft); |
156 | if ((int)res > 0) | 170 | if ((int)res > 0) |
157 | result |= 8; | 171 | result |= 8; |
@@ -161,27 +175,36 @@ int main () | |||
161 | #endif | 175 | #endif |
162 | /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is | 176 | /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is |
163 | provided. */ | 177 | provided. */ |
164 | if (/* Try standardized names. */ | 178 | { |
165 | iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) | 179 | /* Try standardized names. */ |
166 | /* Try IRIX, OSF/1 names. */ | 180 | iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); |
167 | && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) | 181 | /* Try IRIX, OSF/1 names. */ |
168 | /* Try AIX names. */ | 182 | iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); |
169 | && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) | 183 | /* Try AIX names. */ |
170 | /* Try HP-UX names. */ | 184 | iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); |
171 | && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) | 185 | /* Try HP-UX names. */ |
172 | result |= 16; | 186 | iconv_t cd4 = iconv_open ("utf8", "eucJP"); |
187 | if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) | ||
188 | && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) | ||
189 | result |= 16; | ||
190 | if (cd1 != (iconv_t)(-1)) | ||
191 | iconv_close (cd1); | ||
192 | if (cd2 != (iconv_t)(-1)) | ||
193 | iconv_close (cd2); | ||
194 | if (cd3 != (iconv_t)(-1)) | ||
195 | iconv_close (cd3); | ||
196 | if (cd4 != (iconv_t)(-1)) | ||
197 | iconv_close (cd4); | ||
198 | } | ||
173 | return result; | 199 | return result; |
174 | }]])], | 200 | ]])], |
175 | [am_cv_func_iconv_works=yes], | 201 | [am_cv_func_iconv_works=yes], , |
176 | [am_cv_func_iconv_works=no], | 202 | [case "$host_os" in |
177 | [ | 203 | aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; |
178 | changequote(,)dnl | 204 | *) am_cv_func_iconv_works="guessing yes" ;; |
179 | case "$host_os" in | 205 | esac]) |
180 | aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; | 206 | test "$am_cv_func_iconv_works" = no || break |
181 | *) am_cv_func_iconv_works="guessing yes" ;; | 207 | done |
182 | esac | ||
183 | changequote([,])dnl | ||
184 | ]) | ||
185 | LIBS="$am_save_LIBS" | 208 | LIBS="$am_save_LIBS" |
186 | ]) | 209 | ]) |
187 | case "$am_cv_func_iconv_works" in | 210 | case "$am_cv_func_iconv_works" in |
@@ -209,60 +232,62 @@ changequote([,])dnl | |||
209 | AC_SUBST([LTLIBICONV]) | 232 | AC_SUBST([LTLIBICONV]) |
210 | ]) | 233 | ]) |
211 | 234 | ||
212 | dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to | 235 | dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like |
213 | dnl avoid warnings like | ||
214 | dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". | 236 | dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". |
215 | dnl This is tricky because of the way 'aclocal' is implemented: | 237 | AC_DEFUN_ONCE([AM_ICONV], |
216 | dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. | ||
217 | dnl Otherwise aclocal's initial scan pass would miss the macro definition. | ||
218 | dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. | ||
219 | dnl Otherwise aclocal would emit many "Use of uninitialized value $1" | ||
220 | dnl warnings. | ||
221 | m4_define([gl_iconv_AC_DEFUN], | ||
222 | m4_version_prereq([2.64], | ||
223 | [[AC_DEFUN_ONCE( | ||
224 | [$1], [$2])]], | ||
225 | [m4_ifdef([gl_00GNULIB], | ||
226 | [[AC_DEFUN_ONCE( | ||
227 | [$1], [$2])]], | ||
228 | [[AC_DEFUN( | ||
229 | [$1], [$2])]])])) | ||
230 | gl_iconv_AC_DEFUN([AM_ICONV], | ||
231 | [ | 238 | [ |
232 | AM_ICONV_LINK | 239 | AM_ICONV_LINK |
233 | if test "$am_cv_func_iconv" = yes; then | 240 | if test "$am_cv_func_iconv" = yes; then |
234 | AC_MSG_CHECKING([for iconv declaration]) | 241 | AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], |
235 | AC_CACHE_VAL([am_cv_proto_iconv], [ | 242 | [gl_cv_iconv_nonconst], |
236 | AC_COMPILE_IFELSE( | 243 | [AC_COMPILE_IFELSE( |
237 | [AC_LANG_PROGRAM( | 244 | [AC_LANG_PROGRAM( |
238 | [[ | 245 | [[ |
239 | #include <stdlib.h> | 246 | #include <stdlib.h> |
240 | #include <iconv.h> | 247 | #include <iconv.h> |
241 | extern | 248 | extern |
242 | #ifdef __cplusplus | 249 | #ifdef __cplusplus |
243 | "C" | 250 | "C" |
244 | #endif | 251 | #endif |
245 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) | ||
246 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | 252 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
247 | #else | 253 | ]], |
248 | size_t iconv(); | 254 | [[]])], |
249 | #endif | 255 | [gl_cv_iconv_nonconst=yes], |
250 | ]], | 256 | [gl_cv_iconv_nonconst=no]) |
251 | [[]])], | ||
252 | [am_cv_proto_iconv_arg1=""], | ||
253 | [am_cv_proto_iconv_arg1="const"]) | ||
254 | am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) | ||
255 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` | ||
256 | AC_MSG_RESULT([ | ||
257 | $am_cv_proto_iconv]) | ||
258 | AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], | ||
259 | [Define as const if the declaration of iconv() needs const.]) | ||
260 | dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. | ||
261 | m4_ifdef([gl_ICONV_H_DEFAULTS], | ||
262 | [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) | ||
263 | if test -n "$am_cv_proto_iconv_arg1"; then | ||
264 | ICONV_CONST="const" | ||
265 | fi | ||
266 | ]) | 257 | ]) |
258 | else | ||
259 | dnl When compiling GNU libiconv on a system that does not have iconv yet, | ||
260 | dnl pick the POSIX compliant declaration without 'const'. | ||
261 | gl_cv_iconv_nonconst=yes | ||
262 | fi | ||
263 | if test $gl_cv_iconv_nonconst = yes; then | ||
264 | iconv_arg1="" | ||
265 | else | ||
266 | iconv_arg1="const" | ||
267 | fi | ||
268 | AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], | ||
269 | [Define as const if the declaration of iconv() needs const.]) | ||
270 | dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. | ||
271 | m4_ifdef([gl_ICONV_H_DEFAULTS], | ||
272 | [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) | ||
273 | if test $gl_cv_iconv_nonconst != yes; then | ||
274 | ICONV_CONST="const" | ||
275 | fi | ||
276 | ]) | ||
277 | |||
278 | dnl A summary result, for those packages which want to print a summary at the | ||
279 | dnl end of the configuration. | ||
280 | if test "$am_func_iconv" = yes; then | ||
281 | if test -n "$LIBICONV"; then | ||
282 | am_cv_func_iconv_summary='yes, in libiconv' | ||
283 | else | ||
284 | am_cv_func_iconv_summary='yes, in libc' | ||
285 | fi | ||
286 | else | ||
287 | if test "$am_cv_func_iconv" = yes; then | ||
288 | am_cv_func_iconv_summary='not working, consider installing GNU libiconv' | ||
289 | else | ||
290 | am_cv_func_iconv_summary='no, consider installing GNU libiconv' | ||
291 | fi | ||
267 | fi | 292 | fi |
268 | ]) | 293 | ]) |
diff --git a/gl/m4/idpriv.m4 b/gl/m4/idpriv.m4 index 167f523..fc3dd17 100644 --- a/gl/m4/idpriv.m4 +++ b/gl/m4/idpriv.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # idpriv.m4 serial 1 | 1 | # idpriv.m4 serial 1 |
2 | dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index 108d945..9f19215 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 | |||
@@ -1,12 +1,13 @@ | |||
1 | # include_next.m4 serial 23 | 1 | # include_next.m4 serial 26 |
2 | dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Paul Eggert and Derek Price. | 7 | dnl From Paul Eggert and Derek Price. |
8 | 8 | ||
9 | dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. | 9 | dnl Sets INCLUDE_NEXT, INCLUDE_NEXT_AS_FIRST_DIRECTIVE, PRAGMA_SYSTEM_HEADER, |
10 | dnl and PRAGMA_COLUMNS. | ||
10 | dnl | 11 | dnl |
11 | dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to | 12 | dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to |
12 | dnl 'include' otherwise. | 13 | dnl 'include' otherwise. |
@@ -105,19 +106,21 @@ dnl We intentionally avoid using AC_LANG_SOURCE here. | |||
105 | AC_SUBST([INCLUDE_NEXT]) | 106 | AC_SUBST([INCLUDE_NEXT]) |
106 | AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) | 107 | AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) |
107 | AC_SUBST([PRAGMA_SYSTEM_HEADER]) | 108 | AC_SUBST([PRAGMA_SYSTEM_HEADER]) |
108 | AC_CACHE_CHECK([whether system header files limit the line length], | 109 | |
109 | [gl_cv_pragma_columns], | 110 | dnl HP NonStop systems, which define __TANDEM, limit the line length |
110 | [dnl HP NonStop systems, which define __TANDEM, have this misfeature. | 111 | dnl after including some system header files. |
111 | AC_EGREP_CPP([choke me], | 112 | AC_CACHE_CHECK([whether source code line length is unlimited], |
113 | [gl_cv_source_line_length_unlimited], | ||
114 | [AC_EGREP_CPP([choke me], | ||
112 | [ | 115 | [ |
113 | #ifdef __TANDEM | 116 | #ifdef __TANDEM |
114 | choke me | 117 | choke me |
115 | #endif | 118 | #endif |
116 | ], | 119 | ], |
117 | [gl_cv_pragma_columns=yes], | 120 | [gl_cv_source_line_length_unlimited=no], |
118 | [gl_cv_pragma_columns=no]) | 121 | [gl_cv_source_line_length_unlimited=yes]) |
119 | ]) | 122 | ]) |
120 | if test $gl_cv_pragma_columns = yes; then | 123 | if test $gl_cv_source_line_length_unlimited = no; then |
121 | PRAGMA_COLUMNS="#pragma COLUMNS 10000" | 124 | PRAGMA_COLUMNS="#pragma COLUMNS 10000" |
122 | else | 125 | else |
123 | PRAGMA_COLUMNS= | 126 | PRAGMA_COLUMNS= |
@@ -175,89 +178,40 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], | |||
175 | [AC_CHECK_HEADERS_ONCE([$1]) | 178 | [AC_CHECK_HEADERS_ONCE([$1]) |
176 | ]) | 179 | ]) |
177 | 180 | ||
178 | dnl FIXME: gl_next_header and gl_header_exists must be used unquoted | ||
179 | dnl until we can assume autoconf 2.64 or newer. | ||
180 | m4_foreach_w([gl_HEADER_NAME], [$1], | 181 | m4_foreach_w([gl_HEADER_NAME], [$1], |
181 | [AS_VAR_PUSHDEF([gl_next_header], | 182 | [AS_VAR_PUSHDEF([gl_next_header], |
182 | [gl_cv_next_]m4_defn([gl_HEADER_NAME])) | 183 | [gl_cv_next_]m4_defn([gl_HEADER_NAME])) |
183 | if test $gl_cv_have_include_next = yes; then | 184 | if test $gl_cv_have_include_next = yes; then |
184 | AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) | 185 | AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) |
185 | else | 186 | else |
186 | AC_CACHE_CHECK( | 187 | AC_CACHE_CHECK( |
187 | [absolute name of <]m4_defn([gl_HEADER_NAME])[>], | 188 | [absolute name of <]m4_defn([gl_HEADER_NAME])[>], |
188 | m4_defn([gl_next_header]), | 189 | [gl_next_header], |
189 | [m4_if([$2], [check], | 190 | [m4_if([$2], [check], |
190 | [AS_VAR_PUSHDEF([gl_header_exists], | 191 | [AS_VAR_PUSHDEF([gl_header_exists], |
191 | [ac_cv_header_]m4_defn([gl_HEADER_NAME])) | 192 | [ac_cv_header_]m4_defn([gl_HEADER_NAME])) |
192 | if test AS_VAR_GET(gl_header_exists) = yes; then | 193 | if test AS_VAR_GET([gl_header_exists]) = yes; then |
193 | AS_VAR_POPDEF([gl_header_exists]) | 194 | AS_VAR_POPDEF([gl_header_exists]) |
194 | ]) | 195 | ]) |
195 | AC_LANG_CONFTEST( | 196 | gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) |
196 | [AC_LANG_SOURCE( | 197 | AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) |
197 | [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] | 198 | AS_VAR_SET([gl_next_header], ['"'$gl_header'"']) |
198 | )]) | ||
199 | dnl AIX "xlc -E" and "cc -E" omit #line directives for header | ||
200 | dnl files that contain only a #include of other header files and | ||
201 | dnl no non-comment tokens of their own. This leads to a failure | ||
202 | dnl to detect the absolute name of <dirent.h>, <signal.h>, | ||
203 | dnl <poll.h> and others. The workaround is to force preservation | ||
204 | dnl of comments through option -C. This ensures all necessary | ||
205 | dnl #line directives are present. GCC supports option -C as well. | ||
206 | case "$host_os" in | ||
207 | aix*) gl_absname_cpp="$ac_cpp -C" ;; | ||
208 | *) gl_absname_cpp="$ac_cpp" ;; | ||
209 | esac | ||
210 | changequote(,) | ||
211 | case "$host_os" in | ||
212 | mingw*) | ||
213 | dnl For the sake of native Windows compilers (excluding gcc), | ||
214 | dnl treat backslash as a directory separator, like /. | ||
215 | dnl Actually, these compilers use a double-backslash as | ||
216 | dnl directory separator, inside the | ||
217 | dnl # line "filename" | ||
218 | dnl directives. | ||
219 | gl_dirsep_regex='[/\\]' | ||
220 | ;; | ||
221 | *) | ||
222 | gl_dirsep_regex='\/' | ||
223 | ;; | ||
224 | esac | ||
225 | dnl A sed expression that turns a string into a basic regular | ||
226 | dnl expression, for use within "/.../". | ||
227 | gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' | ||
228 | changequote([,]) | ||
229 | gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \ | ||
230 | | sed -e "$gl_make_literal_regex_sed"` | ||
231 | gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ | ||
232 | s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ | ||
233 | changequote(,)dnl | ||
234 | s|^/[^/]|//&| | ||
235 | changequote([,])dnl | ||
236 | p | ||
237 | q | ||
238 | }' | ||
239 | dnl eval is necessary to expand gl_absname_cpp. | ||
240 | dnl Ultrix and Pyramid sh refuse to redirect output of eval, | ||
241 | dnl so use subshell. | ||
242 | AS_VAR_SET(gl_next_header, | ||
243 | ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | | ||
244 | sed -n "$gl_absolute_header_sed"`'"']) | ||
245 | m4_if([$2], [check], | 199 | m4_if([$2], [check], |
246 | [else | 200 | [else |
247 | AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) | 201 | AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) |
248 | fi | 202 | fi |
249 | ]) | 203 | ]) |
250 | ]) | 204 | ]) |
251 | fi | 205 | fi |
252 | AC_SUBST( | 206 | AC_SUBST( |
253 | AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), | 207 | AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), |
254 | [AS_VAR_GET(gl_next_header)]) | 208 | [AS_VAR_GET([gl_next_header])]) |
255 | if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then | 209 | if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then |
256 | # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' | 210 | # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' |
257 | gl_next_as_first_directive='<'gl_HEADER_NAME'>' | 211 | gl_next_as_first_directive='<'gl_HEADER_NAME'>' |
258 | else | 212 | else |
259 | # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' | 213 | # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' |
260 | gl_next_as_first_directive=AS_VAR_GET(gl_next_header) | 214 | gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) |
261 | fi | 215 | fi |
262 | AC_SUBST( | 216 | AC_SUBST( |
263 | AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), | 217 | AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), |
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 476f063..48822d6 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # inet_ntop.m4 serial 19 | 1 | # inet_ntop.m4 serial 21 |
2 | dnl Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_INET_NTOP], | |||
16 | dnl Most platforms that provide inet_ntop define it in libc. | 16 | dnl Most platforms that provide inet_ntop define it in libc. |
17 | dnl Solaris 8..10 provide inet_ntop in libnsl instead. | 17 | dnl Solaris 8..10 provide inet_ntop in libnsl instead. |
18 | dnl Solaris 2.6..7 provide inet_ntop in libresolv instead. | 18 | dnl Solaris 2.6..7 provide inet_ntop in libresolv instead. |
19 | dnl Haiku provides it in -lnetwork. | ||
19 | dnl Native Windows provides it in -lws2_32 instead, with a declaration in | 20 | dnl Native Windows provides it in -lws2_32 instead, with a declaration in |
20 | dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl | 21 | dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl |
21 | dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). | 22 | dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). |
@@ -23,19 +24,20 @@ AC_DEFUN([gl_FUNC_INET_NTOP], | |||
23 | INET_NTOP_LIB= | 24 | INET_NTOP_LIB= |
24 | gl_PREREQ_SYS_H_WINSOCK2 | 25 | gl_PREREQ_SYS_H_WINSOCK2 |
25 | if test $HAVE_WINSOCK2_H = 1; then | 26 | if test $HAVE_WINSOCK2_H = 1; then |
27 | dnl It needs to be overridden, because the stdcall calling convention | ||
28 | dnl is not compliant with POSIX. Set REPLACE_INET_NTOP in order to avoid | ||
29 | dnl a name conflict at the linker level, even though the header file | ||
30 | dnl <ws2tcpip.h> declares inet_ntop only if _WIN32_WINNT >= 0x0600. | ||
31 | REPLACE_INET_NTOP=1 | ||
26 | AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]]) | 32 | AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]]) |
27 | if test $ac_cv_have_decl_inet_ntop = yes; then | 33 | if test $ac_cv_have_decl_inet_ntop = yes; then |
28 | dnl It needs to be overridden, because the stdcall calling convention | ||
29 | dnl is not compliant with POSIX. | ||
30 | REPLACE_INET_NTOP=1 | ||
31 | INET_NTOP_LIB="-lws2_32" | 34 | INET_NTOP_LIB="-lws2_32" |
32 | else | 35 | else |
33 | HAVE_DECL_INET_NTOP=0 | 36 | HAVE_DECL_INET_NTOP=0 |
34 | HAVE_INET_NTOP=0 | ||
35 | fi | 37 | fi |
36 | else | 38 | else |
37 | gl_save_LIBS=$LIBS | 39 | gl_save_LIBS=$LIBS |
38 | AC_SEARCH_LIBS([inet_ntop], [nsl resolv], [], | 40 | AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], |
39 | [AC_CHECK_FUNCS([inet_ntop]) | 41 | [AC_CHECK_FUNCS([inet_ntop]) |
40 | if test $ac_cv_func_inet_ntop = no; then | 42 | if test $ac_cv_func_inet_ntop = no; then |
41 | HAVE_INET_NTOP=0 | 43 | HAVE_INET_NTOP=0 |
diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4 deleted file mode 100644 index 74d0e80..0000000 --- a/gl/m4/intdiv0.m4 +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | # intdiv0.m4 serial 6 (gettext-0.18.2) | ||
2 | dnl Copyright (C) 2002, 2007-2008, 2010-2013 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 | |||
9 | AC_DEFUN([gt_INTDIV0], | ||
10 | [ | ||
11 | AC_REQUIRE([AC_PROG_CC])dnl | ||
12 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
13 | |||
14 | AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], | ||
15 | gt_cv_int_divbyzero_sigfpe, | ||
16 | [ | ||
17 | gt_cv_int_divbyzero_sigfpe= | ||
18 | changequote(,)dnl | ||
19 | case "$host_os" in | ||
20 | macos* | darwin[6-9]* | darwin[1-9][0-9]*) | ||
21 | # On Mac OS X 10.2 or newer, just assume the same as when cross- | ||
22 | # compiling. If we were to perform the real test, 1 Crash Report | ||
23 | # dialog window would pop up. | ||
24 | case "$host_cpu" in | ||
25 | i[34567]86 | x86_64) | ||
26 | gt_cv_int_divbyzero_sigfpe="guessing yes" ;; | ||
27 | esac | ||
28 | ;; | ||
29 | esac | ||
30 | changequote([,])dnl | ||
31 | if test -z "$gt_cv_int_divbyzero_sigfpe"; then | ||
32 | AC_RUN_IFELSE( | ||
33 | [AC_LANG_SOURCE([[ | ||
34 | #include <stdlib.h> | ||
35 | #include <signal.h> | ||
36 | |||
37 | static void | ||
38 | sigfpe_handler (int sig) | ||
39 | { | ||
40 | /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ | ||
41 | exit (sig != SIGFPE); | ||
42 | } | ||
43 | |||
44 | int x = 1; | ||
45 | int y = 0; | ||
46 | int z; | ||
47 | int nan; | ||
48 | |||
49 | int main () | ||
50 | { | ||
51 | signal (SIGFPE, sigfpe_handler); | ||
52 | /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ | ||
53 | #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) | ||
54 | signal (SIGTRAP, sigfpe_handler); | ||
55 | #endif | ||
56 | /* Linux/SPARC yields signal SIGILL. */ | ||
57 | #if defined (__sparc__) && defined (__linux__) | ||
58 | signal (SIGILL, sigfpe_handler); | ||
59 | #endif | ||
60 | |||
61 | z = x / y; | ||
62 | nan = y / y; | ||
63 | exit (2); | ||
64 | } | ||
65 | ]])], | ||
66 | [gt_cv_int_divbyzero_sigfpe=yes], | ||
67 | [gt_cv_int_divbyzero_sigfpe=no], | ||
68 | [ | ||
69 | # Guess based on the CPU. | ||
70 | changequote(,)dnl | ||
71 | case "$host_cpu" in | ||
72 | alpha* | i[34567]86 | x86_64 | m68k | s390*) | ||
73 | gt_cv_int_divbyzero_sigfpe="guessing yes";; | ||
74 | *) | ||
75 | gt_cv_int_divbyzero_sigfpe="guessing no";; | ||
76 | esac | ||
77 | changequote([,])dnl | ||
78 | ]) | ||
79 | fi | ||
80 | ]) | ||
81 | case "$gt_cv_int_divbyzero_sigfpe" in | ||
82 | *yes) value=1;; | ||
83 | *) value=0;; | ||
84 | esac | ||
85 | AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value], | ||
86 | [Define if integer division by zero raises signal SIGFPE.]) | ||
87 | ]) | ||
diff --git a/gl/m4/intl-thread-locale.m4 b/gl/m4/intl-thread-locale.m4 new file mode 100644 index 0000000..c231899 --- /dev/null +++ b/gl/m4/intl-thread-locale.m4 | |||
@@ -0,0 +1,219 @@ | |||
1 | # intl-thread-locale.m4 serial 9 | ||
2 | dnl Copyright (C) 2015-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 | dnl | ||
7 | dnl This file can be used in projects which are not available under | ||
8 | dnl the GNU General Public License or the GNU Lesser General Public | ||
9 | dnl License but which still want to provide support for the GNU gettext | ||
10 | dnl functionality. | ||
11 | dnl Please note that the actual code of the GNU gettext library is covered | ||
12 | dnl by the GNU Lesser General Public License, and the rest of the GNU | ||
13 | dnl gettext package is covered by the GNU General Public License. | ||
14 | dnl They are *not* in the public domain. | ||
15 | |||
16 | dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t). | ||
17 | dnl Sets gt_nameless_locales. | ||
18 | AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME], | ||
19 | [ | ||
20 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
21 | |||
22 | dnl Persuade Solaris <locale.h> to define 'locale_t'. | ||
23 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
24 | |||
25 | dnl Test whether uselocale() exists and works at all. | ||
26 | gt_FUNC_USELOCALE | ||
27 | |||
28 | dnl On OpenBSD >= 6.2, the locale_t type and the uselocale(), newlocale(), | ||
29 | dnl duplocale(), freelocale() functions exist but are effectively useless, | ||
30 | dnl because the locale_t value depends only on the LC_CTYPE category of the | ||
31 | dnl locale and furthermore contains only one bit of information (it | ||
32 | dnl distinguishes the "C" locale from the *.UTF-8 locales). See | ||
33 | dnl <https://cvsweb.openbsd.org/src/lib/libc/locale/newlocale.c?rev=1.1&content-type=text/x-cvsweb-markup>. | ||
34 | dnl In the setlocale() implementation they have thought about the programs | ||
35 | dnl that use the API ("Even though only LC_CTYPE has any effect in the | ||
36 | dnl OpenBSD base system, store complete information about the global locale, | ||
37 | dnl such that third-party software can access it"), but for uselocale() | ||
38 | dnl they did not think about the programs. | ||
39 | dnl In this situation, even the HAVE_NAMELESS_LOCALES support does not work. | ||
40 | dnl So, define HAVE_FAKE_LOCALES and disable all locale_t support. | ||
41 | case "$gt_cv_func_uselocale_works" in | ||
42 | *yes) | ||
43 | AC_CHECK_HEADERS_ONCE([xlocale.h]) | ||
44 | AC_CACHE_CHECK([for fake locale system (OpenBSD)], | ||
45 | [gt_cv_locale_fake], | ||
46 | [AC_RUN_IFELSE( | ||
47 | [AC_LANG_SOURCE([[ | ||
48 | #include <locale.h> | ||
49 | #if HAVE_XLOCALE_H | ||
50 | # include <xlocale.h> | ||
51 | #endif | ||
52 | int main () | ||
53 | { | ||
54 | locale_t loc1, loc2; | ||
55 | if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) return 1; | ||
56 | if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) return 1; | ||
57 | loc1 = newlocale (LC_ALL_MASK, "de_DE.UTF-8", (locale_t)0); | ||
58 | loc2 = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", (locale_t)0); | ||
59 | return !(loc1 == loc2); | ||
60 | }]])], | ||
61 | [gt_cv_locale_fake=yes], | ||
62 | [gt_cv_locale_fake=no], | ||
63 | [dnl Guess the locale system is fake only on OpenBSD. | ||
64 | case "$host_os" in | ||
65 | openbsd*) gt_cv_locale_fake="guessing yes" ;; | ||
66 | *) gt_cv_locale_fake="guessing no" ;; | ||
67 | esac | ||
68 | ]) | ||
69 | ]) | ||
70 | ;; | ||
71 | *) gt_cv_locale_fake=no ;; | ||
72 | esac | ||
73 | case "$gt_cv_locale_fake" in | ||
74 | *yes) | ||
75 | gt_fake_locales=yes | ||
76 | AC_DEFINE([HAVE_FAKE_LOCALES], [1], | ||
77 | [Define if the locale_t type contains insufficient information, as on OpenBSD.]) | ||
78 | ;; | ||
79 | *) | ||
80 | gt_fake_locales=no | ||
81 | ;; | ||
82 | esac | ||
83 | |||
84 | case "$gt_cv_func_uselocale_works" in | ||
85 | *yes) | ||
86 | AC_CACHE_CHECK([for Solaris 11.4 locale system], | ||
87 | [gt_cv_locale_solaris114], | ||
88 | [case "$host_os" in | ||
89 | solaris*) | ||
90 | dnl Test whether <locale.h> defines locale_t as a typedef of | ||
91 | dnl 'struct _LC_locale_t **' (whereas Illumos defines it as a | ||
92 | dnl typedef of 'struct _locale *'). | ||
93 | dnl Another possible test would be to include <sys/localedef.h> | ||
94 | dnl and test whether it defines the _LC_core_data_locale_t type. | ||
95 | dnl This type was added in Solaris 11.4. | ||
96 | AC_COMPILE_IFELSE( | ||
97 | [AC_LANG_PROGRAM([[ | ||
98 | #include <locale.h> | ||
99 | struct _LC_locale_t *x; | ||
100 | locale_t y; | ||
101 | ]], | ||
102 | [[*y = x;]])], | ||
103 | [gt_cv_locale_solaris114=yes], | ||
104 | [gt_cv_locale_solaris114=no]) | ||
105 | ;; | ||
106 | *) gt_cv_locale_solaris114=no ;; | ||
107 | esac | ||
108 | ]) | ||
109 | ;; | ||
110 | *) gt_cv_locale_solaris114=no ;; | ||
111 | esac | ||
112 | if test $gt_cv_locale_solaris114 = yes; then | ||
113 | AC_DEFINE([HAVE_SOLARIS114_LOCALES], [1], | ||
114 | [Define if the locale_t type is as on Solaris 11.4.]) | ||
115 | fi | ||
116 | |||
117 | dnl Solaris 12 will maybe provide getlocalename_l. If it does, it will | ||
118 | dnl improve the implementation of gl_locale_name_thread(), by removing | ||
119 | dnl the use of undocumented structures. | ||
120 | case "$gt_cv_func_uselocale_works" in | ||
121 | *yes) | ||
122 | AC_CHECK_FUNCS([getlocalename_l]) | ||
123 | ;; | ||
124 | esac | ||
125 | |||
126 | dnl This code is for platforms where the locale_t type does not provide access | ||
127 | dnl to the name of each locale category. This code has the drawback that it | ||
128 | dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale', | ||
129 | dnl which is a problem for GNU libunistring. Therefore try hard to avoid | ||
130 | dnl enabling this code! | ||
131 | gt_nameless_locales=no | ||
132 | case "$host_os" in | ||
133 | dnl It's needed on AIX 7.2. | ||
134 | aix*) | ||
135 | gt_nameless_locales=yes | ||
136 | AC_DEFINE([HAVE_NAMELESS_LOCALES], [1], | ||
137 | [Define if the locale_t type does not contain the name of each locale category.]) | ||
138 | ;; | ||
139 | esac | ||
140 | |||
141 | dnl We cannot support uselocale() on platforms where the locale_t type is | ||
142 | dnl fake. So, set | ||
143 | dnl gt_good_uselocale = gt_working_uselocale && !gt_fake_locales. | ||
144 | if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then | ||
145 | gt_good_uselocale=yes | ||
146 | AC_DEFINE([HAVE_GOOD_USELOCALE], [1], | ||
147 | [Define if the uselocale exists, may be safely called, and returns sufficient information.]) | ||
148 | else | ||
149 | gt_good_uselocale=no | ||
150 | fi | ||
151 | |||
152 | dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c | ||
153 | dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale | ||
154 | dnl names. | ||
155 | if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then | ||
156 | gt_localename_enhances_locale_funcs=yes | ||
157 | LOCALENAME_ENHANCE_LOCALE_FUNCS=1 | ||
158 | AC_DEFINE([LOCALENAME_ENHANCE_LOCALE_FUNCS], [1], | ||
159 | [Define if localename.c overrides newlocale(), duplocale(), freelocale().]) | ||
160 | else | ||
161 | gt_localename_enhances_locale_funcs=no | ||
162 | fi | ||
163 | ]) | ||
164 | |||
165 | dnl Tests whether uselocale() exists and is usable. | ||
166 | dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE. | ||
167 | AC_DEFUN([gt_FUNC_USELOCALE], | ||
168 | [ | ||
169 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
170 | |||
171 | dnl Persuade glibc and Solaris <locale.h> to define 'locale_t'. | ||
172 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
173 | |||
174 | AC_CHECK_FUNCS_ONCE([uselocale]) | ||
175 | |||
176 | dnl On AIX 7.2, the uselocale() function is not documented and leads to | ||
177 | dnl crashes in subsequent setlocale() invocations. | ||
178 | dnl In 2019, some versions of z/OS lack the locale_t type and have a broken | ||
179 | dnl uselocale function. | ||
180 | if test $ac_cv_func_uselocale = yes; then | ||
181 | AC_CHECK_HEADERS_ONCE([xlocale.h]) | ||
182 | AC_CACHE_CHECK([whether uselocale works], | ||
183 | [gt_cv_func_uselocale_works], | ||
184 | [AC_RUN_IFELSE( | ||
185 | [AC_LANG_SOURCE([[ | ||
186 | #include <locale.h> | ||
187 | #if HAVE_XLOCALE_H | ||
188 | # include <xlocale.h> | ||
189 | #endif | ||
190 | locale_t loc1; | ||
191 | int main () | ||
192 | { | ||
193 | uselocale (NULL); | ||
194 | setlocale (LC_ALL, "en_US.UTF-8"); | ||
195 | return 0; | ||
196 | }]])], | ||
197 | [gt_cv_func_uselocale_works=yes], | ||
198 | [gt_cv_func_uselocale_works=no], | ||
199 | [# Guess no on AIX and z/OS, yes otherwise. | ||
200 | case "$host_os" in | ||
201 | aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;; | ||
202 | *) gt_cv_func_uselocale_works="guessing yes" ;; | ||
203 | esac | ||
204 | ]) | ||
205 | ]) | ||
206 | else | ||
207 | gt_cv_func_uselocale_works=no | ||
208 | fi | ||
209 | case "$gt_cv_func_uselocale_works" in | ||
210 | *yes) | ||
211 | gt_working_uselocale=yes | ||
212 | AC_DEFINE([HAVE_WORKING_USELOCALE], [1], | ||
213 | [Define if the uselocale function exists and may safely be called.]) | ||
214 | ;; | ||
215 | *) | ||
216 | gt_working_uselocale=no | ||
217 | ;; | ||
218 | esac | ||
219 | ]) | ||
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4 deleted file mode 100644 index 959bd04..0000000 --- a/gl/m4/intl.m4 +++ /dev/null | |||
@@ -1,271 +0,0 @@ | |||
1 | # intl.m4 serial 23 (gettext-0.18.3) | ||
2 | dnl Copyright (C) 1995-2013 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 | dnl | ||
7 | dnl This file can can be used in projects which are not available under | ||
8 | dnl the GNU General Public License or the GNU Library General Public | ||
9 | dnl License but which still want to provide support for the GNU gettext | ||
10 | dnl functionality. | ||
11 | dnl Please note that the actual code of the GNU gettext library is covered | ||
12 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
13 | dnl gettext package package is covered by the GNU General Public License. | ||
14 | dnl They are *not* in the public domain. | ||
15 | |||
16 | dnl Authors: | ||
17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | ||
18 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009. | ||
19 | |||
20 | AC_PREREQ([2.60]) | ||
21 | |||
22 | dnl Checks for all prerequisites of the intl subdirectory, | ||
23 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, | ||
24 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. | ||
25 | AC_DEFUN([AM_INTL_SUBDIR], | ||
26 | [ | ||
27 | AC_REQUIRE([AC_PROG_INSTALL])dnl | ||
28 | AC_REQUIRE([AC_PROG_MKDIR_P])dnl | ||
29 | AC_REQUIRE([AC_PROG_CC])dnl | ||
30 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
31 | AC_REQUIRE([gt_GLIBC2])dnl | ||
32 | AC_REQUIRE([AC_PROG_RANLIB])dnl | ||
33 | AC_REQUIRE([gl_VISIBILITY])dnl | ||
34 | AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl | ||
35 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl | ||
36 | AC_REQUIRE([gt_TYPE_WCHAR_T])dnl | ||
37 | AC_REQUIRE([gt_TYPE_WINT_T])dnl | ||
38 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
39 | AC_REQUIRE([gt_TYPE_INTMAX_T]) | ||
40 | AC_REQUIRE([gt_PRINTF_POSIX]) | ||
41 | AC_REQUIRE([gl_GLIBC21])dnl | ||
42 | AC_REQUIRE([gl_XSIZE])dnl | ||
43 | AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl | ||
44 | AC_REQUIRE([gt_INTL_MACOSX])dnl | ||
45 | |||
46 | dnl Support for automake's --enable-silent-rules. | ||
47 | case "$enable_silent_rules" in | ||
48 | yes) INTL_DEFAULT_VERBOSITY=0;; | ||
49 | no) INTL_DEFAULT_VERBOSITY=1;; | ||
50 | *) INTL_DEFAULT_VERBOSITY=1;; | ||
51 | esac | ||
52 | AC_SUBST([INTL_DEFAULT_VERBOSITY]) | ||
53 | |||
54 | AC_CHECK_TYPE([ptrdiff_t], , | ||
55 | [AC_DEFINE([ptrdiff_t], [long], | ||
56 | [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) | ||
57 | ]) | ||
58 | AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h]) | ||
59 | AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \ | ||
60 | snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) | ||
61 | |||
62 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | ||
63 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | ||
64 | AC_CHECK_DECLS([_snprintf _snwprintf], , , [#include <stdio.h>]) | ||
65 | |||
66 | dnl Use the *_unlocked functions only if they are declared. | ||
67 | dnl (because some of them were defined without being declared in Solaris | ||
68 | dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built | ||
69 | dnl on Solaris 2.5.1 to run on Solaris 2.6). | ||
70 | AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>]) | ||
71 | |||
72 | case $gt_cv_func_printf_posix in | ||
73 | *yes) HAVE_POSIX_PRINTF=1 ;; | ||
74 | *) HAVE_POSIX_PRINTF=0 ;; | ||
75 | esac | ||
76 | AC_SUBST([HAVE_POSIX_PRINTF]) | ||
77 | if test "$ac_cv_func_asprintf" = yes; then | ||
78 | HAVE_ASPRINTF=1 | ||
79 | else | ||
80 | HAVE_ASPRINTF=0 | ||
81 | fi | ||
82 | AC_SUBST([HAVE_ASPRINTF]) | ||
83 | if test "$ac_cv_func_snprintf" = yes; then | ||
84 | HAVE_SNPRINTF=1 | ||
85 | else | ||
86 | HAVE_SNPRINTF=0 | ||
87 | fi | ||
88 | AC_SUBST([HAVE_SNPRINTF]) | ||
89 | if test "$ac_cv_func_newlocale" = yes; then | ||
90 | HAVE_NEWLOCALE=1 | ||
91 | else | ||
92 | HAVE_NEWLOCALE=0 | ||
93 | fi | ||
94 | AC_SUBST([HAVE_NEWLOCALE]) | ||
95 | if test "$ac_cv_func_wprintf" = yes; then | ||
96 | HAVE_WPRINTF=1 | ||
97 | else | ||
98 | HAVE_WPRINTF=0 | ||
99 | fi | ||
100 | AC_SUBST([HAVE_WPRINTF]) | ||
101 | |||
102 | AM_LANGINFO_CODESET | ||
103 | gt_LC_MESSAGES | ||
104 | |||
105 | dnl Compilation on mingw and Cygwin needs special Makefile rules, because | ||
106 | dnl 1. when we install a shared library, we must arrange to export | ||
107 | dnl auxiliary pointer variables for every exported variable, | ||
108 | dnl 2. when we install a shared library and a static library simultaneously, | ||
109 | dnl the include file specifies __declspec(dllimport) and therefore we | ||
110 | dnl must arrange to define the auxiliary pointer variables for the | ||
111 | dnl exported variables _also_ in the static library. | ||
112 | if test "$enable_shared" = yes; then | ||
113 | case "$host_os" in | ||
114 | mingw* | cygwin*) is_woe32dll=yes ;; | ||
115 | *) is_woe32dll=no ;; | ||
116 | esac | ||
117 | else | ||
118 | is_woe32dll=no | ||
119 | fi | ||
120 | WOE32DLL=$is_woe32dll | ||
121 | AC_SUBST([WOE32DLL]) | ||
122 | |||
123 | dnl On mingw and Cygwin, we can activate special Makefile rules which add | ||
124 | dnl version information to the shared libraries and executables. | ||
125 | case "$host_os" in | ||
126 | mingw* | cygwin*) is_woe32=yes ;; | ||
127 | *) is_woe32=no ;; | ||
128 | esac | ||
129 | WOE32=$is_woe32 | ||
130 | AC_SUBST([WOE32]) | ||
131 | if test $WOE32 = yes; then | ||
132 | dnl Check for a program that compiles Windows resource files. | ||
133 | AC_CHECK_TOOL([WINDRES], [windres]) | ||
134 | fi | ||
135 | |||
136 | dnl Determine whether when creating a library, "-lc" should be passed to | ||
137 | dnl libtool or not. On many platforms, it is required for the libtool option | ||
138 | dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool | ||
139 | dnl in the *.la files - makes it impossible to create multithreaded programs, | ||
140 | dnl because libtool also reorders the -lc to come before the -pthread, and | ||
141 | dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>. | ||
142 | case "$host_os" in | ||
143 | hpux*) LTLIBC="" ;; | ||
144 | *) LTLIBC="-lc" ;; | ||
145 | esac | ||
146 | AC_SUBST([LTLIBC]) | ||
147 | |||
148 | dnl Rename some macros and functions used for locking. | ||
149 | AH_BOTTOM([ | ||
150 | #define __libc_lock_t gl_lock_t | ||
151 | #define __libc_lock_define gl_lock_define | ||
152 | #define __libc_lock_define_initialized gl_lock_define_initialized | ||
153 | #define __libc_lock_init gl_lock_init | ||
154 | #define __libc_lock_lock gl_lock_lock | ||
155 | #define __libc_lock_unlock gl_lock_unlock | ||
156 | #define __libc_lock_recursive_t gl_recursive_lock_t | ||
157 | #define __libc_lock_define_recursive gl_recursive_lock_define | ||
158 | #define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized | ||
159 | #define __libc_lock_init_recursive gl_recursive_lock_init | ||
160 | #define __libc_lock_lock_recursive gl_recursive_lock_lock | ||
161 | #define __libc_lock_unlock_recursive gl_recursive_lock_unlock | ||
162 | #define glthread_in_use libintl_thread_in_use | ||
163 | #define glthread_lock_init_func libintl_lock_init_func | ||
164 | #define glthread_lock_lock_func libintl_lock_lock_func | ||
165 | #define glthread_lock_unlock_func libintl_lock_unlock_func | ||
166 | #define glthread_lock_destroy_func libintl_lock_destroy_func | ||
167 | #define glthread_rwlock_init_multithreaded libintl_rwlock_init_multithreaded | ||
168 | #define glthread_rwlock_init_func libintl_rwlock_init_func | ||
169 | #define glthread_rwlock_rdlock_multithreaded libintl_rwlock_rdlock_multithreaded | ||
170 | #define glthread_rwlock_rdlock_func libintl_rwlock_rdlock_func | ||
171 | #define glthread_rwlock_wrlock_multithreaded libintl_rwlock_wrlock_multithreaded | ||
172 | #define glthread_rwlock_wrlock_func libintl_rwlock_wrlock_func | ||
173 | #define glthread_rwlock_unlock_multithreaded libintl_rwlock_unlock_multithreaded | ||
174 | #define glthread_rwlock_unlock_func libintl_rwlock_unlock_func | ||
175 | #define glthread_rwlock_destroy_multithreaded libintl_rwlock_destroy_multithreaded | ||
176 | #define glthread_rwlock_destroy_func libintl_rwlock_destroy_func | ||
177 | #define glthread_recursive_lock_init_multithreaded libintl_recursive_lock_init_multithreaded | ||
178 | #define glthread_recursive_lock_init_func libintl_recursive_lock_init_func | ||
179 | #define glthread_recursive_lock_lock_multithreaded libintl_recursive_lock_lock_multithreaded | ||
180 | #define glthread_recursive_lock_lock_func libintl_recursive_lock_lock_func | ||
181 | #define glthread_recursive_lock_unlock_multithreaded libintl_recursive_lock_unlock_multithreaded | ||
182 | #define glthread_recursive_lock_unlock_func libintl_recursive_lock_unlock_func | ||
183 | #define glthread_recursive_lock_destroy_multithreaded libintl_recursive_lock_destroy_multithreaded | ||
184 | #define glthread_recursive_lock_destroy_func libintl_recursive_lock_destroy_func | ||
185 | #define glthread_once_func libintl_once_func | ||
186 | #define glthread_once_singlethreaded libintl_once_singlethreaded | ||
187 | #define glthread_once_multithreaded libintl_once_multithreaded | ||
188 | ]) | ||
189 | ]) | ||
190 | |||
191 | |||
192 | dnl Checks for the core files of the intl subdirectory: | ||
193 | dnl dcigettext.c | ||
194 | dnl eval-plural.h | ||
195 | dnl explodename.c | ||
196 | dnl finddomain.c | ||
197 | dnl gettextP.h | ||
198 | dnl gmo.h | ||
199 | dnl hash-string.h hash-string.c | ||
200 | dnl l10nflist.c | ||
201 | dnl libgnuintl.h.in (except the *printf stuff) | ||
202 | dnl loadinfo.h | ||
203 | dnl loadmsgcat.c | ||
204 | dnl localealias.c | ||
205 | dnl log.c | ||
206 | dnl plural-exp.h plural-exp.c | ||
207 | dnl plural.y | ||
208 | dnl Used by libglocale. | ||
209 | AC_DEFUN([gt_INTL_SUBDIR_CORE], | ||
210 | [ | ||
211 | AC_REQUIRE([AC_C_INLINE])dnl | ||
212 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | ||
213 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
214 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | ||
215 | AC_REQUIRE([AC_FUNC_MMAP])dnl | ||
216 | AC_REQUIRE([gt_INTDIV0])dnl | ||
217 | AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl | ||
218 | AC_REQUIRE([gt_INTTYPES_PRI])dnl | ||
219 | AC_REQUIRE([gl_LOCK])dnl | ||
220 | |||
221 | AC_LINK_IFELSE( | ||
222 | [AC_LANG_PROGRAM( | ||
223 | [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]], | ||
224 | [[]])], | ||
225 | [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], | ||
226 | [Define to 1 if the compiler understands __builtin_expect.])]) | ||
227 | |||
228 | AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h]) | ||
229 | AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \ | ||
230 | stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \ | ||
231 | argz_stringify argz_next __fsetlocking]) | ||
232 | |||
233 | dnl Use the *_unlocked functions only if they are declared. | ||
234 | dnl (because some of them were defined without being declared in Solaris | ||
235 | dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built | ||
236 | dnl on Solaris 2.5.1 to run on Solaris 2.6). | ||
237 | AC_CHECK_DECLS([feof_unlocked fgets_unlocked], , , [#include <stdio.h>]) | ||
238 | |||
239 | AM_ICONV | ||
240 | |||
241 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | ||
242 | dnl because plural.y uses bison specific features. It requires at least | ||
243 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't | ||
244 | dnl compile. | ||
245 | dnl bison is only needed for the maintainer (who touches plural.y). But in | ||
246 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put | ||
247 | dnl the rule in general Makefile. Now, some people carelessly touch the | ||
248 | dnl files or have a broken "make" program, hence the plural.c rule will | ||
249 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not | ||
250 | dnl present or too old. | ||
251 | AC_CHECK_PROGS([INTLBISON], [bison]) | ||
252 | if test -z "$INTLBISON"; then | ||
253 | ac_verc_fail=yes | ||
254 | else | ||
255 | dnl Found it, now check the version. | ||
256 | AC_MSG_CHECKING([version of bison]) | ||
257 | changequote(<<,>>)dnl | ||
258 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` | ||
259 | case $ac_prog_version in | ||
260 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; | ||
261 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) | ||
262 | changequote([,])dnl | ||
263 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; | ||
264 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; | ||
265 | esac | ||
266 | AC_MSG_RESULT([$ac_prog_version]) | ||
267 | fi | ||
268 | if test $ac_verc_fail = yes; then | ||
269 | INTLBISON=: | ||
270 | fi | ||
271 | ]) | ||
diff --git a/gl/m4/intldir.m4 b/gl/m4/intldir.m4 deleted file mode 100644 index 388ecd6..0000000 --- a/gl/m4/intldir.m4 +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # intldir.m4 serial 2 (gettext-0.18) | ||
2 | dnl Copyright (C) 2006, 2009-2013 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 | dnl | ||
7 | dnl This file can can be used in projects which are not available under | ||
8 | dnl the GNU General Public License or the GNU Library General Public | ||
9 | dnl License but which still want to provide support for the GNU gettext | ||
10 | dnl functionality. | ||
11 | dnl Please note that the actual code of the GNU gettext library is covered | ||
12 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
13 | dnl gettext package package is covered by the GNU General Public License. | ||
14 | dnl They are *not* in the public domain. | ||
15 | |||
16 | AC_PREREQ([2.52]) | ||
17 | |||
18 | dnl Tells the AM_GNU_GETTEXT macro to consider an intl/ directory. | ||
19 | AC_DEFUN([AM_GNU_GETTEXT_INTL_SUBDIR], []) | ||
diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4 index ab97d39..81eefd7 100644 --- a/gl/m4/intlmacosx.m4 +++ b/gl/m4/intlmacosx.m4 | |||
@@ -1,23 +1,23 @@ | |||
1 | # intlmacosx.m4 serial 5 (gettext-0.18.2) | 1 | # intlmacosx.m4 serial 8 (gettext-0.20.2) |
2 | dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004-2014, 2016, 2019-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl | 6 | dnl |
7 | dnl This file can can be used in projects which are not available under | 7 | dnl This file can be used in projects which are not available under |
8 | dnl the GNU General Public License or the GNU Library General Public | 8 | dnl the GNU General Public License or the GNU Lesser General Public |
9 | dnl License but which still want to provide support for the GNU gettext | 9 | dnl License but which still want to provide support for the GNU gettext |
10 | dnl functionality. | 10 | dnl functionality. |
11 | dnl Please note that the actual code of the GNU gettext library is covered | 11 | dnl Please note that the actual code of the GNU gettext library is covered |
12 | dnl by the GNU Library General Public License, and the rest of the GNU | 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU |
13 | dnl gettext package package is covered by the GNU General Public License. | 13 | dnl gettext package is covered by the GNU General Public License. |
14 | dnl They are *not* in the public domain. | 14 | dnl They are *not* in the public domain. |
15 | 15 | ||
16 | dnl Checks for special options needed on Mac OS X. | 16 | dnl Checks for special options needed on Mac OS X. |
17 | dnl Defines INTL_MACOSX_LIBS. | 17 | dnl Defines INTL_MACOSX_LIBS. |
18 | AC_DEFUN([gt_INTL_MACOSX], | 18 | AC_DEFUN([gt_INTL_MACOSX], |
19 | [ | 19 | [ |
20 | dnl Check for API introduced in Mac OS X 10.2. | 20 | dnl Check for API introduced in Mac OS X 10.4. |
21 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], | 21 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], |
22 | [gt_cv_func_CFPreferencesCopyAppValue], | 22 | [gt_cv_func_CFPreferencesCopyAppValue], |
23 | [gt_save_LIBS="$LIBS" | 23 | [gt_save_LIBS="$LIBS" |
@@ -33,23 +33,32 @@ AC_DEFUN([gt_INTL_MACOSX], | |||
33 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], | 33 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], |
34 | [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) | 34 | [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) |
35 | fi | 35 | fi |
36 | dnl Check for API introduced in Mac OS X 10.3. | 36 | dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, |
37 | AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], | 37 | dnl because in macOS 10.13.4 it has the following behaviour: |
38 | dnl When two or more languages are specified in the | ||
39 | dnl "System Preferences > Language & Region > Preferred Languages" panel, | ||
40 | dnl it returns en_CC where CC is the territory (even when English is not among | ||
41 | dnl the preferred languages!). What we want instead is what | ||
42 | dnl CFLocaleCopyCurrent returned in earlier macOS releases and what | ||
43 | dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the | ||
44 | dnl first among the preferred languages and CC is the territory. | ||
45 | AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages], | ||
38 | [gt_save_LIBS="$LIBS" | 46 | [gt_save_LIBS="$LIBS" |
39 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" | 47 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" |
40 | AC_LINK_IFELSE( | 48 | AC_LINK_IFELSE( |
41 | [AC_LANG_PROGRAM( | 49 | [AC_LANG_PROGRAM( |
42 | [[#include <CoreFoundation/CFLocale.h>]], | 50 | [[#include <CoreFoundation/CFLocale.h>]], |
43 | [[CFLocaleCopyCurrent();]])], | 51 | [[CFLocaleCopyPreferredLanguages();]])], |
44 | [gt_cv_func_CFLocaleCopyCurrent=yes], | 52 | [gt_cv_func_CFLocaleCopyPreferredLanguages=yes], |
45 | [gt_cv_func_CFLocaleCopyCurrent=no]) | 53 | [gt_cv_func_CFLocaleCopyPreferredLanguages=no]) |
46 | LIBS="$gt_save_LIBS"]) | 54 | LIBS="$gt_save_LIBS"]) |
47 | if test $gt_cv_func_CFLocaleCopyCurrent = yes; then | 55 | if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then |
48 | AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], | 56 | AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1], |
49 | [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) | 57 | [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.]) |
50 | fi | 58 | fi |
51 | INTL_MACOSX_LIBS= | 59 | INTL_MACOSX_LIBS= |
52 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then | 60 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ |
61 | || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then | ||
53 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | 62 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" |
54 | fi | 63 | fi |
55 | AC_SUBST([INTL_MACOSX_LIBS]) | 64 | AC_SUBST([INTL_MACOSX_LIBS]) |
diff --git a/gl/m4/intmax.m4 b/gl/m4/intmax.m4 deleted file mode 100644 index 18733a5..0000000 --- a/gl/m4/intmax.m4 +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | # intmax.m4 serial 6 (gettext-0.18.2) | ||
2 | dnl Copyright (C) 2002-2005, 2008-2013 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 the system has the 'intmax_t' type, but don't attempt to | ||
9 | dnl find a replacement if it is lacking. | ||
10 | |||
11 | AC_DEFUN([gt_TYPE_INTMAX_T], | ||
12 | [ | ||
13 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
14 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
15 | AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], | ||
16 | [AC_COMPILE_IFELSE( | ||
17 | [AC_LANG_PROGRAM( | ||
18 | [[ | ||
19 | #include <stddef.h> | ||
20 | #include <stdlib.h> | ||
21 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
22 | #include <stdint.h> | ||
23 | #endif | ||
24 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
25 | #include <inttypes.h> | ||
26 | #endif | ||
27 | ]], | ||
28 | [[intmax_t x = -1; | ||
29 | return !x;]])], | ||
30 | [gt_cv_c_intmax_t=yes], | ||
31 | [gt_cv_c_intmax_t=no])]) | ||
32 | if test $gt_cv_c_intmax_t = yes; then | ||
33 | AC_DEFINE([HAVE_INTMAX_T], [1], | ||
34 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
35 | fi | ||
36 | ]) | ||
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index 6ea7053..ef32e1b 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # intmax_t.m4 serial 8 | 1 | # intmax_t.m4 serial 9 |
2 | dnl Copyright (C) 1997-2004, 2006-2007, 2009-2013 Free Software Foundation, | 2 | dnl Copyright (C) 1997-2004, 2006-2007, 2009-2023 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl 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, |
@@ -19,11 +19,7 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T], | |||
19 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | 19 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) |
20 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | 20 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) |
21 | if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then | 21 | if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then |
22 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | 22 | AC_DEFINE_UNQUOTED([intmax_t], [long long], |
23 | test $ac_cv_type_long_long_int = yes \ | ||
24 | && ac_type='long long' \ | ||
25 | || ac_type='long' | ||
26 | AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], | ||
27 | [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) | 23 | [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) |
28 | else | 24 | else |
29 | AC_DEFINE([HAVE_INTMAX_T], [1], | 25 | AC_DEFINE([HAVE_INTMAX_T], [1], |
@@ -57,11 +53,7 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], | |||
57 | AC_DEFINE([HAVE_INTMAX_T], [1], | 53 | AC_DEFINE([HAVE_INTMAX_T], [1], |
58 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | 54 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) |
59 | else | 55 | else |
60 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | 56 | AC_DEFINE_UNQUOTED([intmax_t], [long long], |
61 | test $ac_cv_type_long_long_int = yes \ | ||
62 | && ac_type='long long' \ | ||
63 | || ac_type='long' | ||
64 | AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], | ||
65 | [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) | 57 | [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) |
66 | fi | 58 | fi |
67 | ]) | 59 | ]) |
diff --git a/gl/m4/inttypes-pri.m4 b/gl/m4/inttypes-pri.m4 deleted file mode 100644 index e5a1e05..0000000 --- a/gl/m4/inttypes-pri.m4 +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | # inttypes-pri.m4 serial 7 (gettext-0.18.2) | ||
2 | dnl Copyright (C) 1997-2002, 2006, 2008-2013 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 | |||
9 | AC_PREREQ([2.53]) | ||
10 | |||
11 | # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* | ||
12 | # macros to non-string values. This is the case on AIX 4.3.3. | ||
13 | |||
14 | AC_DEFUN([gt_INTTYPES_PRI], | ||
15 | [ | ||
16 | AC_CHECK_HEADERS([inttypes.h]) | ||
17 | if test $ac_cv_header_inttypes_h = yes; then | ||
18 | AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], | ||
19 | [gt_cv_inttypes_pri_broken], | ||
20 | [ | ||
21 | AC_COMPILE_IFELSE( | ||
22 | [AC_LANG_PROGRAM( | ||
23 | [[ | ||
24 | #include <inttypes.h> | ||
25 | #ifdef PRId32 | ||
26 | char *p = PRId32; | ||
27 | #endif | ||
28 | ]], | ||
29 | [[]])], | ||
30 | [gt_cv_inttypes_pri_broken=no], | ||
31 | [gt_cv_inttypes_pri_broken=yes]) | ||
32 | ]) | ||
33 | fi | ||
34 | if test "$gt_cv_inttypes_pri_broken" = yes; then | ||
35 | AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1], | ||
36 | [Define if <inttypes.h> exists and defines unusable PRI* macros.]) | ||
37 | PRI_MACROS_BROKEN=1 | ||
38 | else | ||
39 | PRI_MACROS_BROKEN=0 | ||
40 | fi | ||
41 | AC_SUBST([PRI_MACROS_BROKEN]) | ||
42 | ]) | ||
diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4 new file mode 100644 index 0000000..bf2eab2 --- /dev/null +++ b/gl/m4/inttypes.m4 | |||
@@ -0,0 +1,180 @@ | |||
1 | # inttypes.m4 serial 36 | ||
2 | dnl Copyright (C) 2006-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 Derek Price, Bruno Haible. | ||
8 | dnl Test whether <inttypes.h> is supported or must be substituted. | ||
9 | |||
10 | AC_DEFUN_ONCE([gl_INTTYPES_H], | ||
11 | [ | ||
12 | AC_REQUIRE([gl_INTTYPES_INCOMPLETE]) | ||
13 | gl_INTTYPES_PRI_SCN | ||
14 | ]) | ||
15 | |||
16 | AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE], | ||
17 | [ | ||
18 | AC_REQUIRE([gl_STDINT_H]) | ||
19 | AC_CHECK_HEADERS_ONCE([inttypes.h]) | ||
20 | |||
21 | dnl Override <inttypes.h> always, so that the portability warnings work. | ||
22 | AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) | ||
23 | gl_CHECK_NEXT_HEADERS([inttypes.h]) | ||
24 | |||
25 | AC_REQUIRE([gl_MULTIARCH]) | ||
26 | |||
27 | dnl Check for declarations of anything we want to poison if the | ||
28 | dnl corresponding gnulib module is not in use. | ||
29 | gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> | ||
30 | ]], [imaxabs imaxdiv strtoimax strtoumax]) | ||
31 | |||
32 | AC_REQUIRE([AC_C_RESTRICT]) | ||
33 | ]) | ||
34 | |||
35 | # Ensure that the PRI* and SCN* macros are defined appropriately. | ||
36 | AC_DEFUN([gl_INTTYPES_PRI_SCN], | ||
37 | [ | ||
38 | PRIPTR_PREFIX= | ||
39 | if $GL_GENERATE_STDINT_H; then | ||
40 | dnl Using the gnulib <stdint.h>. It defines intptr_t to 'long' or | ||
41 | dnl 'long long', depending on _WIN64. | ||
42 | AC_COMPILE_IFELSE( | ||
43 | [AC_LANG_PROGRAM([[ | ||
44 | #ifdef _WIN64 | ||
45 | LLP64 | ||
46 | #endif | ||
47 | ]]) | ||
48 | ], | ||
49 | [PRIPTR_PREFIX='"l"'], | ||
50 | [PRIPTR_PREFIX='"ll"']) | ||
51 | else | ||
52 | dnl Using the system's <stdint.h>. | ||
53 | for glpfx in '' l ll I64; do | ||
54 | case $glpfx in | ||
55 | '') gltype1='int';; | ||
56 | l) gltype1='long int';; | ||
57 | ll) gltype1='long long int';; | ||
58 | I64) gltype1='__int64';; | ||
59 | esac | ||
60 | AC_COMPILE_IFELSE( | ||
61 | [AC_LANG_PROGRAM([[#include <stdint.h> | ||
62 | extern intptr_t foo; | ||
63 | extern $gltype1 foo;]])], | ||
64 | [PRIPTR_PREFIX='"'$glpfx'"']) | ||
65 | test -n "$PRIPTR_PREFIX" && break | ||
66 | done | ||
67 | fi | ||
68 | AC_SUBST([PRIPTR_PREFIX]) | ||
69 | |||
70 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
71 | [INT32_MAX_LT_INTMAX_MAX], | ||
72 | [defined INT32_MAX && defined INTMAX_MAX], | ||
73 | [INT32_MAX < INTMAX_MAX], | ||
74 | [sizeof (int) < sizeof (long long int)]) | ||
75 | if test $APPLE_UNIVERSAL_BUILD = 0; then | ||
76 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
77 | [INT64_MAX_EQ_LONG_MAX], | ||
78 | [defined INT64_MAX], | ||
79 | [INT64_MAX == LONG_MAX], | ||
80 | [sizeof (long long int) == sizeof (long int)]) | ||
81 | else | ||
82 | INT64_MAX_EQ_LONG_MAX=-1 | ||
83 | fi | ||
84 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
85 | [UINT32_MAX_LT_UINTMAX_MAX], | ||
86 | [defined UINT32_MAX && defined UINTMAX_MAX], | ||
87 | [UINT32_MAX < UINTMAX_MAX], | ||
88 | [sizeof (unsigned int) < sizeof (unsigned long long int)]) | ||
89 | if test $APPLE_UNIVERSAL_BUILD = 0; then | ||
90 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
91 | [UINT64_MAX_EQ_ULONG_MAX], | ||
92 | [defined UINT64_MAX], | ||
93 | [UINT64_MAX == ULONG_MAX], | ||
94 | [sizeof (unsigned long long int) == sizeof (unsigned long int)]) | ||
95 | else | ||
96 | UINT64_MAX_EQ_ULONG_MAX=-1 | ||
97 | fi | ||
98 | ]) | ||
99 | |||
100 | # Define the symbol $1 to be 1 if the condition is true, 0 otherwise. | ||
101 | # If $2 is true, the condition is $3; otherwise if long long int is supported | ||
102 | # approximate the condition with $4; otherwise, assume the condition is false. | ||
103 | # The condition should work on all C99 platforms; the approximations should be | ||
104 | # good enough to work on all practical pre-C99 platforms. | ||
105 | # $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants. | ||
106 | AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], | ||
107 | [ | ||
108 | AC_CACHE_CHECK([whether $3], | ||
109 | [gl_cv_test_$1], | ||
110 | [AC_COMPILE_IFELSE( | ||
111 | [AC_LANG_PROGRAM( | ||
112 | [[/* Work also in C++ mode. */ | ||
113 | #define __STDC_LIMIT_MACROS 1 | ||
114 | |||
115 | /* Work if build is not clean. */ | ||
116 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H | ||
117 | |||
118 | #include <limits.h> | ||
119 | #if HAVE_STDINT_H | ||
120 | #include <stdint.h> | ||
121 | #endif | ||
122 | |||
123 | #if $2 | ||
124 | #define CONDITION ($3) | ||
125 | #else | ||
126 | #define CONDITION ($4) | ||
127 | #endif | ||
128 | int test[CONDITION ? 1 : -1];]])], | ||
129 | [gl_cv_test_$1=yes], | ||
130 | [gl_cv_test_$1=no])]) | ||
131 | if test $gl_cv_test_$1 = yes; then | ||
132 | $1=1; | ||
133 | else | ||
134 | $1=0; | ||
135 | fi | ||
136 | AC_SUBST([$1]) | ||
137 | ]) | ||
138 | |||
139 | # gl_INTTYPES_MODULE_INDICATOR([modulename]) | ||
140 | # sets the shell variable that indicates the presence of the given module | ||
141 | # to a C preprocessor expression that will evaluate to 1. | ||
142 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
143 | AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], | ||
144 | [ | ||
145 | dnl Ensure to expand the default settings once only. | ||
146 | gl_INTTYPES_H_REQUIRE_DEFAULTS | ||
147 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
148 | ]) | ||
149 | |||
150 | # Initializes the default values for AC_SUBSTed shell variables. | ||
151 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
152 | # outside of macros or in macros that are not AC_REQUIREd. | ||
153 | AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS], | ||
154 | [ | ||
155 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [ | ||
156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS]) | ||
157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV]) | ||
158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX]) | ||
159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX]) | ||
160 | ]) | ||
161 | m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS]) | ||
162 | AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) | ||
163 | ]) | ||
164 | |||
165 | AC_DEFUN([gl_INTTYPES_H_DEFAULTS], | ||
166 | [ | ||
167 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
168 | HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) | ||
169 | HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) | ||
170 | HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) | ||
171 | HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) | ||
172 | HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) | ||
173 | REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) | ||
174 | REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) | ||
175 | INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) | ||
176 | INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX]) | ||
177 | PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX]) | ||
178 | UINT32_MAX_LT_UINTMAX_MAX=1; AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX]) | ||
179 | UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX]) | ||
180 | ]) | ||
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 5f05ac5..68c60e9 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # inttypes_h.m4 serial 10 | 1 | # inttypes_h.m4 serial 10 |
2 | dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4 index 73bef8b..b17a526 100644 --- a/gl/m4/langinfo_h.m4 +++ b/gl/m4/langinfo_h.m4 | |||
@@ -1,10 +1,10 @@ | |||
1 | # langinfo_h.m4 serial 7 | 1 | # langinfo_h.m4 serial 12 |
2 | dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_LANGINFO_H], | 7 | AC_DEFUN_ONCE([gl_LANGINFO_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) |
10 | 10 | ||
@@ -17,13 +17,17 @@ AC_DEFUN([gl_LANGINFO_H], | |||
17 | dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. | 17 | dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. |
18 | HAVE_LANGINFO_CODESET=0 | 18 | HAVE_LANGINFO_CODESET=0 |
19 | HAVE_LANGINFO_T_FMT_AMPM=0 | 19 | HAVE_LANGINFO_T_FMT_AMPM=0 |
20 | HAVE_LANGINFO_ALTMON=0 | ||
20 | HAVE_LANGINFO_ERA=0 | 21 | HAVE_LANGINFO_ERA=0 |
21 | HAVE_LANGINFO_YESEXPR=0 | 22 | HAVE_LANGINFO_YESEXPR=0 |
22 | AC_CHECK_HEADERS_ONCE([langinfo.h]) | 23 | AC_CHECK_HEADERS_ONCE([langinfo.h]) |
23 | if test $ac_cv_header_langinfo_h = yes; then | 24 | if test $ac_cv_header_langinfo_h = yes; then |
24 | HAVE_LANGINFO_H=1 | 25 | HAVE_LANGINFO_H=1 |
25 | dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing | 26 | dnl Determine what <langinfo.h> defines. |
26 | dnl on OpenBSD 3.8. T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. | 27 | dnl CODESET is missing on OpenBSD 3.8. |
28 | dnl ERA etc. are missing on OpenBSD 6.7. | ||
29 | 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. | ||
27 | AC_CACHE_CHECK([whether langinfo.h defines CODESET], | 31 | AC_CACHE_CHECK([whether langinfo.h defines CODESET], |
28 | [gl_cv_header_langinfo_codeset], | 32 | [gl_cv_header_langinfo_codeset], |
29 | [AC_COMPILE_IFELSE( | 33 | [AC_COMPILE_IFELSE( |
@@ -48,6 +52,18 @@ int a = T_FMT_AMPM; | |||
48 | if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then | 52 | if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then |
49 | HAVE_LANGINFO_T_FMT_AMPM=1 | 53 | HAVE_LANGINFO_T_FMT_AMPM=1 |
50 | fi | 54 | fi |
55 | AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1], | ||
56 | [gl_cv_header_langinfo_altmon], | ||
57 | [AC_COMPILE_IFELSE( | ||
58 | [AC_LANG_PROGRAM([[#include <langinfo.h> | ||
59 | int a = ALTMON_1; | ||
60 | ]])], | ||
61 | [gl_cv_header_langinfo_altmon=yes], | ||
62 | [gl_cv_header_langinfo_altmon=no]) | ||
63 | ]) | ||
64 | if test $gl_cv_header_langinfo_altmon = yes; then | ||
65 | HAVE_LANGINFO_ALTMON=1 | ||
66 | fi | ||
51 | AC_CACHE_CHECK([whether langinfo.h defines ERA], | 67 | AC_CACHE_CHECK([whether langinfo.h defines ERA], |
52 | [gl_cv_header_langinfo_era], | 68 | [gl_cv_header_langinfo_era], |
53 | [AC_COMPILE_IFELSE( | 69 | [AC_COMPILE_IFELSE( |
@@ -78,6 +94,7 @@ int a = YESEXPR; | |||
78 | AC_SUBST([HAVE_LANGINFO_H]) | 94 | AC_SUBST([HAVE_LANGINFO_H]) |
79 | AC_SUBST([HAVE_LANGINFO_CODESET]) | 95 | AC_SUBST([HAVE_LANGINFO_CODESET]) |
80 | AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) | 96 | AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) |
97 | AC_SUBST([HAVE_LANGINFO_ALTMON]) | ||
81 | AC_SUBST([HAVE_LANGINFO_ERA]) | 98 | AC_SUBST([HAVE_LANGINFO_ERA]) |
82 | AC_SUBST([HAVE_LANGINFO_YESEXPR]) | 99 | AC_SUBST([HAVE_LANGINFO_YESEXPR]) |
83 | 100 | ||
@@ -87,18 +104,33 @@ int a = YESEXPR; | |||
87 | ]], [nl_langinfo]) | 104 | ]], [nl_langinfo]) |
88 | ]) | 105 | ]) |
89 | 106 | ||
107 | # gl_LANGINFO_MODULE_INDICATOR([modulename]) | ||
108 | # sets the shell variable that indicates the presence of the given module | ||
109 | # to a C preprocessor expression that will evaluate to 1. | ||
110 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
90 | AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR], | 111 | AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR], |
91 | [ | 112 | [ |
92 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 113 | dnl Ensure to expand the default settings once only. |
93 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) | 114 | gl_LANGINFO_H_REQUIRE_DEFAULTS |
94 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 115 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
95 | dnl Define it also as a C macro, for the benefit of the unit tests. | 116 | dnl Define it also as a C macro, for the benefit of the unit tests. |
96 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 117 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
97 | ]) | 118 | ]) |
98 | 119 | ||
120 | # Initializes the default values for AC_SUBSTed shell variables. | ||
121 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
122 | # outside of macros or in macros that are not AC_REQUIREd. | ||
123 | AC_DEFUN([gl_LANGINFO_H_REQUIRE_DEFAULTS], | ||
124 | [ | ||
125 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS], [ | ||
126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NL_LANGINFO]) | ||
127 | ]) | ||
128 | m4_require(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS]) | ||
129 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) | ||
130 | ]) | ||
131 | |||
99 | AC_DEFUN([gl_LANGINFO_H_DEFAULTS], | 132 | AC_DEFUN([gl_LANGINFO_H_DEFAULTS], |
100 | [ | 133 | [ |
101 | GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO]) | ||
102 | dnl Assume proper GNU behavior unless another module says otherwise. | 134 | dnl Assume proper GNU behavior unless another module says otherwise. |
103 | HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO]) | 135 | HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO]) |
104 | REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO]) | 136 | REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO]) |
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 1e605e3..7fb81b8 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 | |||
@@ -1,104 +1,319 @@ | |||
1 | # Enable large files on systems where this is not the default. | 1 | # 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. | ||
2 | 3 | ||
3 | # Copyright 1992-1996, 1998-2013 Free Software Foundation, Inc. | 4 | # Copyright 1992-1996, 1998-2023 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
7 | 8 | ||
8 | # The following implementation works around a problem in autoconf <= 2.69; | 9 | # 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 | ||
11 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko | ||
12 | # and ftello in C++ mode as well. | ||
13 | # Fixed in Autoconf 2.72, which has AC_SYS_YEAR2038. | ||
14 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | ||
15 | m4_ifndef([AC_SYS_YEAR2038], [[ | ||
16 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
17 | AC_FUNC_FSEEKO | ||
18 | case "$host_os" in | ||
19 | hpux*) | ||
20 | AC_DEFINE([_LARGEFILE_SOURCE], [1], | ||
21 | [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).]) | ||
22 | ;; | ||
23 | esac | ||
24 | ]]) | ||
25 | ) | ||
26 | |||
27 | # Work around a problem in autoconf <= 2.69: | ||
9 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, | 28 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, |
10 | # or configures them incorrectly in some cases. | 29 | # or configures them incorrectly in some cases. |
11 | m4_version_prereq([2.70], [] ,[ | 30 | m4_version_prereq([2.70], [], [ |
12 | 31 | ||
13 | # _AC_SYS_LARGEFILE_TEST_INCLUDES | 32 | # _AC_SYS_LARGEFILE_TEST_INCLUDES |
14 | # ------------------------------- | 33 | # ------------------------------- |
15 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], | 34 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], |
16 | [@%:@include <sys/types.h> | 35 | [#include <sys/types.h> |
17 | /* Check that off_t can represent 2**63 - 1 correctly. | 36 | /* Check that off_t can represent 2**63 - 1 correctly. |
18 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | 37 | We can't simply define LARGE_OFF_T to be 9223372036854775807, |
19 | since some C++ compilers masquerading as C compilers | 38 | since some C++ compilers masquerading as C compilers |
20 | incorrectly reject 9223372036854775807. */ | 39 | incorrectly reject 9223372036854775807. */ |
21 | @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | 40 | #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) |
22 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | 41 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 |
23 | && LARGE_OFF_T % 2147483647 == 1) | 42 | && LARGE_OFF_T % 2147483647 == 1) |
24 | ? 1 : -1]];[]dnl | 43 | ? 1 : -1]];[]dnl |
25 | ]) | 44 | ]) |
45 | ])# m4_version_prereq 2.70 | ||
46 | |||
47 | # Support AC_SYS_YEAR2038, even if Autoconf 2.71 or earlier. | ||
48 | # This code is taken from Autoconf master. | ||
49 | m4_ifndef([AC_SYS_YEAR2038], [ | ||
50 | |||
51 | # _AC_SYS_YEAR2038_TEST_CODE | ||
52 | # -------------------------- | ||
53 | # C code used to probe for time_t that can represent time points more | ||
54 | # than 2**31 - 1 seconds after the epoch. With the usual Unix epoch, | ||
55 | # these correspond to dates after 2038-01-18 22:14:07 +0000 (Gregorian), | ||
56 | # hence the name. | ||
57 | AC_DEFUN([_AC_SYS_YEAR2038_TEST_CODE], | ||
58 | [[ | ||
59 | #include <time.h> | ||
60 | /* Check that time_t can represent 2**32 - 1 correctly. */ | ||
61 | #define LARGE_TIME_T \\ | ||
62 | ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) | ||
63 | int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 | ||
64 | && LARGE_TIME_T % 65537 == 0) | ||
65 | ? 1 : -1]; | ||
66 | ]]) | ||
67 | |||
68 | # _AC_SYS_YEAR2038_OPTIONS | ||
69 | # ------------------------ | ||
70 | # List of known ways to enable support for large time_t. If you change | ||
71 | # this list you probably also need to change the AS_CASE at the end of | ||
72 | # _AC_SYS_YEAR2038_PROBE. | ||
73 | m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | ||
74 | ["none needed"] dnl 64-bit and newer 32-bit Unix | ||
75 | ["-D_TIME_BITS=64"] dnl glibc 2.34 with some 32-bit ABIs | ||
76 | ["-D__MINGW_USE_VC2005_COMPAT"] dnl 32-bit MinGW | ||
77 | ["-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"] | ||
78 | dnl 32-bit MinGW (misconfiguration) | ||
79 | )) | ||
80 | |||
81 | # _AC_SYS_YEAR2038_PROBE([IF-NOT-DETECTED]) | ||
82 | # ----------------------------------------- | ||
83 | # 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 | ||
85 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts | ||
86 | # to one of the values in the _AC_SYS_YEAR2038_OPTIONS list, or to | ||
87 | # "support not detected" if none of them worked. Then, set compilation | ||
88 | # options and #defines as necessary to enable large time_t support. | ||
89 | # | ||
90 | # Note that we do not test whether mktime, localtime, etc. handle | ||
91 | # large values of time_t correctly, as that would require use of | ||
92 | # AC_TRY_RUN. Note also that some systems only support large time_t | ||
93 | # together with large off_t. | ||
94 | # | ||
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 | ||
99 | # _AC_SYS_YEAR2038_OPTIONS. | ||
100 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], | ||
101 | [AC_CACHE_CHECK([for $CC option to enable timestamps after Jan 2038], | ||
102 | [ac_cv_sys_year2038_opts], | ||
103 | [ac_save_CPPFLAGS="$CPPFLAGS" | ||
104 | ac_opt_found=no | ||
105 | for ac_opt in _AC_SYS_YEAR2038_OPTIONS; do | ||
106 | AS_IF([test x"$ac_opt" != x"none needed"], | ||
107 | [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"]) | ||
108 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_YEAR2038_TEST_CODE])], | ||
109 | [ac_cv_sys_year2038_opts="$ac_opt" | ||
110 | ac_opt_found=yes]) | ||
111 | test $ac_opt_found = no || break | ||
112 | done | ||
113 | CPPFLAGS="$ac_save_CPPFLAGS" | ||
114 | test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected"]) | ||
115 | |||
116 | ac_have_year2038=yes | ||
117 | AS_CASE([$ac_cv_sys_year2038_opts], | ||
118 | ["none needed"], [], | ||
119 | ["support not detected"], | ||
120 | [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 | |||
142 | ["-D_TIME_BITS=64"], | ||
143 | [AC_DEFINE([_TIME_BITS], [64], | ||
144 | [Number of bits in time_t, on hosts where this is settable.])], | ||
145 | |||
146 | ["-D__MINGW_USE_VC2005_COMPAT=1"], | ||
147 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], | ||
148 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], | ||
149 | |||
150 | ["-U_USE_32_BIT_TIME_T"*], | ||
151 | [AC_MSG_FAILURE(m4_text_wrap( | ||
152 | [the 'time_t' type is currently forced to be 32-bit. | ||
153 | It will stop working after January 2038. | ||
154 | Remove _USE_32BIT_TIME_T from the compiler flags.], | ||
155 | [], [], [55]))], | ||
156 | |||
157 | [AC_MSG_ERROR( | ||
158 | [internal error: bad value for \$ac_cv_sys_year2038_opts])]) | ||
159 | ]) | ||
160 | |||
161 | # _AC_SYS_YEAR2038_ENABLE | ||
162 | # ----------------------- | ||
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 | ||
165 | # --enable-year2038, or a --disable-year2038, or no option at all to | ||
166 | # the configure script. Note that this is expanded very late and | ||
167 | # therefore there cannot be any code in the AC_ARG_ENABLE. The | ||
168 | # default value for enable_year2038 is emitted unconditionally | ||
169 | # because the generated code always looks at this variable. | ||
170 | m4_define([_AC_SYS_YEAR2038_ENABLE], | ||
171 | [m4_divert_text([DEFAULTS], | ||
172 | m4_provide_if([AC_SYS_YEAR2038], | ||
173 | [enable_year2038=yes], | ||
174 | [enable_year2038=no]))]dnl | ||
175 | [AC_ARG_ENABLE([year2038], | ||
176 | m4_provide_if([AC_SYS_YEAR2038], | ||
177 | [AS_HELP_STRING([--disable-year2038], | ||
178 | [do not support timestamps after 2038])], | ||
179 | [AS_HELP_STRING([--enable-year2038], | ||
180 | [support timestamps after 2038])]))]) | ||
181 | |||
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 | ||
197 | # --------------- | ||
198 | # 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 | ||
200 | # skipped by passing the --disable-year2038 option to configure. | ||
201 | AC_DEFUN([AC_SYS_YEAR2038], | ||
202 | [AC_REQUIRE([AC_SYS_LARGEFILE])]dnl | ||
203 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | ||
204 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | ||
205 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | ||
206 | ])]) | ||
207 | |||
208 | # _AC_SYS_LARGEFILE_TEST_CODE | ||
209 | # --------------------------- | ||
210 | # C code used to probe for large file support. | ||
211 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | ||
212 | [@%:@include <sys/types.h> | ||
213 | /* Check that off_t can represent 2**63 - 1 correctly. | ||
214 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||
215 | since some C++ compilers masquerading as C compilers | ||
216 | incorrectly reject 9223372036854775807. */ | ||
217 | @%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | ||
218 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | ||
219 | && LARGE_OFF_T % 2147483647 == 1) | ||
220 | ? 1 : -1]];[]dnl | ||
221 | ]) | ||
222 | |||
223 | # _AC_SYS_LARGEFILE_OPTIONS | ||
224 | # ------------------------- | ||
225 | # List of known ways to enable support for large files. If you change | ||
226 | # this list you probably also need to change the AS_CASE at the end of | ||
227 | # _AC_SYS_LARGEFILE_PROBE. | ||
228 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | ||
229 | ["none needed"] dnl Most current systems | ||
230 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec | ||
231 | ["-D_LARGE_FILES=1"] dnl AIX (which versions?) | ||
232 | ["-n32"] dnl Irix 6.2 w/ SGI compiler | ||
233 | )) | ||
234 | |||
235 | # _AC_SYS_LARGEFILE_PROBE | ||
236 | # ----------------------- | ||
237 | # Subroutine of AC_SYS_LARGEFILE. Probe for large file support and set | ||
238 | # the cache variable ac_cv_sys_largefile_opts to one of the values in | ||
239 | # the _AC_SYS_LARGEFILE_OPTIONS list, or to "support not detected" if | ||
240 | # none of the options in that list worked. Then, set compilation | ||
241 | # options and #defines as necessary to enable large file support. | ||
242 | # | ||
243 | # If large file support is not detected, the behavior depends on which of | ||
244 | # the top-level AC_SYS_LARGEFILE macros was used (see below). | ||
245 | # | ||
246 | # If you change this macro you may also need to change | ||
247 | # _AC_SYS_LARGEFILE_OPTIONS. | ||
248 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], | ||
249 | [AC_CACHE_CHECK([for $CC option to enable large file support], | ||
250 | [ac_cv_sys_largefile_opts], | ||
251 | [ac_save_CC="$CC" | ||
252 | ac_opt_found=no | ||
253 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do | ||
254 | AS_IF([test x"$ac_opt" != x"none needed"], | ||
255 | [CC="$ac_save_CC $ac_opt"]) | ||
256 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], | ||
257 | [ac_cv_sys_largefile_opts="$ac_opt" | ||
258 | ac_opt_found=yes]) | ||
259 | test $ac_opt_found = no || break | ||
260 | done | ||
261 | CC="$ac_save_CC" | ||
262 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) | ||
263 | |||
264 | ac_have_largefile=yes | ||
265 | AS_CASE([$ac_cv_sys_largefile_opts], | ||
266 | ["none needed"], [], | ||
267 | ["support not detected"], | ||
268 | [ac_have_largefile=no], | ||
269 | |||
270 | ["-D_FILE_OFFSET_BITS=64"], | ||
271 | [AC_DEFINE([_FILE_OFFSET_BITS], [64], | ||
272 | [Number of bits in a file offset, on hosts where this is settable.])], | ||
273 | |||
274 | ["-D_LARGE_FILES=1"], | ||
275 | [AC_DEFINE([_LARGE_FILES], [1], | ||
276 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], | ||
26 | 277 | ||
278 | ["-n32"], | ||
279 | [CC="$CC -n32"], | ||
27 | 280 | ||
28 | # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, | 281 | [AC_MSG_ERROR( |
29 | # CACHE-VAR, | 282 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) |
30 | # DESCRIPTION, | ||
31 | # PROLOGUE, [FUNCTION-BODY]) | ||
32 | # -------------------------------------------------------- | ||
33 | m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], | ||
34 | [AC_CACHE_CHECK([for $1 value needed for large files], [$3], | ||
35 | [while :; do | ||
36 | m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( | ||
37 | [AC_LANG_PROGRAM([$5], [$6])], | ||
38 | [$3=no; break]) | ||
39 | m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( | ||
40 | [AC_LANG_PROGRAM([@%:@define $1 $2 | ||
41 | $5], [$6])], | ||
42 | [$3=$2; break]) | ||
43 | $3=unknown | ||
44 | break | ||
45 | done]) | ||
46 | case $$3 in #( | ||
47 | no | unknown) ;; | ||
48 | *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);; | ||
49 | esac | ||
50 | rm -rf conftest*[]dnl | ||
51 | ])# _AC_SYS_LARGEFILE_MACRO_VALUE | ||
52 | 283 | ||
284 | _AC_SYS_YEAR2038_OPT_IN | ||
285 | ]) | ||
286 | |||
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])])]) | ||
53 | 299 | ||
54 | # AC_SYS_LARGEFILE | 300 | # AC_SYS_LARGEFILE |
55 | # ---------------- | 301 | # ---------------- |
56 | # By default, many hosts won't let programs access large files; | 302 | # By default, many hosts won't let programs access large files; |
57 | # one must use special compiler options to get large-file access to work. | 303 | # one must use special compiler options to get large-file access to work. |
58 | # For more details about this brain damage please see: | 304 | # For more details about this brain damage please see: |
59 | # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html | 305 | # http://www.unix.org/version2/whatsnew/lfs20mar.html |
306 | # 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 | ||
308 | # 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. | ||
60 | AC_DEFUN([AC_SYS_LARGEFILE], | 311 | AC_DEFUN([AC_SYS_LARGEFILE], |
61 | [AC_ARG_ENABLE(largefile, | 312 | [m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl |
62 | [ --disable-largefile omit support for large files]) | 313 | AS_IF([test "$enable_largefile" != no], [_AC_SYS_LARGEFILE_PROBE]) |
63 | if test "$enable_largefile" != no; then | 314 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE]) |
64 | 315 | ])]) | |
65 | AC_CACHE_CHECK([for special C compiler options needed for large files], | 316 | ])# m4_ifndef AC_SYS_YEAR2038 |
66 | ac_cv_sys_largefile_CC, | ||
67 | [ac_cv_sys_largefile_CC=no | ||
68 | if test "$GCC" != yes; then | ||
69 | ac_save_CC=$CC | ||
70 | while :; do | ||
71 | # IRIX 6.2 and later do not support large files by default, | ||
72 | # so use the C compiler's -n32 option if that helps. | ||
73 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) | ||
74 | AC_COMPILE_IFELSE([], [break]) | ||
75 | CC="$CC -n32" | ||
76 | AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) | ||
77 | break | ||
78 | done | ||
79 | CC=$ac_save_CC | ||
80 | rm -f conftest.$ac_ext | ||
81 | fi]) | ||
82 | if test "$ac_cv_sys_largefile_CC" != no; then | ||
83 | CC=$CC$ac_cv_sys_largefile_CC | ||
84 | fi | ||
85 | |||
86 | _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, | ||
87 | ac_cv_sys_file_offset_bits, | ||
88 | [Number of bits in a file offset, on hosts where this is settable.], | ||
89 | [_AC_SYS_LARGEFILE_TEST_INCLUDES]) | ||
90 | if test $ac_cv_sys_file_offset_bits = unknown; then | ||
91 | _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, | ||
92 | ac_cv_sys_large_files, | ||
93 | [Define for large files, on AIX-style hosts.], | ||
94 | [_AC_SYS_LARGEFILE_TEST_INCLUDES]) | ||
95 | fi | ||
96 | |||
97 | AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1], | ||
98 | [Enable large inode numbers on Mac OS X 10.5.]) | ||
99 | fi | ||
100 | ])# AC_SYS_LARGEFILE | ||
101 | ])# m4_version_prereq 2.70 | ||
102 | 317 | ||
103 | # Enable large files on systems where this is implemented by Gnulib, not by the | 318 | # Enable large files on systems where this is implemented by Gnulib, not by the |
104 | # system headers. | 319 | # system headers. |
@@ -126,9 +341,24 @@ AC_DEFUN([gl_LARGEFILE], | |||
126 | else | 341 | else |
127 | WINDOWS_64_BIT_OFF_T=0 | 342 | WINDOWS_64_BIT_OFF_T=0 |
128 | fi | 343 | fi |
129 | dnl But all native Windows platforms (including mingw64) have a 32-bit | 344 | dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat' |
130 | dnl st_size member in 'struct stat'. | 345 | dnl to 'struct _stat32i64' or 'struct _stat64' (depending on |
131 | WINDOWS_64_BIT_ST_SIZE=1 | 346 | dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member. |
347 | AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64], | ||
348 | [AC_COMPILE_IFELSE( | ||
349 | [AC_LANG_PROGRAM( | ||
350 | [[#include <sys/types.h> | ||
351 | struct stat buf; | ||
352 | int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; | ||
353 | ]], | ||
354 | [[]])], | ||
355 | [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no]) | ||
356 | ]) | ||
357 | if test $gl_cv_member_st_size_64 = no; then | ||
358 | WINDOWS_64_BIT_ST_SIZE=1 | ||
359 | else | ||
360 | WINDOWS_64_BIT_ST_SIZE=0 | ||
361 | fi | ||
132 | ;; | 362 | ;; |
133 | *) | 363 | *) |
134 | dnl Nothing to do on gnulib's side. | 364 | dnl Nothing to do on gnulib's side. |
diff --git a/gl/m4/lcmessage.m4 b/gl/m4/lcmessage.m4 deleted file mode 100644 index d62a175..0000000 --- a/gl/m4/lcmessage.m4 +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | # lcmessage.m4 serial 7 (gettext-0.18.2) | ||
2 | dnl Copyright (C) 1995-2002, 2004-2005, 2008-2013 Free Software Foundation, | ||
3 | dnl 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 | ||
8 | dnl This file can can be used in projects which are not available under | ||
9 | dnl the GNU General Public License or the GNU Library General Public | ||
10 | dnl License but which still want to provide support for the GNU gettext | ||
11 | dnl functionality. | ||
12 | dnl Please note that the actual code of the GNU gettext library is covered | ||
13 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
14 | dnl gettext package package is covered by the GNU General Public License. | ||
15 | dnl They are *not* in the public domain. | ||
16 | |||
17 | dnl Authors: | ||
18 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995. | ||
19 | |||
20 | # Check whether LC_MESSAGES is available in <locale.h>. | ||
21 | |||
22 | AC_DEFUN([gt_LC_MESSAGES], | ||
23 | [ | ||
24 | AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], | ||
25 | [AC_LINK_IFELSE( | ||
26 | [AC_LANG_PROGRAM( | ||
27 | [[#include <locale.h>]], | ||
28 | [[return LC_MESSAGES]])], | ||
29 | [gt_cv_val_LC_MESSAGES=yes], | ||
30 | [gt_cv_val_LC_MESSAGES=no])]) | ||
31 | if test $gt_cv_val_LC_MESSAGES = yes; then | ||
32 | AC_DEFINE([HAVE_LC_MESSAGES], [1], | ||
33 | [Define if your <locale.h> file defines LC_MESSAGES.]) | ||
34 | fi | ||
35 | ]) | ||
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4 index c145e47..6bc1886 100644 --- a/gl/m4/lib-ld.m4 +++ b/gl/m4/lib-ld.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # lib-ld.m4 serial 6 | 1 | # lib-ld.m4 serial 10 |
2 | dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1996-2003, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -47,73 +47,122 @@ if test "${PATH_SEPARATOR+set}" != set; then | |||
47 | } | 47 | } |
48 | fi | 48 | fi |
49 | 49 | ||
50 | ac_prog=ld | 50 | if test -n "$LD"; then |
51 | if test "$GCC" = yes; then | 51 | AC_MSG_CHECKING([for ld]) |
52 | # Check if gcc -print-prog-name=ld gives a path. | 52 | elif test "$GCC" = yes; then |
53 | AC_MSG_CHECKING([for ld used by $CC]) | 53 | AC_MSG_CHECKING([for ld used by $CC]) |
54 | case $host in | ||
55 | *-*-mingw*) | ||
56 | # gcc leaves a trailing carriage return which upsets mingw | ||
57 | ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; | ||
58 | *) | ||
59 | ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; | ||
60 | esac | ||
61 | case $ac_prog in | ||
62 | # Accept absolute paths. | ||
63 | [[\\/]]* | ?:[[\\/]]*) | ||
64 | re_direlt='/[[^/]][[^/]]*/\.\./' | ||
65 | # Canonicalize the pathname of ld | ||
66 | ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` | ||
67 | while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do | ||
68 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` | ||
69 | done | ||
70 | test -z "$LD" && LD="$ac_prog" | ||
71 | ;; | ||
72 | "") | ||
73 | # If it fails, then pretend we aren't using GCC. | ||
74 | ac_prog=ld | ||
75 | ;; | ||
76 | *) | ||
77 | # If it is relative, then search for the first ld in PATH. | ||
78 | with_gnu_ld=unknown | ||
79 | ;; | ||
80 | esac | ||
81 | elif test "$with_gnu_ld" = yes; then | 54 | elif test "$with_gnu_ld" = yes; then |
82 | AC_MSG_CHECKING([for GNU ld]) | 55 | AC_MSG_CHECKING([for GNU ld]) |
83 | else | 56 | else |
84 | AC_MSG_CHECKING([for non-GNU ld]) | 57 | AC_MSG_CHECKING([for non-GNU ld]) |
85 | fi | 58 | fi |
86 | AC_CACHE_VAL([acl_cv_path_LD], | 59 | if test -n "$LD"; then |
87 | [if test -z "$LD"; then | 60 | # Let the user override the test with a path. |
88 | acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR | 61 | : |
89 | for ac_dir in $PATH; do | 62 | else |
90 | IFS="$acl_save_ifs" | 63 | AC_CACHE_VAL([acl_cv_path_LD], |
91 | test -z "$ac_dir" && ac_dir=. | 64 | [ |
92 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then | 65 | acl_cv_path_LD= # Final result of this test |
93 | acl_cv_path_LD="$ac_dir/$ac_prog" | 66 | ac_prog=ld # Program to search in $PATH |
94 | # Check to see if the program is GNU ld. I'd rather use --version, | 67 | if test "$GCC" = yes; then |
95 | # but apparently some variants of GNU ld only accept -v. | 68 | # Check if gcc -print-prog-name=ld gives a path. |
96 | # Break only if it was the GNU/non-GNU ld that we prefer. | 69 | case $host in |
97 | case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in | 70 | *-*-mingw*) |
98 | *GNU* | *'with BFD'*) | 71 | # gcc leaves a trailing carriage return which upsets mingw |
99 | test "$with_gnu_ld" != no && break | 72 | acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; |
100 | ;; | 73 | *) |
101 | *) | 74 | acl_output=`($CC -print-prog-name=ld) 2>&5` ;; |
102 | test "$with_gnu_ld" != yes && break | 75 | esac |
103 | ;; | 76 | case $acl_output in |
77 | # Accept absolute paths. | ||
78 | [[\\/]]* | ?:[[\\/]]*) | ||
79 | re_direlt='/[[^/]][[^/]]*/\.\./' | ||
80 | # Canonicalize the pathname of ld | ||
81 | acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` | ||
82 | while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do | ||
83 | acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` | ||
84 | done | ||
85 | # Got the pathname. No search in PATH is needed. | ||
86 | acl_cv_path_LD="$acl_output" | ||
87 | ac_prog= | ||
88 | ;; | ||
89 | "") | ||
90 | # If it fails, then pretend we aren't using GCC. | ||
91 | ;; | ||
92 | *) | ||
93 | # If it is relative, then search for the first ld in PATH. | ||
94 | with_gnu_ld=unknown | ||
95 | ;; | ||
104 | esac | 96 | esac |
105 | fi | 97 | fi |
106 | done | 98 | if test -n "$ac_prog"; then |
107 | IFS="$acl_save_ifs" | 99 | # Search for $ac_prog in $PATH. |
108 | else | 100 | acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR |
109 | acl_cv_path_LD="$LD" # Let the user override the test with a path. | 101 | for ac_dir in $PATH; do |
110 | fi]) | 102 | IFS="$acl_save_ifs" |
111 | LD="$acl_cv_path_LD" | 103 | test -z "$ac_dir" && ac_dir=. |
104 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then | ||
105 | acl_cv_path_LD="$ac_dir/$ac_prog" | ||
106 | # Check to see if the program is GNU ld. I'd rather use --version, | ||
107 | # but apparently some variants of GNU ld only accept -v. | ||
108 | # Break only if it was the GNU/non-GNU ld that we prefer. | ||
109 | case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in | ||
110 | *GNU* | *'with BFD'*) | ||
111 | test "$with_gnu_ld" != no && break | ||
112 | ;; | ||
113 | *) | ||
114 | test "$with_gnu_ld" != yes && break | ||
115 | ;; | ||
116 | esac | ||
117 | fi | ||
118 | done | ||
119 | IFS="$acl_save_ifs" | ||
120 | fi | ||
121 | case $host in | ||
122 | *-*-aix*) | ||
123 | AC_COMPILE_IFELSE( | ||
124 | [AC_LANG_SOURCE( | ||
125 | [[#if defined __powerpc64__ || defined __LP64__ | ||
126 | int ok; | ||
127 | #else | ||
128 | error fail | ||
129 | #endif | ||
130 | ]])], | ||
131 | [# The compiler produces 64-bit code. Add option '-b64' so that the | ||
132 | # linker groks 64-bit object files. | ||
133 | case "$acl_cv_path_LD " in | ||
134 | *" -b64 "*) ;; | ||
135 | *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; | ||
136 | esac | ||
137 | ], []) | ||
138 | ;; | ||
139 | sparc64-*-netbsd*) | ||
140 | AC_COMPILE_IFELSE( | ||
141 | [AC_LANG_SOURCE( | ||
142 | [[#if defined __sparcv9 || defined __arch64__ | ||
143 | int ok; | ||
144 | #else | ||
145 | error fail | ||
146 | #endif | ||
147 | ]])], | ||
148 | [], | ||
149 | [# The compiler produces 32-bit code. Add option '-m elf32_sparc' | ||
150 | # so that the linker groks 32-bit object files. | ||
151 | case "$acl_cv_path_LD " in | ||
152 | *" -m elf32_sparc "*) ;; | ||
153 | *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; | ||
154 | esac | ||
155 | ]) | ||
156 | ;; | ||
157 | esac | ||
158 | ]) | ||
159 | LD="$acl_cv_path_LD" | ||
160 | fi | ||
112 | if test -n "$LD"; then | 161 | if test -n "$LD"; then |
113 | AC_MSG_RESULT([$LD]) | 162 | AC_MSG_RESULT([$LD]) |
114 | else | 163 | else |
115 | AC_MSG_RESULT([no]) | 164 | AC_MSG_RESULT([no]) |
165 | AC_MSG_ERROR([no acceptable ld found in \$PATH]) | ||
116 | fi | 166 | fi |
117 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) | ||
118 | AC_LIB_PROG_LD_GNU | 167 | AC_LIB_PROG_LD_GNU |
119 | ]) | 168 | ]) |
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index 073f040..653e34f 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 | |||
@@ -1,12 +1,12 @@ | |||
1 | # lib-link.m4 serial 26 (gettext-0.18.2) | 1 | # lib-link.m4 serial 33 |
2 | dnl Copyright (C) 2001-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
8 | 8 | ||
9 | AC_PREREQ([2.54]) | 9 | AC_PREREQ([2.61]) |
10 | 10 | ||
11 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and | 11 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and |
12 | dnl the libraries corresponding to explicit and implicit dependencies. | 12 | dnl the libraries corresponding to explicit and implicit dependencies. |
@@ -124,8 +124,8 @@ dnl acl_hardcode_direct, | |||
124 | dnl acl_hardcode_minus_L. | 124 | dnl acl_hardcode_minus_L. |
125 | AC_DEFUN([AC_LIB_RPATH], | 125 | AC_DEFUN([AC_LIB_RPATH], |
126 | [ | 126 | [ |
127 | dnl Tell automake >= 1.10 to complain if config.rpath is missing. | 127 | dnl Complain if config.rpath is missing. |
128 | m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) | 128 | AC_REQUIRE_AUX_FILE([config.rpath]) |
129 | AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS | 129 | AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
130 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld | 130 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
131 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host | 131 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
@@ -187,17 +187,17 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
187 | pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], | 187 | pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], |
188 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | 188 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
189 | pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) | 189 | pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) |
190 | dnl Autoconf >= 2.61 supports dots in --with options. | ||
191 | pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) | ||
192 | dnl By default, look in $includedir and $libdir. | 190 | dnl By default, look in $includedir and $libdir. |
193 | use_additional=yes | 191 | use_additional=yes |
194 | AC_LIB_WITH_FINAL_PREFIX([ | 192 | AC_LIB_WITH_FINAL_PREFIX([ |
195 | eval additional_includedir=\"$includedir\" | 193 | eval additional_includedir=\"$includedir\" |
196 | eval additional_libdir=\"$libdir\" | 194 | eval additional_libdir=\"$libdir\" |
195 | eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" | ||
196 | eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" | ||
197 | ]) | 197 | ]) |
198 | AC_ARG_WITH(P_A_C_K[-prefix], | 198 | AC_ARG_WITH(PACK[-prefix], |
199 | [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib | 199 | [[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib |
200 | --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], | 200 | --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]], |
201 | [ | 201 | [ |
202 | if test "X$withval" = "Xno"; then | 202 | if test "X$withval" = "Xno"; then |
203 | use_additional=no | 203 | use_additional=no |
@@ -206,17 +206,23 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
206 | AC_LIB_WITH_FINAL_PREFIX([ | 206 | AC_LIB_WITH_FINAL_PREFIX([ |
207 | eval additional_includedir=\"$includedir\" | 207 | eval additional_includedir=\"$includedir\" |
208 | eval additional_libdir=\"$libdir\" | 208 | eval additional_libdir=\"$libdir\" |
209 | eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" | ||
210 | eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" | ||
209 | ]) | 211 | ]) |
210 | else | 212 | else |
211 | additional_includedir="$withval/include" | 213 | additional_includedir="$withval/include" |
212 | additional_libdir="$withval/$acl_libdirstem" | 214 | additional_libdir="$withval/$acl_libdirstem" |
213 | if test "$acl_libdirstem2" != "$acl_libdirstem" \ | 215 | additional_libdir2="$withval/$acl_libdirstem2" |
214 | && ! test -d "$withval/$acl_libdirstem"; then | 216 | additional_libdir3="$withval/$acl_libdirstem3" |
215 | additional_libdir="$withval/$acl_libdirstem2" | ||
216 | fi | ||
217 | fi | 217 | fi |
218 | fi | 218 | fi |
219 | ]) | 219 | ]) |
220 | if test "X$additional_libdir2" = "X$additional_libdir"; then | ||
221 | additional_libdir2= | ||
222 | fi | ||
223 | if test "X$additional_libdir3" = "X$additional_libdir"; then | ||
224 | additional_libdir3= | ||
225 | fi | ||
220 | dnl Search the library and its dependencies in $additional_libdir and | 226 | dnl Search the library and its dependencies in $additional_libdir and |
221 | dnl $LDFLAGS. Using breadth-first-seach. | 227 | dnl $LDFLAGS. Using breadth-first-seach. |
222 | LIB[]NAME= | 228 | LIB[]NAME= |
@@ -272,48 +278,54 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
272 | shrext= | 278 | shrext= |
273 | fi | 279 | fi |
274 | if test $use_additional = yes; then | 280 | if test $use_additional = yes; then |
275 | dir="$additional_libdir" | 281 | for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do |
276 | dnl The same code as in the loop below: | 282 | if test "X$found_dir" = "X"; then |
277 | dnl First look for a shared library. | 283 | eval dir=\$$additional_libdir_variable |
278 | if test -n "$acl_shlibext"; then | 284 | if test -n "$dir"; then |
279 | if test -f "$dir/$libname$shrext"; then | 285 | dnl The same code as in the loop below: |
280 | found_dir="$dir" | 286 | dnl First look for a shared library. |
281 | found_so="$dir/$libname$shrext" | 287 | if test -n "$acl_shlibext"; then |
282 | else | 288 | if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then |
283 | if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then | 289 | found_dir="$dir" |
284 | ver=`(cd "$dir" && \ | 290 | found_so="$dir/$libname$shrext" |
285 | for f in "$libname$shrext".*; do echo "$f"; done \ | 291 | else |
286 | | sed -e "s,^$libname$shrext\\\\.,," \ | 292 | if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
287 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | 293 | ver=`(cd "$dir" && \ |
288 | | sed 1q ) 2>/dev/null` | 294 | for f in "$libname$shrext".*; do echo "$f"; done \ |
289 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then | 295 | | sed -e "s,^$libname$shrext\\\\.,," \ |
290 | found_dir="$dir" | 296 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
291 | found_so="$dir/$libname$shrext.$ver" | 297 | | sed 1q ) 2>/dev/null` |
298 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then | ||
299 | found_dir="$dir" | ||
300 | found_so="$dir/$libname$shrext.$ver" | ||
301 | fi | ||
302 | else | ||
303 | eval library_names=\"$acl_library_names_spec\" | ||
304 | for f in $library_names; do | ||
305 | if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then | ||
306 | found_dir="$dir" | ||
307 | found_so="$dir/$f" | ||
308 | break | ||
309 | fi | ||
310 | done | ||
311 | fi | ||
312 | fi | ||
292 | fi | 313 | fi |
293 | else | 314 | dnl Then look for a static library. |
294 | eval library_names=\"$acl_library_names_spec\" | 315 | if test "X$found_dir" = "X"; then |
295 | for f in $library_names; do | 316 | if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then |
296 | if test -f "$dir/$f"; then | ||
297 | found_dir="$dir" | 317 | found_dir="$dir" |
298 | found_so="$dir/$f" | 318 | found_a="$dir/$libname.$acl_libext" |
299 | break | ||
300 | fi | 319 | fi |
301 | done | 320 | fi |
321 | if test "X$found_dir" != "X"; then | ||
322 | if test -f "$dir/$libname.la"; then | ||
323 | found_la="$dir/$libname.la" | ||
324 | fi | ||
325 | fi | ||
302 | fi | 326 | fi |
303 | fi | 327 | fi |
304 | fi | 328 | done |
305 | dnl Then look for a static library. | ||
306 | if test "X$found_dir" = "X"; then | ||
307 | if test -f "$dir/$libname.$acl_libext"; then | ||
308 | found_dir="$dir" | ||
309 | found_a="$dir/$libname.$acl_libext" | ||
310 | fi | ||
311 | fi | ||
312 | if test "X$found_dir" != "X"; then | ||
313 | if test -f "$dir/$libname.la"; then | ||
314 | found_la="$dir/$libname.la" | ||
315 | fi | ||
316 | fi | ||
317 | fi | 329 | fi |
318 | if test "X$found_dir" = "X"; then | 330 | if test "X$found_dir" = "X"; then |
319 | for x in $LDFLAGS $LTLIB[]NAME; do | 331 | for x in $LDFLAGS $LTLIB[]NAME; do |
@@ -323,7 +335,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
323 | dir=`echo "X$x" | sed -e 's/^X-L//'` | 335 | dir=`echo "X$x" | sed -e 's/^X-L//'` |
324 | dnl First look for a shared library. | 336 | dnl First look for a shared library. |
325 | if test -n "$acl_shlibext"; then | 337 | if test -n "$acl_shlibext"; then |
326 | if test -f "$dir/$libname$shrext"; then | 338 | if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then |
327 | found_dir="$dir" | 339 | found_dir="$dir" |
328 | found_so="$dir/$libname$shrext" | 340 | found_so="$dir/$libname$shrext" |
329 | else | 341 | else |
@@ -333,14 +345,14 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
333 | | sed -e "s,^$libname$shrext\\\\.,," \ | 345 | | sed -e "s,^$libname$shrext\\\\.,," \ |
334 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | 346 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
335 | | sed 1q ) 2>/dev/null` | 347 | | sed 1q ) 2>/dev/null` |
336 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then | 348 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then |
337 | found_dir="$dir" | 349 | found_dir="$dir" |
338 | found_so="$dir/$libname$shrext.$ver" | 350 | found_so="$dir/$libname$shrext.$ver" |
339 | fi | 351 | fi |
340 | else | 352 | else |
341 | eval library_names=\"$acl_library_names_spec\" | 353 | eval library_names=\"$acl_library_names_spec\" |
342 | for f in $library_names; do | 354 | for f in $library_names; do |
343 | if test -f "$dir/$f"; then | 355 | if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then |
344 | found_dir="$dir" | 356 | found_dir="$dir" |
345 | found_so="$dir/$f" | 357 | found_so="$dir/$f" |
346 | break | 358 | break |
@@ -351,7 +363,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
351 | fi | 363 | fi |
352 | dnl Then look for a static library. | 364 | dnl Then look for a static library. |
353 | if test "X$found_dir" = "X"; then | 365 | if test "X$found_dir" = "X"; then |
354 | if test -f "$dir/$libname.$acl_libext"; then | 366 | if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then |
355 | found_dir="$dir" | 367 | found_dir="$dir" |
356 | found_a="$dir/$libname.$acl_libext" | 368 | found_a="$dir/$libname.$acl_libext" |
357 | fi | 369 | fi |
@@ -377,7 +389,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
377 | dnl standard /usr/lib. | 389 | dnl standard /usr/lib. |
378 | if test "$enable_rpath" = no \ | 390 | if test "$enable_rpath" = no \ |
379 | || test "X$found_dir" = "X/usr/$acl_libdirstem" \ | 391 | || test "X$found_dir" = "X/usr/$acl_libdirstem" \ |
380 | || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then | 392 | || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ |
393 | || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then | ||
381 | dnl No hardcoding is needed. | 394 | dnl No hardcoding is needed. |
382 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | 395 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
383 | else | 396 | else |
@@ -477,6 +490,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
477 | fi | 490 | fi |
478 | additional_includedir="$basedir/include" | 491 | additional_includedir="$basedir/include" |
479 | ;; | 492 | ;; |
493 | */$acl_libdirstem3 | */$acl_libdirstem3/) | ||
494 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` | ||
495 | if test "$name" = '$1'; then | ||
496 | LIB[]NAME[]_PREFIX="$basedir" | ||
497 | fi | ||
498 | additional_includedir="$basedir/include" | ||
499 | ;; | ||
480 | esac | 500 | esac |
481 | if test "X$additional_includedir" != "X"; then | 501 | if test "X$additional_includedir" != "X"; then |
482 | dnl Potentially add $additional_includedir to $INCNAME. | 502 | dnl Potentially add $additional_includedir to $INCNAME. |
@@ -527,19 +547,21 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
527 | for dep in $dependency_libs; do | 547 | for dep in $dependency_libs; do |
528 | case "$dep" in | 548 | case "$dep" in |
529 | -L*) | 549 | -L*) |
530 | additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` | 550 | dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` |
531 | dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. | 551 | dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. |
532 | dnl But don't add it | 552 | dnl But don't add it |
533 | dnl 1. if it's the standard /usr/lib, | 553 | dnl 1. if it's the standard /usr/lib, |
534 | dnl 2. if it's /usr/local/lib and we are using GCC on Linux, | 554 | dnl 2. if it's /usr/local/lib and we are using GCC on Linux, |
535 | dnl 3. if it's already present in $LDFLAGS or the already | 555 | dnl 3. if it's already present in $LDFLAGS or the already |
536 | dnl constructed $LIBNAME, | 556 | dnl constructed $LIBNAME, |
537 | dnl 4. if it doesn't exist as a directory. | 557 | dnl 4. if it doesn't exist as a directory. |
538 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ | 558 | if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ |
539 | && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then | 559 | && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ |
560 | && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then | ||
540 | haveit= | 561 | haveit= |
541 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ | 562 | if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ |
542 | || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then | 563 | || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ |
564 | || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then | ||
543 | if test -n "$GCC"; then | 565 | if test -n "$GCC"; then |
544 | case $host_os in | 566 | case $host_os in |
545 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; | 567 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
@@ -550,29 +572,29 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
550 | haveit= | 572 | haveit= |
551 | for x in $LDFLAGS $LIB[]NAME; do | 573 | for x in $LDFLAGS $LIB[]NAME; do |
552 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | 574 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
553 | if test "X$x" = "X-L$additional_libdir"; then | 575 | if test "X$x" = "X-L$dependency_libdir"; then |
554 | haveit=yes | 576 | haveit=yes |
555 | break | 577 | break |
556 | fi | 578 | fi |
557 | done | 579 | done |
558 | if test -z "$haveit"; then | 580 | if test -z "$haveit"; then |
559 | if test -d "$additional_libdir"; then | 581 | if test -d "$dependency_libdir"; then |
560 | dnl Really add $additional_libdir to $LIBNAME. | 582 | dnl Really add $dependency_libdir to $LIBNAME. |
561 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" | 583 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" |
562 | fi | 584 | fi |
563 | fi | 585 | fi |
564 | haveit= | 586 | haveit= |
565 | for x in $LDFLAGS $LTLIB[]NAME; do | 587 | for x in $LDFLAGS $LTLIB[]NAME; do |
566 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | 588 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
567 | if test "X$x" = "X-L$additional_libdir"; then | 589 | if test "X$x" = "X-L$dependency_libdir"; then |
568 | haveit=yes | 590 | haveit=yes |
569 | break | 591 | break |
570 | fi | 592 | fi |
571 | done | 593 | done |
572 | if test -z "$haveit"; then | 594 | if test -z "$haveit"; then |
573 | if test -d "$additional_libdir"; then | 595 | if test -d "$dependency_libdir"; then |
574 | dnl Really add $additional_libdir to $LTLIBNAME. | 596 | dnl Really add $dependency_libdir to $LTLIBNAME. |
575 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" | 597 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" |
576 | fi | 598 | fi |
577 | fi | 599 | fi |
578 | fi | 600 | fi |
@@ -609,7 +631,20 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
609 | ;; | 631 | ;; |
610 | -l*) | 632 | -l*) |
611 | dnl Handle this in the next round. | 633 | dnl Handle this in the next round. |
612 | names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` | 634 | dnl But on GNU systems, ignore -lc options, because |
635 | dnl - linking with libc is the default anyway, | ||
636 | dnl - linking with libc.a may produce an error | ||
637 | dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" | ||
638 | dnl or may produce an executable that always crashes, see | ||
639 | dnl <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>. | ||
640 | dep=`echo "X$dep" | sed -e 's/^X-l//'` | ||
641 | if test "X$dep" != Xc \ | ||
642 | || case $host_os in | ||
643 | linux* | gnu* | k*bsd*-gnu) false ;; | ||
644 | *) true ;; | ||
645 | esac; then | ||
646 | names_next_round="$names_next_round $dep" | ||
647 | fi | ||
613 | ;; | 648 | ;; |
614 | *.la) | 649 | *.la) |
615 | dnl Handle this in the next round. Throw away the .la's | 650 | dnl Handle this in the next round. Throw away the .la's |
@@ -670,7 +705,6 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
670 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" | 705 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" |
671 | done | 706 | done |
672 | fi | 707 | fi |
673 | popdef([P_A_C_K]) | ||
674 | popdef([PACKLIBS]) | 708 | popdef([PACKLIBS]) |
675 | popdef([PACKUP]) | 709 | popdef([PACKUP]) |
676 | popdef([PACK]) | 710 | popdef([PACK]) |
@@ -721,7 +755,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | |||
721 | dir="$next" | 755 | dir="$next" |
722 | dnl No need to hardcode the standard /usr/lib. | 756 | dnl No need to hardcode the standard /usr/lib. |
723 | if test "X$dir" != "X/usr/$acl_libdirstem" \ | 757 | if test "X$dir" != "X/usr/$acl_libdirstem" \ |
724 | && test "X$dir" != "X/usr/$acl_libdirstem2"; then | 758 | && test "X$dir" != "X/usr/$acl_libdirstem2" \ |
759 | && test "X$dir" != "X/usr/$acl_libdirstem3"; then | ||
725 | rpathdirs="$rpathdirs $dir" | 760 | rpathdirs="$rpathdirs $dir" |
726 | fi | 761 | fi |
727 | next= | 762 | next= |
@@ -731,7 +766,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | |||
731 | -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` | 766 | -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` |
732 | dnl No need to hardcode the standard /usr/lib. | 767 | dnl No need to hardcode the standard /usr/lib. |
733 | if test "X$dir" != "X/usr/$acl_libdirstem" \ | 768 | if test "X$dir" != "X/usr/$acl_libdirstem" \ |
734 | && test "X$dir" != "X/usr/$acl_libdirstem2"; then | 769 | && test "X$dir" != "X/usr/$acl_libdirstem2" \ |
770 | && test "X$dir" != "X/usr/$acl_libdirstem3"; then | ||
735 | rpathdirs="$rpathdirs $dir" | 771 | rpathdirs="$rpathdirs $dir" |
736 | fi | 772 | fi |
737 | next= ;; | 773 | next= ;; |
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4 index 60908e8..aefe7f7 100644 --- a/gl/m4/lib-prefix.m4 +++ b/gl/m4/lib-prefix.m4 | |||
@@ -1,18 +1,11 @@ | |||
1 | # lib-prefix.m4 serial 7 (gettext-0.18) | 1 | # lib-prefix.m4 serial 20 |
2 | dnl Copyright (C) 2001-2005, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2005, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
8 | 8 | ||
9 | dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and | ||
10 | dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't | ||
11 | dnl require excessive bracketing. | ||
12 | ifdef([AC_HELP_STRING], | ||
13 | [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], | ||
14 | [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) | ||
15 | |||
16 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed | 9 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed |
17 | dnl to access previously installed libraries. The basic assumption is that | 10 | dnl to access previously installed libraries. The basic assumption is that |
18 | dnl a user will want packages to use other packages he previously installed | 11 | dnl a user will want packages to use other packages he previously installed |
@@ -32,9 +25,9 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
32 | eval additional_includedir=\"$includedir\" | 25 | eval additional_includedir=\"$includedir\" |
33 | eval additional_libdir=\"$libdir\" | 26 | eval additional_libdir=\"$libdir\" |
34 | ]) | 27 | ]) |
35 | AC_LIB_ARG_WITH([lib-prefix], | 28 | AC_ARG_WITH([lib-prefix], |
36 | [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib | 29 | [[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib |
37 | --without-lib-prefix don't search for libraries in includedir and libdir], | 30 | --without-lib-prefix don't search for libraries in includedir and libdir]], |
38 | [ | 31 | [ |
39 | if test "X$withval" = "Xno"; then | 32 | if test "X$withval" = "Xno"; then |
40 | use_additional=no | 33 | use_additional=no |
@@ -154,71 +147,177 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | |||
154 | ]) | 147 | ]) |
155 | 148 | ||
156 | dnl AC_LIB_PREPARE_MULTILIB creates | 149 | dnl AC_LIB_PREPARE_MULTILIB creates |
157 | dnl - a variable acl_libdirstem, containing the basename of the libdir, either | 150 | dnl - a function acl_is_expected_elfclass, that tests whether standard input |
158 | dnl "lib" or "lib64" or "lib/64", | 151 | dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, |
159 | dnl - a variable acl_libdirstem2, as a secondary possible value for | 152 | dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing |
160 | dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or | 153 | dnl the basename of the libdir to try in turn, either "lib" or "lib64" or |
161 | dnl "lib/amd64". | 154 | dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. |
162 | AC_DEFUN([AC_LIB_PREPARE_MULTILIB], | 155 | AC_DEFUN([AC_LIB_PREPARE_MULTILIB], |
163 | [ | 156 | [ |
164 | dnl There is no formal standard regarding lib and lib64. | 157 | dnl There is no formal standard regarding lib, lib32, and lib64. |
165 | dnl On glibc systems, the current practice is that on a system supporting | 158 | dnl On most glibc systems, the current practice is that on a system supporting |
166 | dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under | 159 | dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under |
167 | dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine | 160 | dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on |
168 | dnl the compiler's default mode by looking at the compiler's library search | 161 | dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go |
169 | dnl path. If at least one of its elements ends in /lib64 or points to a | 162 | dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. |
170 | dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. | 163 | dnl We determine the compiler's default mode by looking at the compiler's |
171 | dnl Otherwise we use the default, namely "lib". | 164 | dnl library search path. If at least one of its elements ends in /lib64 or |
165 | dnl points to a directory whose absolute pathname ends in /lib64, we use that | ||
166 | dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, | ||
167 | dnl namely "lib". | ||
172 | dnl On Solaris systems, the current practice is that on a system supporting | 168 | dnl On Solaris systems, the current practice is that on a system supporting |
173 | dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under | 169 | dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under |
174 | dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or | 170 | dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or |
175 | dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. | 171 | dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. |
176 | AC_REQUIRE([AC_CANONICAL_HOST]) | 172 | AC_REQUIRE([AC_CANONICAL_HOST]) |
177 | acl_libdirstem=lib | 173 | AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) |
178 | acl_libdirstem2= | 174 | |
179 | case "$host_os" in | 175 | AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], |
180 | solaris*) | 176 | [AC_EGREP_CPP([Extensible Linking Format], |
181 | dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment | 177 | [#if defined __ELF__ || (defined __linux__ && defined __EDG__) |
182 | dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>. | 178 | Extensible Linking Format |
183 | dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." | 179 | #endif |
184 | dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the | 180 | ], |
185 | dnl symlink is missing, so we set acl_libdirstem2 too. | 181 | [gl_cv_elf=yes], |
186 | AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], | 182 | [gl_cv_elf=no]) |
187 | [AC_EGREP_CPP([sixtyfour bits], [ | 183 | ]) |
188 | #ifdef _LP64 | 184 | if test $gl_cv_elf = yes; then |
189 | sixtyfour bits | 185 | # Extract the ELF class of a file (5th byte) in decimal. |
190 | #endif | 186 | # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header |
191 | ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) | 187 | if od -A x < /dev/null >/dev/null 2>/dev/null; then |
192 | ]) | 188 | # Use POSIX od. |
193 | if test $gl_cv_solaris_64bit = yes; then | 189 | func_elfclass () |
194 | acl_libdirstem=lib/64 | 190 | { |
195 | case "$host_cpu" in | 191 | od -A n -t d1 -j 4 -N 1 |
196 | sparc*) acl_libdirstem2=lib/sparcv9 ;; | 192 | } |
197 | i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; | 193 | else |
198 | esac | 194 | # Use BSD hexdump. |
199 | fi | 195 | func_elfclass () |
200 | ;; | 196 | { |
201 | *) | 197 | dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' |
202 | searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` | 198 | echo |
203 | if test -n "$searchpath"; then | 199 | } |
204 | acl_save_IFS="${IFS= }"; IFS=":" | 200 | fi |
205 | for searchdir in $searchpath; do | 201 | # Use 'expr', not 'test', to compare the values of func_elfclass, because on |
206 | if test -d "$searchdir"; then | 202 | # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, |
207 | case "$searchdir" in | 203 | # not 1 or 2. |
208 | */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; | 204 | changequote(,)dnl |
209 | */../ | */.. ) | 205 | case $HOST_CPU_C_ABI_32BIT in |
210 | # Better ignore directories of this form. They are misleading. | 206 | yes) |
211 | ;; | 207 | # 32-bit ABI. |
212 | *) searchdir=`cd "$searchdir" && pwd` | 208 | acl_is_expected_elfclass () |
213 | case "$searchdir" in | 209 | { |
214 | */lib64 ) acl_libdirstem=lib64 ;; | 210 | expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null |
215 | esac ;; | 211 | } |
216 | esac | 212 | ;; |
217 | fi | 213 | no) |
218 | done | 214 | # 64-bit ABI. |
219 | IFS="$acl_save_IFS" | 215 | acl_is_expected_elfclass () |
220 | fi | 216 | { |
221 | ;; | 217 | expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null |
222 | esac | 218 | } |
223 | test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" | 219 | ;; |
220 | *) | ||
221 | # Unknown. | ||
222 | acl_is_expected_elfclass () | ||
223 | { | ||
224 | : | ||
225 | } | ||
226 | ;; | ||
227 | esac | ||
228 | changequote([,])dnl | ||
229 | else | ||
230 | acl_is_expected_elfclass () | ||
231 | { | ||
232 | : | ||
233 | } | ||
234 | fi | ||
235 | |||
236 | dnl Allow the user to override the result by setting acl_cv_libdirstems. | ||
237 | AC_CACHE_CHECK([for the common suffixes of directories in the library search path], | ||
238 | [acl_cv_libdirstems], | ||
239 | [dnl Try 'lib' first, because that's the default for libdir in GNU, see | ||
240 | dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>. | ||
241 | acl_libdirstem=lib | ||
242 | acl_libdirstem2= | ||
243 | acl_libdirstem3= | ||
244 | case "$host_os" in | ||
245 | solaris*) | ||
246 | dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment | ||
247 | dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>. | ||
248 | dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." | ||
249 | dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the | ||
250 | dnl symlink is missing, so we set acl_libdirstem2 too. | ||
251 | if test $HOST_CPU_C_ABI_32BIT = no; then | ||
252 | acl_libdirstem2=lib/64 | ||
253 | case "$host_cpu" in | ||
254 | sparc*) acl_libdirstem3=lib/sparcv9 ;; | ||
255 | i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; | ||
256 | esac | ||
257 | fi | ||
258 | ;; | ||
259 | *) | ||
260 | dnl If $CC generates code for a 32-bit ABI, the libraries are | ||
261 | dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. | ||
262 | dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries | ||
263 | dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. | ||
264 | dnl Find the compiler's search path. However, non-system compilers | ||
265 | dnl sometimes have odd library search paths. But we can't simply invoke | ||
266 | dnl '/usr/bin/gcc -print-search-dirs' because that would not take into | ||
267 | dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. | ||
268 | searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ | ||
269 | | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` | ||
270 | if test $HOST_CPU_C_ABI_32BIT != no; then | ||
271 | # 32-bit or unknown ABI. | ||
272 | if test -d /usr/lib32; then | ||
273 | acl_libdirstem2=lib32 | ||
274 | fi | ||
275 | fi | ||
276 | if test $HOST_CPU_C_ABI_32BIT != yes; then | ||
277 | # 64-bit or unknown ABI. | ||
278 | if test -d /usr/lib64; then | ||
279 | acl_libdirstem3=lib64 | ||
280 | fi | ||
281 | fi | ||
282 | if test -n "$searchpath"; then | ||
283 | acl_save_IFS="${IFS= }"; IFS=":" | ||
284 | for searchdir in $searchpath; do | ||
285 | if test -d "$searchdir"; then | ||
286 | case "$searchdir" in | ||
287 | */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; | ||
288 | */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; | ||
289 | */../ | */.. ) | ||
290 | # Better ignore directories of this form. They are misleading. | ||
291 | ;; | ||
292 | *) searchdir=`cd "$searchdir" && pwd` | ||
293 | case "$searchdir" in | ||
294 | */lib32 ) acl_libdirstem2=lib32 ;; | ||
295 | */lib64 ) acl_libdirstem3=lib64 ;; | ||
296 | esac ;; | ||
297 | esac | ||
298 | fi | ||
299 | done | ||
300 | IFS="$acl_save_IFS" | ||
301 | if test $HOST_CPU_C_ABI_32BIT = yes; then | ||
302 | # 32-bit ABI. | ||
303 | acl_libdirstem3= | ||
304 | fi | ||
305 | if test $HOST_CPU_C_ABI_32BIT = no; then | ||
306 | # 64-bit ABI. | ||
307 | acl_libdirstem2= | ||
308 | fi | ||
309 | fi | ||
310 | ;; | ||
311 | esac | ||
312 | test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" | ||
313 | test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" | ||
314 | acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" | ||
315 | ]) | ||
316 | dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and | ||
317 | dnl acl_libdirstem3. | ||
318 | changequote(,)dnl | ||
319 | acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` | ||
320 | acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` | ||
321 | acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` | ||
322 | changequote([,])dnl | ||
224 | ]) | 323 | ]) |
diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4 new file mode 100644 index 0000000..5088fa1 --- /dev/null +++ b/gl/m4/limits-h.m4 | |||
@@ -0,0 +1,41 @@ | |||
1 | dnl Check whether limits.h has needed features. | ||
2 | |||
3 | dnl Copyright 2016-2023 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 | |||
8 | dnl From Paul Eggert. | ||
9 | |||
10 | AC_DEFUN_ONCE([gl_LIMITS_H], | ||
11 | [ | ||
12 | gl_CHECK_NEXT_HEADERS([limits.h]) | ||
13 | |||
14 | AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.], | ||
15 | [gl_cv_header_limits_width], | ||
16 | [AC_COMPILE_IFELSE( | ||
17 | [AC_LANG_PROGRAM( | ||
18 | [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
19 | #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 | ||
20 | #endif | ||
21 | #include <limits.h> | ||
22 | long long llm = LLONG_MAX; | ||
23 | int wb = WORD_BIT; | ||
24 | int ullw = ULLONG_WIDTH; | ||
25 | int bw = BOOL_WIDTH; | ||
26 | ]])], | ||
27 | [gl_cv_header_limits_width=yes], | ||
28 | [gl_cv_header_limits_width=no])]) | ||
29 | if test "$gl_cv_header_limits_width" = yes; then | ||
30 | GL_GENERATE_LIMITS_H=false | ||
31 | else | ||
32 | GL_GENERATE_LIMITS_H=true | ||
33 | fi | ||
34 | ]) | ||
35 | |||
36 | dnl Unconditionally enables the replacement of <limits.h>. | ||
37 | AC_DEFUN([gl_REPLACE_LIMITS_H], | ||
38 | [ | ||
39 | AC_REQUIRE([gl_LIMITS_H]) | ||
40 | GL_GENERATE_LIMITS_H=true | ||
41 | ]) | ||
diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 index 2e93e58..15b6b2a 100644 --- a/gl/m4/localcharset.m4 +++ b/gl/m4/localcharset.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # localcharset.m4 serial 7 | 1 | # localcharset.m4 serial 8 |
2 | dnl Copyright (C) 2002, 2004, 2006, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2004, 2006, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,10 +8,4 @@ AC_DEFUN([gl_LOCALCHARSET], | |||
8 | [ | 8 | [ |
9 | dnl Prerequisites of lib/localcharset.c. | 9 | dnl Prerequisites of lib/localcharset.c. |
10 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 10 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
11 | AC_REQUIRE([gl_FCNTL_O_FLAGS]) | ||
12 | AC_CHECK_DECLS_ONCE([getc_unlocked]) | ||
13 | |||
14 | dnl Prerequisites of the lib/Makefile.am snippet. | ||
15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
16 | AC_REQUIRE([gl_GLIBC21]) | ||
17 | ]) | 11 | ]) |
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index ef199e3..8c41fad 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # locale-fr.m4 serial 17 | 1 | # locale-fr.m4 serial 20 |
2 | dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_FR], | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
14 | AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [ | 14 | AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [ |
15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
16 | changequote(,)dnl | ||
17 | #include <locale.h> | 16 | #include <locale.h> |
18 | #include <time.h> | 17 | #include <time.h> |
19 | #if HAVE_LANGINFO_CODESET | 18 | #if HAVE_LANGINFO_CODESET |
@@ -24,8 +23,14 @@ changequote(,)dnl | |||
24 | struct tm t; | 23 | struct tm t; |
25 | char buf[16]; | 24 | char buf[16]; |
26 | int main () { | 25 | int main () { |
26 | /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl | ||
27 | imitates locale dependent behaviour by looking at the environment | ||
28 | variables, and all locales use the UTF-8 encoding. */ | ||
29 | #if defined __BEOS__ || defined __HAIKU__ | ||
30 | return 1; | ||
31 | #else | ||
27 | /* Check whether the given locale name is recognized by the system. */ | 32 | /* Check whether the given locale name is recognized by the system. */ |
28 | #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ | 33 | # if defined _WIN32 && !defined __CYGWIN__ |
29 | /* On native Windows, setlocale(category, "") looks at the system settings, | 34 | /* On native Windows, setlocale(category, "") looks at the system settings, |
30 | not at the environment variables. Also, when an encoding suffix such | 35 | not at the environment variables. Also, when an encoding suffix such |
31 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE | 36 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE |
@@ -33,9 +38,9 @@ int main () { | |||
33 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL | 38 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL |
34 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) | 39 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) |
35 | return 1; | 40 | return 1; |
36 | #else | 41 | # else |
37 | if (setlocale (LC_ALL, "") == NULL) return 1; | 42 | if (setlocale (LC_ALL, "") == NULL) return 1; |
38 | #endif | 43 | # endif |
39 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". | 44 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". |
40 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) | 45 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) |
41 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. | 46 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. |
@@ -44,35 +49,35 @@ int main () { | |||
44 | some unit tests fail. | 49 | some unit tests fail. |
45 | On MirBSD 10, when an unsupported locale is specified, setlocale() | 50 | On MirBSD 10, when an unsupported locale is specified, setlocale() |
46 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ | 51 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ |
47 | #if HAVE_LANGINFO_CODESET | 52 | # if HAVE_LANGINFO_CODESET |
48 | { | 53 | { |
49 | const char *cs = nl_langinfo (CODESET); | 54 | const char *cs = nl_langinfo (CODESET); |
50 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 | 55 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 |
51 | || strcmp (cs, "UTF-8") == 0) | 56 | || strcmp (cs, "UTF-8") == 0) |
52 | return 1; | 57 | return 1; |
53 | } | 58 | } |
54 | #endif | 59 | # endif |
55 | #ifdef __CYGWIN__ | 60 | # ifdef __CYGWIN__ |
56 | /* On Cygwin, avoid locale names without encoding suffix, because the | 61 | /* On Cygwin, avoid locale names without encoding suffix, because the |
57 | locale_charset() function relies on the encoding suffix. Note that | 62 | locale_charset() function relies on the encoding suffix. Note that |
58 | LC_ALL is set on the command line. */ | 63 | LC_ALL is set on the command line. */ |
59 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; | 64 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; |
60 | #endif | 65 | # endif |
61 | /* Check whether in the abbreviation of the second month, the second | 66 | /* Check whether in the abbreviation of the second month, the second |
62 | character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only | 67 | character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only |
63 | one byte long. This excludes the UTF-8 encoding. */ | 68 | one byte long. This excludes the UTF-8 encoding. */ |
64 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; | 69 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; |
65 | if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; | 70 | if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; |
66 | #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ | 71 | # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ |
67 | /* Check whether the decimal separator is a comma. | 72 | /* Check whether the decimal separator is a comma. |
68 | On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point | 73 | On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point |
69 | are nl_langinfo(RADIXCHAR) are both ".". */ | 74 | are nl_langinfo(RADIXCHAR) are both ".". */ |
70 | if (localeconv () ->decimal_point[0] != ',') return 1; | 75 | if (localeconv () ->decimal_point[0] != ',') return 1; |
71 | #endif | 76 | # endif |
72 | return 0; | 77 | return 0; |
78 | #endif | ||
73 | } | 79 | } |
74 | changequote([,])dnl | 80 | ]])]) |
75 | ])]) | ||
76 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 81 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
77 | case "$host_os" in | 82 | case "$host_os" in |
78 | # Handle native Windows specially, because there setlocale() interprets | 83 | # Handle native Windows specially, because there setlocale() interprets |
@@ -136,8 +141,7 @@ AC_DEFUN([gt_LOCALE_FR_UTF8], | |||
136 | [ | 141 | [ |
137 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 142 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
138 | AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ | 143 | AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ |
139 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | 144 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
140 | changequote(,)dnl | ||
141 | #include <locale.h> | 145 | #include <locale.h> |
142 | #include <time.h> | 146 | #include <time.h> |
143 | #if HAVE_LANGINFO_CODESET | 147 | #if HAVE_LANGINFO_CODESET |
@@ -153,7 +157,7 @@ int main () { | |||
153 | variables, and all locales use the UTF-8 encoding. */ | 157 | variables, and all locales use the UTF-8 encoding. */ |
154 | #if !(defined __BEOS__ || defined __HAIKU__) | 158 | #if !(defined __BEOS__ || defined __HAIKU__) |
155 | /* Check whether the given locale name is recognized by the system. */ | 159 | /* Check whether the given locale name is recognized by the system. */ |
156 | # if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ | 160 | # if defined _WIN32 && !defined __CYGWIN__ |
157 | /* On native Windows, setlocale(category, "") looks at the system settings, | 161 | /* On native Windows, setlocale(category, "") looks at the system settings, |
158 | not at the environment variables. Also, when an encoding suffix such | 162 | not at the environment variables. Also, when an encoding suffix such |
159 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE | 163 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE |
@@ -199,8 +203,7 @@ int main () { | |||
199 | #endif | 203 | #endif |
200 | return 0; | 204 | return 0; |
201 | } | 205 | } |
202 | changequote([,])dnl | 206 | ]])]) |
203 | ])]) | ||
204 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 207 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
205 | case "$host_os" in | 208 | case "$host_os" in |
206 | # Handle native Windows specially, because there setlocale() interprets | 209 | # Handle native Windows specially, because there setlocale() interprets |
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index 132a3e7..2590173 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # locale-ja.m4 serial 12 | 1 | # locale-ja.m4 serial 15 |
2 | dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_JA], | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
14 | AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ | 14 | AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ |
15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
16 | changequote(,)dnl | ||
17 | #include <locale.h> | 16 | #include <locale.h> |
18 | #include <time.h> | 17 | #include <time.h> |
19 | #if HAVE_LANGINFO_CODESET | 18 | #if HAVE_LANGINFO_CODESET |
@@ -25,9 +24,14 @@ struct tm t; | |||
25 | char buf[16]; | 24 | char buf[16]; |
26 | int main () | 25 | int main () |
27 | { | 26 | { |
28 | const char *p; | 27 | /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl |
28 | imitates locale dependent behaviour by looking at the environment | ||
29 | variables, and all locales use the UTF-8 encoding. */ | ||
30 | #if defined __BEOS__ || defined __HAIKU__ | ||
31 | return 1; | ||
32 | #else | ||
29 | /* Check whether the given locale name is recognized by the system. */ | 33 | /* Check whether the given locale name is recognized by the system. */ |
30 | #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ | 34 | # if defined _WIN32 && !defined __CYGWIN__ |
31 | /* On native Windows, setlocale(category, "") looks at the system settings, | 35 | /* On native Windows, setlocale(category, "") looks at the system settings, |
32 | not at the environment variables. Also, when an encoding suffix such | 36 | not at the environment variables. Also, when an encoding suffix such |
33 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE | 37 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE |
@@ -35,9 +39,9 @@ int main () | |||
35 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL | 39 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL |
36 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) | 40 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) |
37 | return 1; | 41 | return 1; |
38 | #else | 42 | # else |
39 | if (setlocale (LC_ALL, "") == NULL) return 1; | 43 | if (setlocale (LC_ALL, "") == NULL) return 1; |
40 | #endif | 44 | # endif |
41 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". | 45 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". |
42 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) | 46 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) |
43 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. | 47 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. |
@@ -46,35 +50,38 @@ int main () | |||
46 | some unit tests fail. | 50 | some unit tests fail. |
47 | On MirBSD 10, when an unsupported locale is specified, setlocale() | 51 | On MirBSD 10, when an unsupported locale is specified, setlocale() |
48 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ | 52 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ |
49 | #if HAVE_LANGINFO_CODESET | 53 | # if HAVE_LANGINFO_CODESET |
50 | { | 54 | { |
51 | const char *cs = nl_langinfo (CODESET); | 55 | const char *cs = nl_langinfo (CODESET); |
52 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 | 56 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 |
53 | || strcmp (cs, "UTF-8") == 0) | 57 | || strcmp (cs, "UTF-8") == 0) |
54 | return 1; | 58 | return 1; |
55 | } | 59 | } |
56 | #endif | 60 | # endif |
57 | #ifdef __CYGWIN__ | 61 | # ifdef __CYGWIN__ |
58 | /* On Cygwin, avoid locale names without encoding suffix, because the | 62 | /* On Cygwin, avoid locale names without encoding suffix, because the |
59 | locale_charset() function relies on the encoding suffix. Note that | 63 | locale_charset() function relies on the encoding suffix. Note that |
60 | LC_ALL is set on the command line. */ | 64 | LC_ALL is set on the command line. */ |
61 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; | 65 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; |
62 | #endif | 66 | # endif |
63 | /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales | 67 | /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales |
64 | on Cygwin 1.5.x. */ | 68 | on Cygwin 1.5.x. */ |
65 | if (MB_CUR_MAX == 1) | 69 | if (MB_CUR_MAX == 1) |
66 | return 1; | 70 | return 1; |
67 | /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. | 71 | /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. |
68 | This excludes the UTF-8 encoding (except on MirBSD). */ | 72 | This excludes the UTF-8 encoding (except on MirBSD). */ |
69 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; | 73 | { |
70 | if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; | 74 | const char *p; |
71 | for (p = buf; *p != '\0'; p++) | 75 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; |
72 | if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) | 76 | if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; |
73 | return 1; | 77 | for (p = buf; *p != '\0'; p++) |
78 | if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) | ||
79 | return 1; | ||
80 | } | ||
74 | return 0; | 81 | return 0; |
82 | #endif | ||
75 | } | 83 | } |
76 | changequote([,])dnl | 84 | ]])]) |
77 | ])]) | ||
78 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 85 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
79 | case "$host_os" in | 86 | case "$host_os" in |
80 | # Handle native Windows specially, because there setlocale() interprets | 87 | # Handle native Windows specially, because there setlocale() interprets |
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index 4eed73f..b9f9eef 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # locale-zh.m4 serial 12 | 1 | # locale-zh.m4 serial 15 |
2 | dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_ZH_CN], | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
14 | AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ | 14 | AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ |
15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
16 | changequote(,)dnl | ||
17 | #include <locale.h> | 16 | #include <locale.h> |
18 | #include <stdlib.h> | 17 | #include <stdlib.h> |
19 | #include <time.h> | 18 | #include <time.h> |
@@ -26,9 +25,14 @@ struct tm t; | |||
26 | char buf[16]; | 25 | char buf[16]; |
27 | int main () | 26 | int main () |
28 | { | 27 | { |
29 | const char *p; | 28 | /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl |
29 | imitates locale dependent behaviour by looking at the environment | ||
30 | variables, and all locales use the UTF-8 encoding. */ | ||
31 | #if defined __BEOS__ || defined __HAIKU__ | ||
32 | return 1; | ||
33 | #else | ||
30 | /* Check whether the given locale name is recognized by the system. */ | 34 | /* Check whether the given locale name is recognized by the system. */ |
31 | #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ | 35 | # if defined _WIN32 && !defined __CYGWIN__ |
32 | /* On native Windows, setlocale(category, "") looks at the system settings, | 36 | /* On native Windows, setlocale(category, "") looks at the system settings, |
33 | not at the environment variables. Also, when an encoding suffix such | 37 | not at the environment variables. Also, when an encoding suffix such |
34 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE | 38 | as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE |
@@ -36,9 +40,9 @@ int main () | |||
36 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL | 40 | if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL |
37 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) | 41 | || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) |
38 | return 1; | 42 | return 1; |
39 | #else | 43 | # else |
40 | if (setlocale (LC_ALL, "") == NULL) return 1; | 44 | if (setlocale (LC_ALL, "") == NULL) return 1; |
41 | #endif | 45 | # endif |
42 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". | 46 | /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". |
43 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) | 47 | On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) |
44 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. | 48 | is empty, and the behaviour of Tcl 8.4 in this locale is not useful. |
@@ -47,35 +51,38 @@ int main () | |||
47 | some unit tests fail. | 51 | some unit tests fail. |
48 | On MirBSD 10, when an unsupported locale is specified, setlocale() | 52 | On MirBSD 10, when an unsupported locale is specified, setlocale() |
49 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ | 53 | succeeds but then nl_langinfo(CODESET) is "UTF-8". */ |
50 | #if HAVE_LANGINFO_CODESET | 54 | # if HAVE_LANGINFO_CODESET |
51 | { | 55 | { |
52 | const char *cs = nl_langinfo (CODESET); | 56 | const char *cs = nl_langinfo (CODESET); |
53 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 | 57 | if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 |
54 | || strcmp (cs, "UTF-8") == 0) | 58 | || strcmp (cs, "UTF-8") == 0) |
55 | return 1; | 59 | return 1; |
56 | } | 60 | } |
57 | #endif | 61 | # endif |
58 | #ifdef __CYGWIN__ | 62 | # ifdef __CYGWIN__ |
59 | /* On Cygwin, avoid locale names without encoding suffix, because the | 63 | /* On Cygwin, avoid locale names without encoding suffix, because the |
60 | locale_charset() function relies on the encoding suffix. Note that | 64 | locale_charset() function relies on the encoding suffix. Note that |
61 | LC_ALL is set on the command line. */ | 65 | LC_ALL is set on the command line. */ |
62 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; | 66 | if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; |
63 | #endif | 67 | # endif |
64 | /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. | 68 | /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. |
65 | This excludes the UTF-8 encoding (except on MirBSD). */ | 69 | This excludes the UTF-8 encoding (except on MirBSD). */ |
66 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; | 70 | { |
67 | if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; | 71 | const char *p; |
68 | for (p = buf; *p != '\0'; p++) | 72 | t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; |
69 | if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) | 73 | if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; |
70 | return 1; | 74 | for (p = buf; *p != '\0'; p++) |
75 | if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) | ||
76 | return 1; | ||
77 | } | ||
71 | /* Check whether a typical GB18030 multibyte sequence is recognized as a | 78 | /* Check whether a typical GB18030 multibyte sequence is recognized as a |
72 | single wide character. This excludes the GB2312 and GBK encodings. */ | 79 | single wide character. This excludes the GB2312 and GBK encodings. */ |
73 | if (mblen ("\203\062\332\066", 5) != 4) | 80 | if (mblen ("\203\062\332\066", 5) != 4) |
74 | return 1; | 81 | return 1; |
75 | return 0; | 82 | return 0; |
83 | #endif | ||
76 | } | 84 | } |
77 | changequote([,])dnl | 85 | ]])]) |
78 | ])]) | ||
79 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 86 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
80 | case "$host_os" in | 87 | case "$host_os" in |
81 | # Handle native Windows specially, because there setlocale() interprets | 88 | # Handle native Windows specially, because there setlocale() interprets |
diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4 index 8bd12e8..a33a0a4 100644 --- a/gl/m4/locale_h.m4 +++ b/gl/m4/locale_h.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | # locale_h.m4 serial 19 | 1 | # locale_h.m4 serial 28 |
2 | dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_LOCALE_H], | 7 | AC_DEFUN_ONCE([gl_LOCALE_H], |
8 | [ | 8 | [ |
9 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | 9 | dnl Ensure to expand the default settings once only, before all statements |
10 | dnl once only, before all statements that occur in other macros. | 10 | dnl that occur in other macros. |
11 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) |
12 | 12 | ||
13 | dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_* | 13 | dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_* |
@@ -17,7 +17,9 @@ AC_DEFUN([gl_LOCALE_H], | |||
17 | dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. | 17 | dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. |
18 | AC_REQUIRE([gl_STDDEF_H]) | 18 | AC_REQUIRE([gl_STDDEF_H]) |
19 | 19 | ||
20 | dnl Solaris 11 2011-11 defines the int_p_*, int_n_* members of 'struct lconv' | 20 | AC_REQUIRE([gl_LOCALE_T]) |
21 | |||
22 | dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' | ||
21 | dnl only if _LCONV_C99 is defined. | 23 | dnl only if _LCONV_C99 is defined. |
22 | AC_REQUIRE([AC_CANONICAL_HOST]) | 24 | AC_REQUIRE([AC_CANONICAL_HOST]) |
23 | case "$host_os" in | 25 | case "$host_os" in |
@@ -37,34 +39,6 @@ AC_DEFUN([gl_LOCALE_H], | |||
37 | [gl_cv_header_locale_h_posix2001=yes], | 39 | [gl_cv_header_locale_h_posix2001=yes], |
38 | [gl_cv_header_locale_h_posix2001=no])]) | 40 | [gl_cv_header_locale_h_posix2001=no])]) |
39 | 41 | ||
40 | dnl Check for <xlocale.h>. | ||
41 | AC_CHECK_HEADERS_ONCE([xlocale.h]) | ||
42 | if test $ac_cv_header_xlocale_h = yes; then | ||
43 | HAVE_XLOCALE_H=1 | ||
44 | dnl Check whether use of locale_t requires inclusion of <xlocale.h>, | ||
45 | dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by | ||
46 | dnl itself, we assume that <xlocale.h> will do so. | ||
47 | AC_CACHE_CHECK([whether locale.h defines locale_t], | ||
48 | [gl_cv_header_locale_has_locale_t], | ||
49 | [AC_COMPILE_IFELSE( | ||
50 | [AC_LANG_PROGRAM( | ||
51 | [[#include <locale.h> | ||
52 | locale_t x;]], | ||
53 | [[]])], | ||
54 | [gl_cv_header_locale_has_locale_t=yes], | ||
55 | [gl_cv_header_locale_has_locale_t=no]) | ||
56 | ]) | ||
57 | if test $gl_cv_header_locale_has_locale_t = yes; then | ||
58 | gl_cv_header_locale_h_needs_xlocale_h=no | ||
59 | else | ||
60 | gl_cv_header_locale_h_needs_xlocale_h=yes | ||
61 | fi | ||
62 | else | ||
63 | HAVE_XLOCALE_H=0 | ||
64 | gl_cv_header_locale_h_needs_xlocale_h=no | ||
65 | fi | ||
66 | AC_SUBST([HAVE_XLOCALE_H]) | ||
67 | |||
68 | dnl Check whether 'struct lconv' is complete. | 42 | dnl Check whether 'struct lconv' is complete. |
69 | dnl Bionic libc's 'struct lconv' is just a dummy. | 43 | dnl Bionic libc's 'struct lconv' is just a dummy. |
70 | dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, | 44 | dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, |
@@ -82,7 +56,20 @@ AC_DEFUN([gl_LOCALE_H], | |||
82 | [gl_cv_sys_struct_lconv_ok=no]) | 56 | [gl_cv_sys_struct_lconv_ok=no]) |
83 | ]) | 57 | ]) |
84 | if test $gl_cv_sys_struct_lconv_ok = no; then | 58 | if test $gl_cv_sys_struct_lconv_ok = no; then |
85 | REPLACE_STRUCT_LCONV=1 | 59 | dnl On native Windows with MSVC, merely define these member names as macros. |
60 | dnl This avoids trouble in C++ mode. | ||
61 | case "$host_os" in | ||
62 | mingw*) | ||
63 | AC_EGREP_CPP([Special], [ | ||
64 | #ifdef _MSC_VER | ||
65 | Special | ||
66 | #endif | ||
67 | ], | ||
68 | [], | ||
69 | [REPLACE_STRUCT_LCONV=1]) | ||
70 | ;; | ||
71 | *) REPLACE_STRUCT_LCONV=1 ;; | ||
72 | esac | ||
86 | fi | 73 | fi |
87 | 74 | ||
88 | dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. | 75 | dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. |
@@ -96,27 +83,92 @@ AC_DEFUN([gl_LOCALE_H], | |||
96 | # include <xlocale.h> | 83 | # include <xlocale.h> |
97 | #endif | 84 | #endif |
98 | ]], | 85 | ]], |
99 | [setlocale duplocale]) | 86 | [setlocale newlocale duplocale freelocale]) |
87 | ]) | ||
88 | |||
89 | dnl Checks to determine whether the system has the locale_t type, | ||
90 | dnl and how to obtain it. | ||
91 | AC_DEFUN([gl_LOCALE_T], | ||
92 | [ | ||
93 | dnl Persuade glibc and Solaris <locale.h> to define locale_t. | ||
94 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
95 | |||
96 | dnl Check whether use of locale_t requires inclusion of <xlocale.h>, | ||
97 | dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by | ||
98 | dnl itself, we assume that <xlocale.h> will do so. | ||
99 | AC_CACHE_CHECK([whether locale.h defines locale_t], | ||
100 | [gl_cv_header_locale_has_locale_t], | ||
101 | [AC_COMPILE_IFELSE( | ||
102 | [AC_LANG_PROGRAM( | ||
103 | [[#include <locale.h> | ||
104 | locale_t x;]], | ||
105 | [[]])], | ||
106 | [gl_cv_header_locale_has_locale_t=yes], | ||
107 | [gl_cv_header_locale_has_locale_t=no]) | ||
108 | ]) | ||
109 | |||
110 | dnl Check for <xlocale.h>. | ||
111 | AC_CHECK_HEADERS_ONCE([xlocale.h]) | ||
112 | if test $ac_cv_header_xlocale_h = yes; then | ||
113 | HAVE_XLOCALE_H=1 | ||
114 | if test $gl_cv_header_locale_has_locale_t = yes; then | ||
115 | gl_cv_header_locale_h_needs_xlocale_h=no | ||
116 | else | ||
117 | gl_cv_header_locale_h_needs_xlocale_h=yes | ||
118 | fi | ||
119 | HAVE_LOCALE_T=1 | ||
120 | else | ||
121 | HAVE_XLOCALE_H=0 | ||
122 | gl_cv_header_locale_h_needs_xlocale_h=no | ||
123 | if test $gl_cv_header_locale_has_locale_t = yes; then | ||
124 | HAVE_LOCALE_T=1 | ||
125 | else | ||
126 | HAVE_LOCALE_T=0 | ||
127 | fi | ||
128 | fi | ||
129 | AC_SUBST([HAVE_XLOCALE_H]) | ||
100 | ]) | 130 | ]) |
101 | 131 | ||
132 | # gl_LOCALE_MODULE_INDICATOR([modulename]) | ||
133 | # sets the shell variable that indicates the presence of the given module | ||
134 | # to a C preprocessor expression that will evaluate to 1. | ||
135 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
102 | AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], | 136 | AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], |
103 | [ | 137 | [ |
104 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 138 | dnl Ensure to expand the default settings once only. |
105 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | 139 | gl_LOCALE_H_REQUIRE_DEFAULTS |
106 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 140 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
107 | dnl Define it also as a C macro, for the benefit of the unit tests. | 141 | dnl Define it also as a C macro, for the benefit of the unit tests. |
108 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 142 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
109 | ]) | 143 | ]) |
110 | 144 | ||
145 | # Initializes the default values for AC_SUBSTed shell variables. | ||
146 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
147 | # outside of macros or in macros that are not AC_REQUIREd. | ||
148 | AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], | ||
149 | [ | ||
150 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS], [ | ||
151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) | ||
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) | ||
153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) | ||
154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) | ||
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME]) | ||
156 | ]) | ||
157 | m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) | ||
158 | AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) | ||
159 | ]) | ||
160 | |||
111 | AC_DEFUN([gl_LOCALE_H_DEFAULTS], | 161 | AC_DEFUN([gl_LOCALE_H_DEFAULTS], |
112 | [ | 162 | [ |
113 | GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV]) | ||
114 | GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE]) | ||
115 | GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) | ||
116 | dnl Assume proper GNU behavior unless another module says otherwise. | 163 | dnl Assume proper GNU behavior unless another module says otherwise. |
164 | HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) | ||
117 | HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) | 165 | HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) |
166 | HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) | ||
118 | REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) | 167 | REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) |
119 | REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) | 168 | REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) |
169 | REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) | ||
120 | REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) | 170 | REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) |
171 | REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) | ||
121 | REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) | 172 | REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) |
173 | LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) | ||
122 | ]) | 174 | ]) |
diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4 index b8bb596..ae225fe 100644 --- a/gl/m4/localeconv.m4 +++ b/gl/m4/localeconv.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # localeconv.m4 serial 1 | 1 | # localeconv.m4 serial 1 |
2 | dnl Copyright (C) 2012-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index aae1701..88cf557 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # lock.m4 serial 13 (gettext-0.18.2) | 1 | # lock.m4 serial 14 |
2 | dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,11 +12,16 @@ AC_DEFUN([gl_LOCK], | |||
12 | if test "$gl_threads_api" = posix; then | 12 | if test "$gl_threads_api" = posix; then |
13 | # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the | 13 | # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the |
14 | # pthread_rwlock_* functions. | 14 | # pthread_rwlock_* functions. |
15 | has_rwlock=false | ||
15 | AC_CHECK_TYPE([pthread_rwlock_t], | 16 | AC_CHECK_TYPE([pthread_rwlock_t], |
16 | [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], | 17 | [has_rwlock=true |
18 | AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], | ||
17 | [Define if the POSIX multithreading library has read/write locks.])], | 19 | [Define if the POSIX multithreading library has read/write locks.])], |
18 | [], | 20 | [], |
19 | [#include <pthread.h>]) | 21 | [#include <pthread.h>]) |
22 | if $has_rwlock; then | ||
23 | gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER | ||
24 | fi | ||
20 | # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. | 25 | # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. |
21 | AC_COMPILE_IFELSE([ | 26 | AC_COMPILE_IFELSE([ |
22 | AC_LANG_PROGRAM( | 27 | AC_LANG_PROGRAM( |
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4 deleted file mode 100644 index 3af6ab5..0000000 --- a/gl/m4/longlong.m4 +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | # longlong.m4 serial 17 | ||
2 | dnl Copyright (C) 1999-2007, 2009-2013 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 Paul Eggert. | ||
8 | |||
9 | # Define HAVE_LONG_LONG_INT if 'long long int' works. | ||
10 | # This fixes a bug in Autoconf 2.61, and can be faster | ||
11 | # than what's in Autoconf 2.62 through 2.68. | ||
12 | |||
13 | # Note: If the type 'long long int' exists but is only 32 bits large | ||
14 | # (as on some very old compilers), HAVE_LONG_LONG_INT will not be | ||
15 | # defined. In this case you can treat 'long long int' like 'long int'. | ||
16 | |||
17 | AC_DEFUN([AC_TYPE_LONG_LONG_INT], | ||
18 | [ | ||
19 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | ||
20 | AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], | ||
21 | [ac_cv_type_long_long_int=yes | ||
22 | if test "x${ac_cv_prog_cc_c99-no}" = xno; then | ||
23 | ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int | ||
24 | if test $ac_cv_type_long_long_int = yes; then | ||
25 | dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. | ||
26 | dnl If cross compiling, assume the bug is not important, since | ||
27 | dnl nobody cross compiles for this platform as far as we know. | ||
28 | AC_RUN_IFELSE( | ||
29 | [AC_LANG_PROGRAM( | ||
30 | [[@%:@include <limits.h> | ||
31 | @%:@ifndef LLONG_MAX | ||
32 | @%:@ define HALF \ | ||
33 | (1LL << (sizeof (long long int) * CHAR_BIT - 2)) | ||
34 | @%:@ define LLONG_MAX (HALF - 1 + HALF) | ||
35 | @%:@endif]], | ||
36 | [[long long int n = 1; | ||
37 | int i; | ||
38 | for (i = 0; ; i++) | ||
39 | { | ||
40 | long long int m = n << i; | ||
41 | if (m >> i != n) | ||
42 | return 1; | ||
43 | if (LLONG_MAX / 2 < m) | ||
44 | break; | ||
45 | } | ||
46 | return 0;]])], | ||
47 | [], | ||
48 | [ac_cv_type_long_long_int=no], | ||
49 | [:]) | ||
50 | fi | ||
51 | fi]) | ||
52 | if test $ac_cv_type_long_long_int = yes; then | ||
53 | AC_DEFINE([HAVE_LONG_LONG_INT], [1], | ||
54 | [Define to 1 if the system has the type 'long long int'.]) | ||
55 | fi | ||
56 | ]) | ||
57 | |||
58 | # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. | ||
59 | # This fixes a bug in Autoconf 2.61, and can be faster | ||
60 | # than what's in Autoconf 2.62 through 2.68. | ||
61 | |||
62 | # Note: If the type 'unsigned long long int' exists but is only 32 bits | ||
63 | # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT | ||
64 | # will not be defined. In this case you can treat 'unsigned long long int' | ||
65 | # like 'unsigned long int'. | ||
66 | |||
67 | AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], | ||
68 | [ | ||
69 | AC_CACHE_CHECK([for unsigned long long int], | ||
70 | [ac_cv_type_unsigned_long_long_int], | ||
71 | [ac_cv_type_unsigned_long_long_int=yes | ||
72 | if test "x${ac_cv_prog_cc_c99-no}" = xno; then | ||
73 | AC_LINK_IFELSE( | ||
74 | [_AC_TYPE_LONG_LONG_SNIPPET], | ||
75 | [], | ||
76 | [ac_cv_type_unsigned_long_long_int=no]) | ||
77 | fi]) | ||
78 | if test $ac_cv_type_unsigned_long_long_int = yes; then | ||
79 | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], | ||
80 | [Define to 1 if the system has the type 'unsigned long long int'.]) | ||
81 | fi | ||
82 | ]) | ||
83 | |||
84 | # Expands to a C program that can be used to test for simultaneous support | ||
85 | # of 'long long' and 'unsigned long long'. We don't want to say that | ||
86 | # 'long long' is available if 'unsigned long long' is not, or vice versa, | ||
87 | # because too many programs rely on the symmetry between signed and unsigned | ||
88 | # integer types (excluding 'bool'). | ||
89 | AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], | ||
90 | [ | ||
91 | AC_LANG_PROGRAM( | ||
92 | [[/* For now, do not test the preprocessor; as of 2007 there are too many | ||
93 | implementations with broken preprocessors. Perhaps this can | ||
94 | be revisited in 2012. In the meantime, code should not expect | ||
95 | #if to work with literals wider than 32 bits. */ | ||
96 | /* Test literals. */ | ||
97 | long long int ll = 9223372036854775807ll; | ||
98 | long long int nll = -9223372036854775807LL; | ||
99 | unsigned long long int ull = 18446744073709551615ULL; | ||
100 | /* Test constant expressions. */ | ||
101 | typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) | ||
102 | ? 1 : -1)]; | ||
103 | typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 | ||
104 | ? 1 : -1)]; | ||
105 | int i = 63;]], | ||
106 | [[/* Test availability of runtime routines for shift and division. */ | ||
107 | long long int llmax = 9223372036854775807ll; | ||
108 | unsigned long long int ullmax = 18446744073709551615ull; | ||
109 | return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | ||
110 | | (llmax / ll) | (llmax % ll) | ||
111 | | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) | ||
112 | | (ullmax / ull) | (ullmax % ull));]]) | ||
113 | ]) | ||
diff --git a/gl/m4/ls-mntd-fs.m4 b/gl/m4/ls-mntd-fs.m4 deleted file mode 100644 index fb116c8..0000000 --- a/gl/m4/ls-mntd-fs.m4 +++ /dev/null | |||
@@ -1,357 +0,0 @@ | |||
1 | # serial 30 | ||
2 | # How to list mounted file systems. | ||
3 | |||
4 | # Copyright (C) 1998-2004, 2006, 2009-2013 Free Software Foundation, Inc. | ||
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 | |||
10 | dnl From Jim Meyering. | ||
11 | dnl | ||
12 | dnl This is not pretty. I've just taken the autoconf code and wrapped | ||
13 | dnl it in an AC_DEFUN and made some other fixes. | ||
14 | dnl | ||
15 | |||
16 | # Replace Autoconf's AC_FUNC_GETMNTENT to work around a bug in Autoconf | ||
17 | # through Autoconf 2.59. We can remove this once we assume Autoconf 2.60 | ||
18 | # or later. | ||
19 | AC_DEFUN([AC_FUNC_GETMNTENT], | ||
20 | [# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, | ||
21 | # -lseq on Dynix/PTX, -lgen on Unixware. | ||
22 | AC_SEARCH_LIBS([getmntent], [sun seq gen]) | ||
23 | AC_CHECK_FUNCS([getmntent]) | ||
24 | ]) | ||
25 | |||
26 | # gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | ||
27 | AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS], | ||
28 | [ | ||
29 | AC_CHECK_FUNCS([listmntent getmntinfo]) | ||
30 | AC_CHECK_HEADERS_ONCE([sys/param.h sys/statvfs.h]) | ||
31 | |||
32 | # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses | ||
33 | # NGROUPS (as the array dimension for a struct member) without a definition. | ||
34 | AC_CHECK_HEADERS([sys/ucred.h], [], [], [#include <grp.h>]) | ||
35 | |||
36 | AC_CHECK_HEADERS([sys/mount.h], [], [], | ||
37 | [AC_INCLUDES_DEFAULT | ||
38 | [#if HAVE_SYS_PARAM_H | ||
39 | #include <sys/param.h> | ||
40 | #endif]]) | ||
41 | |||
42 | AC_CHECK_HEADERS([mntent.h sys/fs_types.h]) | ||
43 | getfsstat_includes="\ | ||
44 | $ac_includes_default | ||
45 | #if HAVE_SYS_PARAM_H | ||
46 | # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
47 | #endif | ||
48 | #if HAVE_SYS_UCRED_H | ||
49 | # include <grp.h> /* needed for definition of NGROUPS */ | ||
50 | # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
51 | #endif | ||
52 | #if HAVE_SYS_MOUNT_H | ||
53 | # include <sys/mount.h> | ||
54 | #endif | ||
55 | #if HAVE_SYS_FS_TYPES_H | ||
56 | # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
57 | #endif | ||
58 | " | ||
59 | AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) | ||
60 | |||
61 | # Determine how to get the list of mounted file systems. | ||
62 | ac_list_mounted_fs= | ||
63 | |||
64 | # If the getmntent function is available but not in the standard library, | ||
65 | # make sure LIBS contains the appropriate -l option. | ||
66 | AC_FUNC_GETMNTENT | ||
67 | |||
68 | # This test must precede the ones for getmntent because Unicos-9 is | ||
69 | # reported to have the getmntent function, but its support is incompatible | ||
70 | # with other getmntent implementations. | ||
71 | |||
72 | # NOTE: Normally, I wouldn't use a check for system type as I've done for | ||
73 | # 'CRAY' below since that goes against the whole autoconf philosophy. But | ||
74 | # I think there is too great a chance that some non-Cray system has a | ||
75 | # function named listmntent to risk the false positive. | ||
76 | |||
77 | if test -z "$ac_list_mounted_fs"; then | ||
78 | # Cray UNICOS 9 | ||
79 | AC_MSG_CHECKING([for listmntent of Cray/Unicos-9]) | ||
80 | AC_CACHE_VAL([fu_cv_sys_mounted_cray_listmntent], | ||
81 | [fu_cv_sys_mounted_cray_listmntent=no | ||
82 | AC_EGREP_CPP([yes], | ||
83 | [#ifdef _CRAY | ||
84 | yes | ||
85 | #endif | ||
86 | ], [test $ac_cv_func_listmntent = yes \ | ||
87 | && fu_cv_sys_mounted_cray_listmntent=yes] | ||
88 | ) | ||
89 | ] | ||
90 | ) | ||
91 | AC_MSG_RESULT([$fu_cv_sys_mounted_cray_listmntent]) | ||
92 | if test $fu_cv_sys_mounted_cray_listmntent = yes; then | ||
93 | ac_list_mounted_fs=found | ||
94 | AC_DEFINE([MOUNTED_LISTMNTENT], [1], | ||
95 | [Define if there is a function named listmntent that can be used to | ||
96 | list all mounted file systems. (UNICOS)]) | ||
97 | fi | ||
98 | fi | ||
99 | |||
100 | if test -z "$ac_list_mounted_fs"; then | ||
101 | # AIX. | ||
102 | AC_MSG_CHECKING([for mntctl function and struct vmount]) | ||
103 | AC_CACHE_VAL([fu_cv_sys_mounted_vmount], | ||
104 | [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])], | ||
105 | [fu_cv_sys_mounted_vmount=yes], | ||
106 | [fu_cv_sys_mounted_vmount=no])]) | ||
107 | AC_MSG_RESULT([$fu_cv_sys_mounted_vmount]) | ||
108 | if test $fu_cv_sys_mounted_vmount = yes; then | ||
109 | ac_list_mounted_fs=found | ||
110 | AC_DEFINE([MOUNTED_VMOUNT], [1], | ||
111 | [Define if there is a function named mntctl that can be used to read | ||
112 | the list of mounted file systems, and there is a system header file | ||
113 | that declares 'struct vmount'. (AIX)]) | ||
114 | fi | ||
115 | fi | ||
116 | |||
117 | if test $ac_cv_func_getmntent = yes; then | ||
118 | |||
119 | # This system has the getmntent function. | ||
120 | # Determine whether it's the one-argument variant or the two-argument one. | ||
121 | |||
122 | if test -z "$ac_list_mounted_fs"; then | ||
123 | # 4.3BSD, SunOS, HP-UX, Dynix, Irix | ||
124 | AC_MSG_CHECKING([for one-argument getmntent function]) | ||
125 | AC_CACHE_VAL([fu_cv_sys_mounted_getmntent1], | ||
126 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
127 | /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ | ||
128 | #include <stdio.h> | ||
129 | |||
130 | #include <mntent.h> | ||
131 | #if !defined MOUNTED | ||
132 | # if defined _PATH_MOUNTED /* GNU libc */ | ||
133 | # define MOUNTED _PATH_MOUNTED | ||
134 | # endif | ||
135 | # if defined MNT_MNTTAB /* HP-UX. */ | ||
136 | # define MOUNTED MNT_MNTTAB | ||
137 | # endif | ||
138 | # if defined MNTTABNAME /* Dynix. */ | ||
139 | # define MOUNTED MNTTABNAME | ||
140 | # endif | ||
141 | #endif | ||
142 | ]], | ||
143 | [[ struct mntent *mnt = 0; char *table = MOUNTED; | ||
144 | if (sizeof mnt && sizeof table) return 0;]])], | ||
145 | [fu_cv_sys_mounted_getmntent1=yes], | ||
146 | [fu_cv_sys_mounted_getmntent1=no])]) | ||
147 | AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1]) | ||
148 | if test $fu_cv_sys_mounted_getmntent1 = yes; then | ||
149 | ac_list_mounted_fs=found | ||
150 | AC_DEFINE([MOUNTED_GETMNTENT1], [1], | ||
151 | [Define if there is a function named getmntent for reading the list | ||
152 | of mounted file systems, and that function takes a single argument. | ||
153 | (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) | ||
154 | fi | ||
155 | fi | ||
156 | |||
157 | if test -z "$ac_list_mounted_fs"; then | ||
158 | # SVR4 | ||
159 | AC_MSG_CHECKING([for two-argument getmntent function]) | ||
160 | AC_CACHE_VAL([fu_cv_sys_mounted_getmntent2], | ||
161 | [AC_EGREP_HEADER([getmntent], [sys/mnttab.h], | ||
162 | fu_cv_sys_mounted_getmntent2=yes, | ||
163 | fu_cv_sys_mounted_getmntent2=no)]) | ||
164 | AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2]) | ||
165 | if test $fu_cv_sys_mounted_getmntent2 = yes; then | ||
166 | ac_list_mounted_fs=found | ||
167 | AC_DEFINE([MOUNTED_GETMNTENT2], [1], | ||
168 | [Define if there is a function named getmntent for reading the list of | ||
169 | mounted file systems, and that function takes two arguments. (SVR4)]) | ||
170 | AC_CHECK_FUNCS([hasmntopt]) | ||
171 | fi | ||
172 | fi | ||
173 | |||
174 | fi | ||
175 | |||
176 | if test -z "$ac_list_mounted_fs"; then | ||
177 | # DEC Alpha running OSF/1, and Apple Darwin 1.3. | ||
178 | # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h | ||
179 | |||
180 | AC_MSG_CHECKING([for getfsstat function]) | ||
181 | AC_CACHE_VAL([fu_cv_sys_mounted_getfsstat], | ||
182 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | ||
183 | #include <sys/types.h> | ||
184 | #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME | ||
185 | # define FS_TYPE(Ent) ((Ent).f_fstypename) | ||
186 | #else | ||
187 | # define FS_TYPE(Ent) mnt_names[(Ent).f_type] | ||
188 | #endif | ||
189 | $getfsstat_includes]] | ||
190 | , | ||
191 | [[struct statfs *stats; | ||
192 | int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); | ||
193 | char *t = FS_TYPE (*stats); ]])], | ||
194 | [fu_cv_sys_mounted_getfsstat=yes], | ||
195 | [fu_cv_sys_mounted_getfsstat=no])]) | ||
196 | AC_MSG_RESULT([$fu_cv_sys_mounted_getfsstat]) | ||
197 | if test $fu_cv_sys_mounted_getfsstat = yes; then | ||
198 | ac_list_mounted_fs=found | ||
199 | AC_DEFINE([MOUNTED_GETFSSTAT], [1], | ||
200 | [Define if there is a function named getfsstat for reading the | ||
201 | list of mounted file systems. (DEC Alpha running OSF/1)]) | ||
202 | fi | ||
203 | fi | ||
204 | |||
205 | if test -z "$ac_list_mounted_fs"; then | ||
206 | # SVR3 | ||
207 | AC_MSG_CHECKING([for FIXME existence of three headers]) | ||
208 | AC_CACHE_VAL([fu_cv_sys_mounted_fread_fstyp], | ||
209 | [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ | ||
210 | #include <sys/statfs.h> | ||
211 | #include <sys/fstyp.h> | ||
212 | #include <mnttab.h>]])], | ||
213 | [fu_cv_sys_mounted_fread_fstyp=yes], | ||
214 | [fu_cv_sys_mounted_fread_fstyp=no])]) | ||
215 | AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp]) | ||
216 | if test $fu_cv_sys_mounted_fread_fstyp = yes; then | ||
217 | ac_list_mounted_fs=found | ||
218 | AC_DEFINE([MOUNTED_FREAD_FSTYP], [1], | ||
219 | [Define if (like SVR2) there is no specific function for reading the | ||
220 | list of mounted file systems, and your system has these header files: | ||
221 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) | ||
222 | fi | ||
223 | fi | ||
224 | |||
225 | if test -z "$ac_list_mounted_fs"; then | ||
226 | # 4.4BSD and DEC OSF/1. | ||
227 | AC_MSG_CHECKING([for getmntinfo function]) | ||
228 | AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo], | ||
229 | [ | ||
230 | test "$ac_cv_func_getmntinfo" = yes \ | ||
231 | && fu_cv_sys_mounted_getmntinfo=yes \ | ||
232 | || fu_cv_sys_mounted_getmntinfo=no | ||
233 | ]) | ||
234 | AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo]) | ||
235 | if test $fu_cv_sys_mounted_getmntinfo = yes; then | ||
236 | AC_MSG_CHECKING([whether getmntinfo returns statvfs structures]) | ||
237 | AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo2], | ||
238 | [ | ||
239 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
240 | #if HAVE_SYS_PARAM_H | ||
241 | # include <sys/param.h> | ||
242 | #endif | ||
243 | #include <sys/types.h> | ||
244 | #if HAVE_SYS_MOUNT_H | ||
245 | # include <sys/mount.h> | ||
246 | #endif | ||
247 | #if HAVE_SYS_STATVFS_H | ||
248 | # include <sys/statvfs.h> | ||
249 | #endif | ||
250 | extern | ||
251 | #ifdef __cplusplus | ||
252 | "C" | ||
253 | #endif | ||
254 | int getmntinfo (struct statfs **, int); | ||
255 | ]], [])], | ||
256 | [fu_cv_sys_mounted_getmntinfo2=no], | ||
257 | [fu_cv_sys_mounted_getmntinfo2=yes]) | ||
258 | ]) | ||
259 | AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2]) | ||
260 | if test $fu_cv_sys_mounted_getmntinfo2 = no; then | ||
261 | ac_list_mounted_fs=found | ||
262 | AC_DEFINE([MOUNTED_GETMNTINFO], [1], | ||
263 | [Define if there is a function named getmntinfo for reading the | ||
264 | list of mounted file systems and it returns an array of | ||
265 | 'struct statfs'. (4.4BSD, Darwin)]) | ||
266 | else | ||
267 | ac_list_mounted_fs=found | ||
268 | AC_DEFINE([MOUNTED_GETMNTINFO2], [1], | ||
269 | [Define if there is a function named getmntinfo for reading the | ||
270 | list of mounted file systems and it returns an array of | ||
271 | 'struct statvfs'. (NetBSD 3.0)]) | ||
272 | fi | ||
273 | fi | ||
274 | fi | ||
275 | |||
276 | if test -z "$ac_list_mounted_fs"; then | ||
277 | # Ultrix | ||
278 | AC_MSG_CHECKING([for getmnt function]) | ||
279 | AC_CACHE_VAL([fu_cv_sys_mounted_getmnt], | ||
280 | [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ | ||
281 | #include <sys/fs_types.h> | ||
282 | #include <sys/mount.h>]])], | ||
283 | [fu_cv_sys_mounted_getmnt=yes], | ||
284 | [fu_cv_sys_mounted_getmnt=no])]) | ||
285 | AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt]) | ||
286 | if test $fu_cv_sys_mounted_getmnt = yes; then | ||
287 | ac_list_mounted_fs=found | ||
288 | AC_DEFINE([MOUNTED_GETMNT], [1], | ||
289 | [Define if there is a function named getmnt for reading the list of | ||
290 | mounted file systems. (Ultrix)]) | ||
291 | fi | ||
292 | fi | ||
293 | |||
294 | if test -z "$ac_list_mounted_fs"; then | ||
295 | # BeOS | ||
296 | AC_CHECK_FUNCS([next_dev fs_stat_dev]) | ||
297 | AC_CHECK_HEADERS([fs_info.h]) | ||
298 | AC_MSG_CHECKING([for BEOS mounted file system support functions]) | ||
299 | if test $ac_cv_header_fs_info_h = yes \ | ||
300 | && test $ac_cv_func_next_dev = yes \ | ||
301 | && test $ac_cv_func_fs_stat_dev = yes; then | ||
302 | fu_result=yes | ||
303 | else | ||
304 | fu_result=no | ||
305 | fi | ||
306 | AC_MSG_RESULT([$fu_result]) | ||
307 | if test $fu_result = yes; then | ||
308 | ac_list_mounted_fs=found | ||
309 | AC_DEFINE([MOUNTED_FS_STAT_DEV], [1], | ||
310 | [Define if there are functions named next_dev and fs_stat_dev for | ||
311 | reading the list of mounted file systems. (BeOS)]) | ||
312 | fi | ||
313 | fi | ||
314 | |||
315 | if test -z "$ac_list_mounted_fs"; then | ||
316 | # SVR2 | ||
317 | AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) | ||
318 | AC_CACHE_VAL([fu_cv_sys_mounted_fread], | ||
319 | [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <mnttab.h>]])], | ||
320 | [fu_cv_sys_mounted_fread=yes], | ||
321 | [fu_cv_sys_mounted_fread=no])]) | ||
322 | AC_MSG_RESULT([$fu_cv_sys_mounted_fread]) | ||
323 | if test $fu_cv_sys_mounted_fread = yes; then | ||
324 | ac_list_mounted_fs=found | ||
325 | AC_DEFINE([MOUNTED_FREAD], [1], | ||
326 | [Define if there is no specific function for reading the list of | ||
327 | mounted file systems. fread will be used to read /etc/mnttab. | ||
328 | (SVR2) ]) | ||
329 | fi | ||
330 | fi | ||
331 | |||
332 | if test -z "$ac_list_mounted_fs"; then | ||
333 | # Interix / BSD alike statvfs | ||
334 | # the code is really interix specific, so make sure, we're on it. | ||
335 | case "$host" in | ||
336 | *-interix*) | ||
337 | AC_CHECK_FUNCS([statvfs]) | ||
338 | if test $ac_cv_func_statvfs = yes; then | ||
339 | ac_list_mounted_fs=found | ||
340 | AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1], | ||
341 | [Define if we are on interix, and ought to use statvfs plus | ||
342 | some special knowledge on where mounted file systems can be | ||
343 | found. (Interix)]) | ||
344 | fi | ||
345 | ;; | ||
346 | esac | ||
347 | fi | ||
348 | |||
349 | if test -z "$ac_list_mounted_fs"; then | ||
350 | AC_MSG_ERROR([could not determine how to read list of mounted file systems]) | ||
351 | # FIXME -- no need to abort building the whole package | ||
352 | # Can't build mountlist.c or anything that needs its functions | ||
353 | fi | ||
354 | |||
355 | AS_IF([test $ac_list_mounted_fs = found], [$1], [$2]) | ||
356 | |||
357 | ]) | ||
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 new file mode 100644 index 0000000..fd4f1f2 --- /dev/null +++ b/gl/m4/lseek.m4 | |||
@@ -0,0 +1,78 @@ | |||
1 | # lseek.m4 serial 12 | ||
2 | dnl Copyright (C) 2007, 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_FUNC_LSEEK], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
10 | |||
11 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
12 | AC_REQUIRE([AC_PROG_CC]) | ||
13 | AC_CHECK_HEADERS_ONCE([unistd.h]) | ||
14 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], | ||
15 | [case "$host_os" in | ||
16 | mingw*) | ||
17 | dnl Native Windows. | ||
18 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or | ||
19 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) | ||
20 | dnl for a pipe depends on the environment: In a Cygwin 1.5 | ||
21 | dnl environment it succeeds (wrong); in a Cygwin 1.7 environment | ||
22 | dnl it fails with a wrong errno value. | ||
23 | gl_cv_func_lseek_pipe=no | ||
24 | ;; | ||
25 | *) | ||
26 | if test $cross_compiling = no; then | ||
27 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | ||
28 | #include <sys/types.h> /* for off_t */ | ||
29 | #include <stdio.h> /* for SEEK_CUR */ | ||
30 | #if HAVE_UNISTD_H | ||
31 | # include <unistd.h> | ||
32 | #else /* on Windows with MSVC */ | ||
33 | # include <io.h> | ||
34 | #endif | ||
35 | ]GL_MDA_DEFINES], | ||
36 | [[ | ||
37 | /* Exit with success only if stdin is seekable. */ | ||
38 | return lseek (0, (off_t)0, SEEK_CUR) < 0; | ||
39 | ]])], | ||
40 | [if test -s conftest$ac_exeext \ | ||
41 | && ./conftest$ac_exeext < conftest.$ac_ext \ | ||
42 | && test 1 = "`echo hi \ | ||
43 | | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then | ||
44 | gl_cv_func_lseek_pipe=yes | ||
45 | else | ||
46 | gl_cv_func_lseek_pipe=no | ||
47 | fi | ||
48 | ], | ||
49 | [gl_cv_func_lseek_pipe=no]) | ||
50 | else | ||
51 | AC_COMPILE_IFELSE( | ||
52 | [AC_LANG_SOURCE([[ | ||
53 | #if defined __BEOS__ | ||
54 | /* BeOS mistakenly return 0 when trying to seek on pipes. */ | ||
55 | Choke me. | ||
56 | #endif]])], | ||
57 | [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no]) | ||
58 | fi | ||
59 | ;; | ||
60 | esac | ||
61 | ]) | ||
62 | if test "$gl_cv_func_lseek_pipe" = no; then | ||
63 | REPLACE_LSEEK=1 | ||
64 | AC_DEFINE([LSEEK_PIPE_BROKEN], [1], | ||
65 | [Define to 1 if lseek does not detect pipes.]) | ||
66 | fi | ||
67 | |||
68 | AC_REQUIRE([gl_SYS_TYPES_H]) | ||
69 | if test $WINDOWS_64_BIT_OFF_T = 1; then | ||
70 | REPLACE_LSEEK=1 | ||
71 | fi | ||
72 | |||
73 | dnl macOS SEEK_DATA is incompatible with other platforms. | ||
74 | case $host_os in | ||
75 | darwin*) | ||
76 | REPLACE_LSEEK=1;; | ||
77 | esac | ||
78 | ]) | ||
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 4b24a0b..5540292 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 | |||
@@ -1,98 +1,175 @@ | |||
1 | # malloc.m4 serial 14 | 1 | # malloc.m4 serial 28 |
2 | dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | m4_version_prereq([2.70], [] ,[ | 7 | # This is adapted with modifications from upstream Autoconf here: |
8 | 8 | # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 | |
9 | # This is taken from the following Autoconf patch: | ||
10 | # http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 | ||
11 | AC_DEFUN([_AC_FUNC_MALLOC_IF], | 9 | AC_DEFUN([_AC_FUNC_MALLOC_IF], |
12 | [ | 10 | [ |
13 | AC_REQUIRE([AC_HEADER_STDC])dnl | ||
14 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | 11 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles |
15 | AC_CHECK_HEADERS([stdlib.h]) | 12 | AC_CACHE_CHECK([whether malloc (0) returns nonnull], |
16 | AC_CACHE_CHECK([for GNU libc compatible malloc], | ||
17 | [ac_cv_func_malloc_0_nonnull], | 13 | [ac_cv_func_malloc_0_nonnull], |
18 | [AC_RUN_IFELSE( | 14 | [AC_RUN_IFELSE( |
19 | [AC_LANG_PROGRAM( | 15 | [AC_LANG_PROGRAM( |
20 | [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H | 16 | [[#include <stdlib.h> |
21 | # include <stdlib.h> | ||
22 | #else | ||
23 | char *malloc (); | ||
24 | #endif | ||
25 | ]], | 17 | ]], |
26 | [[return ! malloc (0);]]) | 18 | [[void *p = malloc (0); |
19 | int result = !p; | ||
20 | free (p); | ||
21 | return result;]]) | ||
27 | ], | 22 | ], |
28 | [ac_cv_func_malloc_0_nonnull=yes], | 23 | [ac_cv_func_malloc_0_nonnull=yes], |
29 | [ac_cv_func_malloc_0_nonnull=no], | 24 | [ac_cv_func_malloc_0_nonnull=no], |
30 | [case "$host_os" in | 25 | [case "$host_os" in |
31 | # Guess yes on platforms where we know the result. | 26 | # Guess yes on platforms where we know the result. |
32 | *-gnu* | freebsd* | netbsd* | openbsd* \ | 27 | *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ |
33 | | hpux* | solaris* | cygwin* | mingw*) | 28 | | gnu* | *-musl* | midnightbsd* \ |
34 | ac_cv_func_malloc_0_nonnull=yes ;; | 29 | | hpux* | solaris* | cygwin* | mingw* | msys* ) |
35 | # If we don't know, assume the worst. | 30 | ac_cv_func_malloc_0_nonnull="guessing yes" ;; |
36 | *) ac_cv_func_malloc_0_nonnull=no ;; | 31 | # If we don't know, obey --enable-cross-guesses. |
32 | *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; | ||
37 | esac | 33 | esac |
38 | ]) | 34 | ]) |
39 | ]) | 35 | ]) |
40 | AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2]) | 36 | AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) |
41 | ])# _AC_FUNC_MALLOC_IF | 37 | ])# _AC_FUNC_MALLOC_IF |
42 | 38 | ||
43 | ]) | ||
44 | |||
45 | # gl_FUNC_MALLOC_GNU | 39 | # gl_FUNC_MALLOC_GNU |
46 | # ------------------ | 40 | # ------------------ |
47 | # Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if | 41 | # Replace malloc if it is not compatible with GNU libc. |
48 | # it is not. | ||
49 | AC_DEFUN([gl_FUNC_MALLOC_GNU], | 42 | AC_DEFUN([gl_FUNC_MALLOC_GNU], |
50 | [ | 43 | [ |
51 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 44 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
52 | dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. | 45 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) |
53 | _AC_FUNC_MALLOC_IF( | 46 | REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" |
54 | [AC_DEFINE([HAVE_MALLOC_GNU], [1], | 47 | if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then |
55 | [Define to 1 if your system has a GNU libc compatible 'malloc' | 48 | _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) |
56 | function, and to 0 otherwise.])], | 49 | fi |
57 | [AC_DEFINE([HAVE_MALLOC_GNU], [0]) | 50 | ]) |
58 | REPLACE_MALLOC=1 | 51 | |
52 | # gl_FUNC_MALLOC_PTRDIFF | ||
53 | # ---------------------- | ||
54 | # Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, | ||
55 | # and replace malloc otherwise. | ||
56 | AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], | ||
57 | [ | ||
58 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
59 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) | ||
60 | test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 | ||
61 | ]) | ||
62 | |||
63 | # Test whether malloc, realloc, calloc refuse to create objects | ||
64 | # larger than what can be expressed in ptrdiff_t. | ||
65 | # Set gl_cv_func_malloc_gnu to yes or no accordingly. | ||
66 | AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], | ||
67 | [ | ||
68 | AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], | ||
69 | [gl_cv_malloc_ptrdiff], | ||
70 | [AC_COMPILE_IFELSE( | ||
71 | [AC_LANG_PROGRAM( | ||
72 | [[#include <stdint.h> | ||
73 | ]], | ||
74 | [[/* 64-bit ptrdiff_t is so wide that no practical platform | ||
75 | can exceed it. */ | ||
76 | #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) | ||
77 | |||
78 | /* On rare machines where size_t fits in ptrdiff_t there | ||
79 | is no problem. */ | ||
80 | #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) | ||
81 | |||
82 | /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t | ||
83 | bounds even on 32-bit platforms. We don't know which | ||
84 | non-glibc systems are safe. */ | ||
85 | #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) | ||
86 | |||
87 | #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE | ||
88 | return 0; | ||
89 | #else | ||
90 | #error "malloc might not be ptrdiff_t safe" | ||
91 | syntax error | ||
92 | #endif | ||
93 | ]])], | ||
94 | [gl_cv_malloc_ptrdiff=yes], | ||
95 | [gl_cv_malloc_ptrdiff=no]) | ||
59 | ]) | 96 | ]) |
60 | ]) | 97 | ]) |
61 | 98 | ||
62 | # gl_FUNC_MALLOC_POSIX | 99 | # gl_FUNC_MALLOC_POSIX |
63 | # -------------------- | 100 | # -------------------- |
64 | # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it | 101 | # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it |
65 | # fails), and replace malloc if it is not. | 102 | # fails, and doesn't mess up with ptrdiff_t overflow), and replace |
103 | # malloc if it is not. | ||
66 | AC_DEFUN([gl_FUNC_MALLOC_POSIX], | 104 | AC_DEFUN([gl_FUNC_MALLOC_POSIX], |
67 | [ | 105 | [ |
68 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 106 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
107 | AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) | ||
69 | AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) | 108 | AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) |
70 | if test $gl_cv_func_malloc_posix = yes; then | 109 | if test "$gl_cv_func_malloc_posix" = yes; then |
71 | AC_DEFINE([HAVE_MALLOC_POSIX], [1], | 110 | AC_DEFINE([HAVE_MALLOC_POSIX], [1], |
72 | [Define if the 'malloc' function is POSIX compliant.]) | 111 | [Define if malloc, realloc, and calloc set errno on allocation failure.]) |
73 | else | 112 | else |
74 | REPLACE_MALLOC=1 | 113 | REPLACE_MALLOC_FOR_MALLOC_POSIX=1 |
75 | fi | 114 | fi |
76 | ]) | 115 | ]) |
77 | 116 | ||
78 | # Test whether malloc, realloc, calloc are POSIX compliant, | 117 | # Test whether malloc, realloc, calloc set errno to ENOMEM on failure. |
79 | # Set gl_cv_func_malloc_posix to yes or no accordingly. | 118 | # Set gl_cv_func_malloc_posix to yes or no accordingly. |
80 | AC_DEFUN([gl_CHECK_MALLOC_POSIX], | 119 | AC_DEFUN([gl_CHECK_MALLOC_POSIX], |
81 | [ | 120 | [ |
82 | AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], | 121 | AC_REQUIRE([AC_CANONICAL_HOST]) |
122 | AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], | ||
83 | [gl_cv_func_malloc_posix], | 123 | [gl_cv_func_malloc_posix], |
84 | [ | 124 | [ |
85 | dnl It is too dangerous to try to allocate a large amount of memory: | 125 | dnl It is too dangerous to try to allocate a large amount of memory: |
86 | dnl some systems go to their knees when you do that. So assume that | 126 | dnl some systems go to their knees when you do that. So assume that |
87 | dnl all Unix implementations of the function are POSIX compliant. | 127 | dnl all Unix implementations of the function set errno on failure, |
88 | AC_COMPILE_IFELSE( | 128 | dnl except on those platforms where we have seen 'test-malloc-gnu', |
89 | [AC_LANG_PROGRAM( | 129 | dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. |
90 | [[]], | 130 | case "$host_os" in |
91 | [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 131 | mingw*) |
92 | choke me | 132 | gl_cv_func_malloc_posix=no ;; |
93 | #endif | 133 | irix* | solaris*) |
94 | ]])], | 134 | dnl On IRIX 6.5, the three functions return NULL with errno unset |
95 | [gl_cv_func_malloc_posix=yes], | 135 | dnl when the argument is larger than PTRDIFF_MAX. |
96 | [gl_cv_func_malloc_posix=no]) | 136 | dnl On Solaris 11.3, the three functions return NULL with errno set |
137 | dnl to EAGAIN, not ENOMEM, when the argument is larger than | ||
138 | dnl PTRDIFF_MAX. | ||
139 | dnl Here is a test program: | ||
140 | m4_divert_push([KILL]) | ||
141 | #include <errno.h> | ||
142 | #include <stdio.h> | ||
143 | #include <stdlib.h> | ||
144 | #define ptrdiff_t long | ||
145 | #ifndef PTRDIFF_MAX | ||
146 | # define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1)) | ||
147 | #endif | ||
148 | |||
149 | int main () | ||
150 | { | ||
151 | void *p; | ||
152 | |||
153 | fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX); | ||
154 | |||
155 | errno = 0; | ||
156 | p = malloc ((unsigned long) PTRDIFF_MAX + 1); | ||
157 | fprintf (stderr, "p=%p errno=%d\n", p, errno); | ||
158 | |||
159 | errno = 0; | ||
160 | p = calloc (PTRDIFF_MAX / 2 + 1, 2); | ||
161 | fprintf (stderr, "p=%p errno=%d\n", p, errno); | ||
162 | |||
163 | errno = 0; | ||
164 | p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); | ||
165 | fprintf (stderr, "p=%p errno=%d\n", p, errno); | ||
166 | |||
167 | return 0; | ||
168 | } | ||
169 | m4_divert_pop([KILL]) | ||
170 | gl_cv_func_malloc_posix=no ;; | ||
171 | *) | ||
172 | gl_cv_func_malloc_posix=yes ;; | ||
173 | esac | ||
97 | ]) | 174 | ]) |
98 | ]) | 175 | ]) |
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4 index 791ce10..1d777eb 100644 --- a/gl/m4/malloca.m4 +++ b/gl/m4/malloca.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # malloca.m4 serial 1 | 1 | # malloca.m4 serial 2 |
2 | dnl Copyright (C) 2003-2004, 2006-2007, 2009-2013 Free Software Foundation, | 2 | dnl Copyright (C) 2003-2004, 2006-2007, 2009-2023 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl 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, |
@@ -11,5 +11,4 @@ AC_DEFUN([gl_MALLOCA], | |||
11 | dnl @ALLOCA@ and @LTALLOCA@. | 11 | dnl @ALLOCA@ and @LTALLOCA@. |
12 | dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. | 12 | dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. |
13 | AC_REQUIRE([gl_EEMALLOC]) | 13 | AC_REQUIRE([gl_EEMALLOC]) |
14 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | ||
15 | ]) | 14 | ]) |
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4 index bf0845f..d2e90ff 100644 --- a/gl/m4/math_h.m4 +++ b/gl/m4/math_h.m4 | |||
@@ -1,16 +1,16 @@ | |||
1 | # math_h.m4 serial 114 | 1 | # math_h.m4 serial 125 |
2 | dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_MATH_H], | 7 | AC_DEFUN_ONCE([gl_MATH_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) |
10 | gl_CHECK_NEXT_HEADERS([math.h]) | 10 | gl_CHECK_NEXT_HEADERS([math.h]) |
11 | 11 | ||
12 | AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], | 12 | AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], |
13 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], | 13 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], |
14 | [[/* Solaris 10 has a broken definition of NAN. Other platforms | 14 | [[/* Solaris 10 has a broken definition of NAN. Other platforms |
15 | fail to provide NAN, or provide it only in C99 mode; this | 15 | fail to provide NAN, or provide it only in C99 mode; this |
16 | test only needs to fail when NAN is provided but wrong. */ | 16 | test only needs to fail when NAN is provided but wrong. */ |
@@ -25,7 +25,7 @@ AC_DEFUN([gl_MATH_H], | |||
25 | REPLACE_NAN=1 | 25 | REPLACE_NAN=1 |
26 | fi | 26 | fi |
27 | AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], | 27 | AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], |
28 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], | 28 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], |
29 | [[/* Solaris 10 has a broken definition of HUGE_VAL. */ | 29 | [[/* Solaris 10 has a broken definition of HUGE_VAL. */ |
30 | double d = HUGE_VAL; | 30 | double d = HUGE_VAL; |
31 | return d == 0;]])], | 31 | return d == 0;]])], |
@@ -53,272 +53,310 @@ AC_DEFUN([gl_MATH_H], | |||
53 | tanf tanl tanhf trunc truncf truncl]) | 53 | tanf tanl tanhf trunc truncf truncl]) |
54 | ]) | 54 | ]) |
55 | 55 | ||
56 | # gl_MATH_MODULE_INDICATOR([modulename]) | ||
57 | # sets the shell variable that indicates the presence of the given module | ||
58 | # to a C preprocessor expression that will evaluate to 1. | ||
59 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
56 | AC_DEFUN([gl_MATH_MODULE_INDICATOR], | 60 | AC_DEFUN([gl_MATH_MODULE_INDICATOR], |
57 | [ | 61 | [ |
58 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 62 | dnl Ensure to expand the default settings once only. |
59 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | 63 | gl_MATH_H_REQUIRE_DEFAULTS |
60 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 64 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
61 | dnl Define it also as a C macro, for the benefit of the unit tests. | 65 | dnl Define it also as a C macro, for the benefit of the unit tests. |
62 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 66 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
63 | ]) | 67 | ]) |
64 | 68 | ||
69 | # Initializes the default values for AC_SUBSTed shell variables. | ||
70 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
71 | # outside of macros or in macros that are not AC_REQUIREd. | ||
72 | AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], | ||
73 | [ | ||
74 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS], [ | ||
75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSF]) | ||
76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSL]) | ||
77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINF]) | ||
78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINL]) | ||
79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANF]) | ||
80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANL]) | ||
81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATAN2F]) | ||
82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRT]) | ||
83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTF]) | ||
84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTL]) | ||
85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEIL]) | ||
86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILF]) | ||
87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILL]) | ||
88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGN]) | ||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNF]) | ||
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNL]) | ||
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSF]) | ||
92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSL]) | ||
93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSHF]) | ||
94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPF]) | ||
95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPL]) | ||
96 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2]) | ||
97 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2F]) | ||
98 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2L]) | ||
99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1]) | ||
100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1F]) | ||
101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1L]) | ||
102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSF]) | ||
103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSL]) | ||
104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOOR]) | ||
105 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORF]) | ||
106 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORL]) | ||
107 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMA]) | ||
108 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAF]) | ||
109 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAL]) | ||
110 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMOD]) | ||
111 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODF]) | ||
112 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODL]) | ||
113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF]) | ||
114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP]) | ||
115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL]) | ||
116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) | ||
117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) | ||
118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) | ||
119 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGB]) | ||
120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF]) | ||
121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL]) | ||
122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE]) | ||
123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF]) | ||
124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN]) | ||
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) | ||
126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) | ||
127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) | ||
128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) | ||
129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) | ||
130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) | ||
131 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGF]) | ||
132 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGL]) | ||
133 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10]) | ||
134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10F]) | ||
135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10L]) | ||
136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1P]) | ||
137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PF]) | ||
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PL]) | ||
139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2]) | ||
140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2F]) | ||
141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2L]) | ||
142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) | ||
143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) | ||
144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) | ||
145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) | ||
146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) | ||
147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) | ||
148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POWF]) | ||
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDER]) | ||
150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERF]) | ||
151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERL]) | ||
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINT]) | ||
153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTF]) | ||
154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTL]) | ||
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND]) | ||
156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF]) | ||
157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL]) | ||
158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) | ||
159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) | ||
160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) | ||
161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF]) | ||
162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTF]) | ||
163 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTL]) | ||
164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF]) | ||
165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL]) | ||
166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF]) | ||
167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) | ||
168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) | ||
169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) | ||
170 | dnl Support Microsoft deprecated alias function names by default. | ||
171 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J0], [1]) | ||
172 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J1], [1]) | ||
173 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_JN], [1]) | ||
174 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y0], [1]) | ||
175 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y1], [1]) | ||
176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_YN], [1]) | ||
177 | ]) | ||
178 | m4_require(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS]) | ||
179 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
180 | ]) | ||
181 | |||
65 | AC_DEFUN([gl_MATH_H_DEFAULTS], | 182 | AC_DEFUN([gl_MATH_H_DEFAULTS], |
66 | [ | 183 | [ |
67 | GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF]) | ||
68 | GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) | ||
69 | GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF]) | ||
70 | GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) | ||
71 | GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF]) | ||
72 | GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) | ||
73 | GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F]) | ||
74 | GNULIB_CBRT=0; AC_SUBST([GNULIB_CBRT]) | ||
75 | GNULIB_CBRTF=0; AC_SUBST([GNULIB_CBRTF]) | ||
76 | GNULIB_CBRTL=0; AC_SUBST([GNULIB_CBRTL]) | ||
77 | GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL]) | ||
78 | GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) | ||
79 | GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) | ||
80 | GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN]) | ||
81 | GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF]) | ||
82 | GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL]) | ||
83 | GNULIB_COSF=0; AC_SUBST([GNULIB_COSF]) | ||
84 | GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) | ||
85 | GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF]) | ||
86 | GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF]) | ||
87 | GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) | ||
88 | GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2]) | ||
89 | GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F]) | ||
90 | GNULIB_EXP2L=0; AC_SUBST([GNULIB_EXP2L]) | ||
91 | GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1]) | ||
92 | GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F]) | ||
93 | GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L]) | ||
94 | GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF]) | ||
95 | GNULIB_FABSL=0; AC_SUBST([GNULIB_FABSL]) | ||
96 | GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR]) | ||
97 | GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) | ||
98 | GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) | ||
99 | GNULIB_FMA=0; AC_SUBST([GNULIB_FMA]) | ||
100 | GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF]) | ||
101 | GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL]) | ||
102 | GNULIB_FMOD=0; AC_SUBST([GNULIB_FMOD]) | ||
103 | GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF]) | ||
104 | GNULIB_FMODL=0; AC_SUBST([GNULIB_FMODL]) | ||
105 | GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF]) | ||
106 | GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) | ||
107 | GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) | ||
108 | GNULIB_HYPOT=0; AC_SUBST([GNULIB_HYPOT]) | ||
109 | GNULIB_HYPOTF=0; AC_SUBST([GNULIB_HYPOTF]) | ||
110 | GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL]) | ||
111 | GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB]) | ||
112 | GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF]) | ||
113 | GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL]) | ||
114 | GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE]) | ||
115 | GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF]) | ||
116 | GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN]) | ||
117 | GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF]) | ||
118 | GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) | ||
119 | GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) | ||
120 | GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF]) | ||
121 | GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) | ||
122 | GNULIB_LOG=0; AC_SUBST([GNULIB_LOG]) | ||
123 | GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF]) | ||
124 | GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) | ||
125 | GNULIB_LOG10=0; AC_SUBST([GNULIB_LOG10]) | ||
126 | GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F]) | ||
127 | GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L]) | ||
128 | GNULIB_LOG1P=0; AC_SUBST([GNULIB_LOG1P]) | ||
129 | GNULIB_LOG1PF=0; AC_SUBST([GNULIB_LOG1PF]) | ||
130 | GNULIB_LOG1PL=0; AC_SUBST([GNULIB_LOG1PL]) | ||
131 | GNULIB_LOG2=0; AC_SUBST([GNULIB_LOG2]) | ||
132 | GNULIB_LOG2F=0; AC_SUBST([GNULIB_LOG2F]) | ||
133 | GNULIB_LOG2L=0; AC_SUBST([GNULIB_LOG2L]) | ||
134 | GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) | ||
135 | GNULIB_LOGBF=0; AC_SUBST([GNULIB_LOGBF]) | ||
136 | GNULIB_LOGBL=0; AC_SUBST([GNULIB_LOGBL]) | ||
137 | GNULIB_MODF=0; AC_SUBST([GNULIB_MODF]) | ||
138 | GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF]) | ||
139 | GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL]) | ||
140 | GNULIB_POWF=0; AC_SUBST([GNULIB_POWF]) | ||
141 | GNULIB_REMAINDER=0; AC_SUBST([GNULIB_REMAINDER]) | ||
142 | GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF]) | ||
143 | GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL]) | ||
144 | GNULIB_RINT=0; AC_SUBST([GNULIB_RINT]) | ||
145 | GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF]) | ||
146 | GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL]) | ||
147 | GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) | ||
148 | GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) | ||
149 | GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) | ||
150 | GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) | ||
151 | GNULIB_SINF=0; AC_SUBST([GNULIB_SINF]) | ||
152 | GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) | ||
153 | GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF]) | ||
154 | GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF]) | ||
155 | GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) | ||
156 | GNULIB_TANF=0; AC_SUBST([GNULIB_TANF]) | ||
157 | GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) | ||
158 | GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF]) | ||
159 | GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) | ||
160 | GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) | ||
161 | GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) | ||
162 | dnl Assume proper GNU behavior unless another module says otherwise. | 184 | dnl Assume proper GNU behavior unless another module says otherwise. |
163 | HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) | 185 | HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) |
164 | HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) | 186 | HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) |
165 | HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) | 187 | HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) |
166 | HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) | 188 | HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) |
167 | HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) | 189 | HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) |
168 | HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) | 190 | HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) |
169 | HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) | 191 | HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) |
170 | HAVE_CBRT=1; AC_SUBST([HAVE_CBRT]) | 192 | HAVE_CBRT=1; AC_SUBST([HAVE_CBRT]) |
171 | HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) | 193 | HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) |
172 | HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) | 194 | HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) |
173 | HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) | 195 | HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) |
174 | HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) | 196 | HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) |
175 | HAVE_COSF=1; AC_SUBST([HAVE_COSF]) | 197 | HAVE_COSF=1; AC_SUBST([HAVE_COSF]) |
176 | HAVE_COSL=1; AC_SUBST([HAVE_COSL]) | 198 | HAVE_COSL=1; AC_SUBST([HAVE_COSL]) |
177 | HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) | 199 | HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) |
178 | HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) | 200 | HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) |
179 | HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) | 201 | HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) |
180 | HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) | 202 | HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) |
181 | HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) | 203 | HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) |
182 | HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) | 204 | HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) |
183 | HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) | 205 | HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) |
184 | HAVE_FMA=1; AC_SUBST([HAVE_FMA]) | 206 | HAVE_FMA=1; AC_SUBST([HAVE_FMA]) |
185 | HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) | 207 | HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) |
186 | HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) | 208 | HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) |
187 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) | 209 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) |
188 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) | 210 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) |
189 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) | 211 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) |
190 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) | 212 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) |
191 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) | 213 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) |
192 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) | 214 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) |
193 | HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF]) | 215 | HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF]) |
194 | HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL]) | 216 | HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL]) |
195 | HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) | 217 | HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) |
196 | HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) | 218 | HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) |
197 | HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) | 219 | HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) |
198 | HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) | 220 | HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) |
199 | HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) | 221 | HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) |
200 | HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) | 222 | HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) |
201 | HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) | 223 | HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) |
202 | HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L]) | 224 | HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L]) |
203 | HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) | 225 | HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) |
204 | HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) | 226 | HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) |
205 | HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) | 227 | HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) |
206 | HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) | 228 | HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) |
207 | HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) | 229 | HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) |
208 | HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) | 230 | HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) |
209 | HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) | 231 | HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) |
210 | HAVE_POWF=1; AC_SUBST([HAVE_POWF]) | 232 | HAVE_POWF=1; AC_SUBST([HAVE_POWF]) |
211 | HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) | 233 | HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) |
212 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) | 234 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) |
213 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) | 235 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) |
214 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) | 236 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) |
215 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) | 237 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) |
216 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) | 238 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) |
217 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) | 239 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) |
218 | HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) | 240 | HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) |
219 | HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) | 241 | HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) |
220 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) | 242 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) |
221 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) | 243 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) |
222 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) | 244 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) |
223 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) | 245 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) |
224 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) | 246 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) |
225 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) | 247 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) |
226 | HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF]) | 248 | HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF]) |
227 | HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL]) | 249 | HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL]) |
228 | HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) | 250 | HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) |
229 | HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) | 251 | HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) |
230 | HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF]) | 252 | HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF]) |
231 | HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) | 253 | HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) |
232 | HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) | 254 | HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) |
233 | HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2]) | 255 | HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2]) |
234 | HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F]) | 256 | HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F]) |
235 | HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L]) | 257 | HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L]) |
236 | HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L]) | 258 | HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L]) |
237 | HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) | 259 | HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) |
238 | HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) | 260 | HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) |
239 | HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) | 261 | HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) |
240 | HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) | 262 | HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) |
241 | HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) | 263 | HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) |
242 | HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) | 264 | HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) |
243 | HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2]) | 265 | HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2]) |
244 | HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F]) | 266 | HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F]) |
245 | HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L]) | 267 | HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L]) |
246 | HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) | 268 | HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) |
247 | HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) | 269 | HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) |
248 | HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL]) | 270 | HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL]) |
249 | HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) | 271 | HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) |
250 | HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) | 272 | HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) |
251 | HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) | 273 | HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) |
252 | HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) | 274 | HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) |
253 | HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) | 275 | HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) |
254 | HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) | 276 | HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) |
255 | HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) | 277 | HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) |
256 | HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) | 278 | HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) |
257 | HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) | 279 | HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) |
258 | HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) | 280 | HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) |
259 | REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) | 281 | REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) |
260 | REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) | 282 | REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) |
261 | REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) | 283 | REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) |
262 | REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) | 284 | REPLACE_ATAN2F=0; AC_SUBST([REPLACE_ATAN2F]) |
263 | REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) | 285 | REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) |
264 | REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) | 286 | REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) |
265 | REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) | 287 | REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) |
266 | REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) | 288 | REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) |
267 | REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) | 289 | REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) |
268 | REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) | 290 | REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) |
269 | REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) | 291 | REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) |
270 | REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) | 292 | REPLACE_EXPF=0; AC_SUBST([REPLACE_EXPF]) |
271 | REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) | 293 | REPLACE_EXPL=0; AC_SUBST([REPLACE_EXPL]) |
272 | REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) | 294 | REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) |
273 | REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) | 295 | REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) |
274 | REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) | 296 | REPLACE_EXPM1L=0; AC_SUBST([REPLACE_EXPM1L]) |
275 | REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD]) | 297 | REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) |
276 | REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF]) | 298 | REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) |
277 | REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL]) | 299 | REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) |
278 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) | 300 | REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) |
279 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) | 301 | REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) |
280 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) | 302 | REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) |
281 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) | 303 | REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) |
282 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) | 304 | REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) |
283 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) | 305 | REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) |
284 | REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) | 306 | REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD]) |
285 | REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) | 307 | REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF]) |
286 | REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) | 308 | REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL]) |
287 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) | 309 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) |
288 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) | 310 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) |
289 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) | 311 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) |
290 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) | 312 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) |
291 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) | 313 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) |
292 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) | 314 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) |
293 | REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL]) | 315 | REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) |
294 | REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10]) | 316 | REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) |
295 | REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F]) | 317 | REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) |
296 | REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L]) | 318 | REPLACE_ILOGBL=0; AC_SUBST([REPLACE_ILOGBL]) |
297 | REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P]) | 319 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) |
298 | REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF]) | 320 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) |
299 | REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL]) | 321 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) |
300 | REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2]) | 322 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) |
301 | REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F]) | 323 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) |
302 | REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L]) | 324 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) |
303 | REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB]) | 325 | REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL]) |
304 | REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF]) | 326 | REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10]) |
305 | REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL]) | 327 | REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F]) |
306 | REPLACE_MODF=0; AC_SUBST([REPLACE_MODF]) | 328 | REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L]) |
307 | REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF]) | 329 | REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P]) |
308 | REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL]) | 330 | REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF]) |
309 | REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) | 331 | REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL]) |
310 | REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) | 332 | REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2]) |
311 | REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF]) | 333 | REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F]) |
312 | REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL]) | 334 | REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L]) |
313 | REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) | 335 | REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB]) |
314 | REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) | 336 | REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF]) |
315 | REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) | 337 | REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL]) |
316 | REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) | 338 | REPLACE_MODF=0; AC_SUBST([REPLACE_MODF]) |
317 | REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) | 339 | REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF]) |
318 | REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) | 340 | REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL]) |
319 | REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) | 341 | REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) |
320 | REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) | 342 | REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) |
321 | REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) | 343 | REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF]) |
344 | REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL]) | ||
345 | REPLACE_RINTL=0; AC_SUBST([REPLACE_RINTL]) | ||
346 | REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) | ||
347 | REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) | ||
348 | REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) | ||
349 | REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) | ||
350 | REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) | ||
351 | REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) | ||
352 | REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) | ||
353 | REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) | ||
354 | REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) | ||
355 | REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) | ||
356 | REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) | ||
357 | REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) | ||
358 | REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) | ||
359 | REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) | ||
322 | ]) | 360 | ]) |
323 | 361 | ||
324 | # gl_LONG_DOUBLE_VS_DOUBLE | 362 | # gl_LONG_DOUBLE_VS_DOUBLE |
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index 4c9f388..bb39304 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # mbrtowc.m4 serial 25 | 1 | # mbrtowc.m4 serial 38 -*- coding: utf-8 -*- |
2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2013 Free Software Foundation, | 2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2023 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl 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, |
@@ -8,6 +8,8 @@ dnl with or without modifications, as long as this notice is preserved. | |||
8 | AC_DEFUN([gl_FUNC_MBRTOWC], | 8 | AC_DEFUN([gl_FUNC_MBRTOWC], |
9 | [ | 9 | [ |
10 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
11 | AC_REQUIRE([gl_PTHREADLIB]) | ||
12 | AC_CHECK_HEADERS_ONCE([threads.h]) | ||
11 | 13 | ||
12 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | 14 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) |
13 | gl_MBSTATE_T_BROKEN | 15 | gl_MBSTATE_T_BROKEN |
@@ -16,15 +18,8 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
16 | if test $ac_cv_func_mbrtowc = no; then | 18 | if test $ac_cv_func_mbrtowc = no; then |
17 | HAVE_MBRTOWC=0 | 19 | HAVE_MBRTOWC=0 |
18 | AC_CHECK_DECLS([mbrtowc],,, [[ | 20 | AC_CHECK_DECLS([mbrtowc],,, [[ |
19 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 21 | #include <wchar.h> |
20 | <wchar.h>. | 22 | ]]) |
21 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
22 | included before <wchar.h>. */ | ||
23 | #include <stddef.h> | ||
24 | #include <stdio.h> | ||
25 | #include <time.h> | ||
26 | #include <wchar.h> | ||
27 | ]]) | ||
28 | if test $ac_cv_have_decl_mbrtowc = yes; then | 23 | if test $ac_cv_have_decl_mbrtowc = yes; then |
29 | dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although | 24 | dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although |
30 | dnl it does not have the function. Avoid a collision with gnulib's | 25 | dnl it does not have the function. Avoid a collision with gnulib's |
@@ -39,6 +34,9 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
39 | gl_MBRTOWC_NULL_ARG2 | 34 | gl_MBRTOWC_NULL_ARG2 |
40 | gl_MBRTOWC_RETVAL | 35 | gl_MBRTOWC_RETVAL |
41 | gl_MBRTOWC_NUL_RETVAL | 36 | gl_MBRTOWC_NUL_RETVAL |
37 | gl_MBRTOWC_STORES_INCOMPLETE | ||
38 | gl_MBRTOWC_EMPTY_INPUT | ||
39 | gl_MBRTOWC_C_LOCALE | ||
42 | case "$gl_cv_func_mbrtowc_null_arg1" in | 40 | case "$gl_cv_func_mbrtowc_null_arg1" in |
43 | *yes) ;; | 41 | *yes) ;; |
44 | *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1], | 42 | *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1], |
@@ -67,8 +65,47 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
67 | REPLACE_MBRTOWC=1 | 65 | REPLACE_MBRTOWC=1 |
68 | ;; | 66 | ;; |
69 | esac | 67 | esac |
68 | case "$gl_cv_func_mbrtowc_stores_incomplete" in | ||
69 | *no) ;; | ||
70 | *) AC_DEFINE([MBRTOWC_STORES_INCOMPLETE_BUG], [1], | ||
71 | [Define if the mbrtowc function stores a wide character when reporting incomplete input.]) | ||
72 | REPLACE_MBRTOWC=1 | ||
73 | ;; | ||
74 | esac | ||
75 | case "$gl_cv_func_mbrtowc_empty_input" in | ||
76 | *yes) ;; | ||
77 | *) AC_DEFINE([MBRTOWC_EMPTY_INPUT_BUG], [1], | ||
78 | [Define if the mbrtowc function does not return (size_t) -2 | ||
79 | for empty input.]) | ||
80 | REPLACE_MBRTOWC=1 | ||
81 | ;; | ||
82 | esac | ||
83 | case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
84 | *yes) ;; | ||
85 | *) AC_DEFINE([MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ], [1], | ||
86 | [Define if the mbrtowc function may signal encoding errors in the C locale.]) | ||
87 | REPLACE_MBRTOWC=1 | ||
88 | ;; | ||
89 | esac | ||
70 | fi | 90 | fi |
71 | fi | 91 | fi |
92 | if test $REPLACE_MBSTATE_T = 1; then | ||
93 | case "$host_os" in | ||
94 | mingw*) LIB_MBRTOWC= ;; | ||
95 | *) | ||
96 | gl_WEAK_SYMBOLS | ||
97 | case "$gl_cv_have_weak" in | ||
98 | *yes) LIB_MBRTOWC= ;; | ||
99 | *) LIB_MBRTOWC="$LIBPTHREAD" ;; | ||
100 | esac | ||
101 | ;; | ||
102 | esac | ||
103 | else | ||
104 | LIB_MBRTOWC= | ||
105 | fi | ||
106 | dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX | ||
107 | dnl with gcc or xlc, and empty otherwise. | ||
108 | AC_SUBST([LIB_MBRTOWC]) | ||
72 | ]) | 109 | ]) |
73 | 110 | ||
74 | dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that | 111 | dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that |
@@ -80,11 +117,19 @@ dnl avoid inconsistencies. | |||
80 | AC_DEFUN([gl_MBSTATE_T_BROKEN], | 117 | AC_DEFUN([gl_MBSTATE_T_BROKEN], |
81 | [ | 118 | [ |
82 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 119 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
120 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
83 | 121 | ||
84 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | 122 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) |
85 | AC_CHECK_FUNCS_ONCE([mbsinit]) | 123 | AC_CHECK_FUNCS_ONCE([mbsinit]) |
86 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | 124 | AC_CHECK_FUNCS_ONCE([mbrtowc]) |
87 | if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then | 125 | dnl On native Windows, we know exactly how mbsinit() behaves and don't need |
126 | dnl to override it, even if - like on MSVC - mbsinit() is only defined as | ||
127 | dnl an inline function, not as a global function. | ||
128 | if case "$host_os" in | ||
129 | mingw*) true ;; | ||
130 | *) test $ac_cv_func_mbsinit = yes ;; | ||
131 | esac \ | ||
132 | && test $ac_cv_func_mbrtowc = yes; then | ||
88 | gl_MBRTOWC_INCOMPLETE_STATE | 133 | gl_MBRTOWC_INCOMPLETE_STATE |
89 | gl_MBRTOWC_SANITYCHECK | 134 | gl_MBRTOWC_SANITYCHECK |
90 | REPLACE_MBSTATE_T=0 | 135 | REPLACE_MBSTATE_T=0 |
@@ -109,6 +154,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], | |||
109 | [ | 154 | [ |
110 | AC_REQUIRE([AC_PROG_CC]) | 155 | AC_REQUIRE([AC_PROG_CC]) |
111 | AC_REQUIRE([gt_LOCALE_JA]) | 156 | AC_REQUIRE([gt_LOCALE_JA]) |
157 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
112 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 158 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
113 | AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], | 159 | AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], |
114 | [gl_cv_func_mbrtowc_incomplete_state], | 160 | [gl_cv_func_mbrtowc_incomplete_state], |
@@ -128,13 +174,6 @@ changequote([,])dnl | |||
128 | [AC_LANG_SOURCE([[ | 174 | [AC_LANG_SOURCE([[ |
129 | #include <locale.h> | 175 | #include <locale.h> |
130 | #include <string.h> | 176 | #include <string.h> |
131 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
132 | <wchar.h>. | ||
133 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
134 | included before <wchar.h>. */ | ||
135 | #include <stddef.h> | ||
136 | #include <stdio.h> | ||
137 | #include <time.h> | ||
138 | #include <wchar.h> | 177 | #include <wchar.h> |
139 | int main () | 178 | int main () |
140 | { | 179 | { |
@@ -147,13 +186,39 @@ int main () | |||
147 | memset (&state, '\0', sizeof (mbstate_t)); | 186 | memset (&state, '\0', sizeof (mbstate_t)); |
148 | if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) | 187 | if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) |
149 | if (mbsinit (&state)) | 188 | if (mbsinit (&state)) |
150 | return 1; | 189 | return 2; |
190 | } | ||
191 | return 0; | ||
192 | }]])], | ||
193 | [gl_cv_func_mbrtowc_incomplete_state=yes], | ||
194 | [gl_cv_func_mbrtowc_incomplete_state=no], | ||
195 | [:]) | ||
196 | else | ||
197 | if test $LOCALE_FR_UTF8 != none; then | ||
198 | AC_RUN_IFELSE( | ||
199 | [AC_LANG_SOURCE([[ | ||
200 | #include <locale.h> | ||
201 | #include <string.h> | ||
202 | #include <wchar.h> | ||
203 | int main () | ||
204 | { | ||
205 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
206 | { | ||
207 | const char input[] = "B\303\274\303\237er"; /* "Büßer" */ | ||
208 | mbstate_t state; | ||
209 | wchar_t wc; | ||
210 | |||
211 | memset (&state, '\0', sizeof (mbstate_t)); | ||
212 | if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) | ||
213 | if (mbsinit (&state)) | ||
214 | return 2; | ||
151 | } | 215 | } |
152 | return 0; | 216 | return 0; |
153 | }]])], | 217 | }]])], |
154 | [gl_cv_func_mbrtowc_incomplete_state=yes], | 218 | [gl_cv_func_mbrtowc_incomplete_state=yes], |
155 | [gl_cv_func_mbrtowc_incomplete_state=no], | 219 | [gl_cv_func_mbrtowc_incomplete_state=no], |
156 | [:]) | 220 | [:]) |
221 | fi | ||
157 | fi | 222 | fi |
158 | ]) | 223 | ]) |
159 | ]) | 224 | ]) |
@@ -185,13 +250,6 @@ changequote([,])dnl | |||
185 | #include <locale.h> | 250 | #include <locale.h> |
186 | #include <stdlib.h> | 251 | #include <stdlib.h> |
187 | #include <string.h> | 252 | #include <string.h> |
188 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
189 | <wchar.h>. | ||
190 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
191 | included before <wchar.h>. */ | ||
192 | #include <stddef.h> | ||
193 | #include <stdio.h> | ||
194 | #include <time.h> | ||
195 | #include <wchar.h> | 253 | #include <wchar.h> |
196 | int main () | 254 | int main () |
197 | { | 255 | { |
@@ -207,7 +265,7 @@ int main () | |||
207 | memset (&state, '\0', sizeof (mbstate_t)); | 265 | memset (&state, '\0', sizeof (mbstate_t)); |
208 | if (mbrtowc (&wc, input + 3, 6, &state) != 4 | 266 | if (mbrtowc (&wc, input + 3, 6, &state) != 4 |
209 | && mbtowc (&wc, input + 3, 6) == 4) | 267 | && mbtowc (&wc, input + 3, 6) == 4) |
210 | return 1; | 268 | return 2; |
211 | } | 269 | } |
212 | return 0; | 270 | return 0; |
213 | }]])], | 271 | }]])], |
@@ -245,13 +303,6 @@ changequote([,])dnl | |||
245 | #include <locale.h> | 303 | #include <locale.h> |
246 | #include <stdlib.h> | 304 | #include <stdlib.h> |
247 | #include <string.h> | 305 | #include <string.h> |
248 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
249 | <wchar.h>. | ||
250 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
251 | included before <wchar.h>. */ | ||
252 | #include <stddef.h> | ||
253 | #include <stdio.h> | ||
254 | #include <time.h> | ||
255 | #include <wchar.h> | 306 | #include <wchar.h> |
256 | int main () | 307 | int main () |
257 | { | 308 | { |
@@ -314,13 +365,6 @@ changequote([,])dnl | |||
314 | [AC_LANG_SOURCE([[ | 365 | [AC_LANG_SOURCE([[ |
315 | #include <locale.h> | 366 | #include <locale.h> |
316 | #include <string.h> | 367 | #include <string.h> |
317 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
318 | <wchar.h>. | ||
319 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
320 | included before <wchar.h>. */ | ||
321 | #include <stddef.h> | ||
322 | #include <stdio.h> | ||
323 | #include <time.h> | ||
324 | #include <wchar.h> | 368 | #include <wchar.h> |
325 | int main () | 369 | int main () |
326 | { | 370 | { |
@@ -335,7 +379,7 @@ int main () | |||
335 | mbrtowc (&wc, NULL, 5, &state); | 379 | mbrtowc (&wc, NULL, 5, &state); |
336 | /* Check that wc was not modified. */ | 380 | /* Check that wc was not modified. */ |
337 | if (wc != (wchar_t) 0xBADFACE) | 381 | if (wc != (wchar_t) 0xBADFACE) |
338 | return 1; | 382 | return 2; |
339 | } | 383 | } |
340 | return 0; | 384 | return 0; |
341 | }]])], | 385 | }]])], |
@@ -376,13 +420,6 @@ changequote([,])dnl | |||
376 | [AC_LANG_SOURCE([[ | 420 | [AC_LANG_SOURCE([[ |
377 | #include <locale.h> | 421 | #include <locale.h> |
378 | #include <string.h> | 422 | #include <string.h> |
379 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
380 | <wchar.h>. | ||
381 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
382 | included before <wchar.h>. */ | ||
383 | #include <stddef.h> | ||
384 | #include <stdio.h> | ||
385 | #include <time.h> | ||
386 | #include <wchar.h> | 423 | #include <wchar.h> |
387 | int main () | 424 | int main () |
388 | { | 425 | { |
@@ -504,13 +541,6 @@ changequote([,])dnl | |||
504 | [AC_LANG_SOURCE([[ | 541 | [AC_LANG_SOURCE([[ |
505 | #include <locale.h> | 542 | #include <locale.h> |
506 | #include <string.h> | 543 | #include <string.h> |
507 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
508 | <wchar.h>. | ||
509 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
510 | included before <wchar.h>. */ | ||
511 | #include <stddef.h> | ||
512 | #include <stdio.h> | ||
513 | #include <time.h> | ||
514 | #include <wchar.h> | 544 | #include <wchar.h> |
515 | int main () | 545 | int main () |
516 | { | 546 | { |
@@ -522,7 +552,7 @@ int main () | |||
522 | 552 | ||
523 | memset (&state, '\0', sizeof (mbstate_t)); | 553 | memset (&state, '\0', sizeof (mbstate_t)); |
524 | if (mbrtowc (&wc, "", 1, &state) != 0) | 554 | if (mbrtowc (&wc, "", 1, &state) != 0) |
525 | return 1; | 555 | return 2; |
526 | } | 556 | } |
527 | return 0; | 557 | return 0; |
528 | }]])], | 558 | }]])], |
@@ -533,11 +563,206 @@ int main () | |||
533 | ]) | 563 | ]) |
534 | ]) | 564 | ]) |
535 | 565 | ||
536 | # Prerequisites of lib/mbrtowc.c. | 566 | dnl Test whether mbrtowc stores a wide character when reporting incomplete |
567 | dnl input. | ||
568 | |||
569 | AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE], | ||
570 | [ | ||
571 | AC_REQUIRE([AC_PROG_CC]) | ||
572 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
573 | AC_CACHE_CHECK([whether mbrtowc stores incomplete characters], | ||
574 | [gl_cv_func_mbrtowc_stores_incomplete], | ||
575 | [ | ||
576 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
577 | dnl is present. | ||
578 | changequote(,)dnl | ||
579 | case "$host_os" in | ||
580 | # Guess yes on native Windows. | ||
581 | mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; | ||
582 | *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; | ||
583 | esac | ||
584 | changequote([,])dnl | ||
585 | case "$host_os" in | ||
586 | mingw*) | ||
587 | AC_RUN_IFELSE( | ||
588 | [AC_LANG_SOURCE([[ | ||
589 | #include <locale.h> | ||
590 | #include <string.h> | ||
591 | #include <wchar.h> | ||
592 | int main () | ||
593 | { | ||
594 | int result = 0; | ||
595 | if (setlocale (LC_ALL, "French_France.65001") != NULL) | ||
596 | { | ||
597 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
598 | mbstate_t state; | ||
599 | |||
600 | memset (&state, '\0', sizeof (mbstate_t)); | ||
601 | if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) | ||
602 | && wc != (wchar_t) 0xBADFACE) | ||
603 | result |= 1; | ||
604 | } | ||
605 | if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) | ||
606 | { | ||
607 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
608 | mbstate_t state; | ||
609 | |||
610 | memset (&state, '\0', sizeof (mbstate_t)); | ||
611 | if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) | ||
612 | && wc != (wchar_t) 0xBADFACE) | ||
613 | result |= 2; | ||
614 | } | ||
615 | if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) | ||
616 | { | ||
617 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
618 | mbstate_t state; | ||
619 | |||
620 | memset (&state, '\0', sizeof (mbstate_t)); | ||
621 | if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) | ||
622 | && wc != (wchar_t) 0xBADFACE) | ||
623 | result |= 4; | ||
624 | } | ||
625 | if (setlocale (LC_ALL, "Chinese_China.936") != NULL) | ||
626 | { | ||
627 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
628 | mbstate_t state; | ||
629 | |||
630 | memset (&state, '\0', sizeof (mbstate_t)); | ||
631 | if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) | ||
632 | && wc != (wchar_t) 0xBADFACE) | ||
633 | result |= 8; | ||
634 | } | ||
635 | return result; | ||
636 | }]])], | ||
637 | [gl_cv_func_mbrtowc_stores_incomplete=no], | ||
638 | [gl_cv_func_mbrtowc_stores_incomplete=yes], | ||
639 | [:]) | ||
640 | ;; | ||
641 | *) | ||
642 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
643 | if test $LOCALE_FR_UTF8 != none; then | ||
644 | AC_RUN_IFELSE( | ||
645 | [AC_LANG_SOURCE([[ | ||
646 | #include <locale.h> | ||
647 | #include <string.h> | ||
648 | #include <wchar.h> | ||
649 | int main () | ||
650 | { | ||
651 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
652 | { | ||
653 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
654 | mbstate_t state; | ||
655 | |||
656 | memset (&state, '\0', sizeof (mbstate_t)); | ||
657 | if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) | ||
658 | && wc != (wchar_t) 0xBADFACE) | ||
659 | return 1; | ||
660 | } | ||
661 | return 0; | ||
662 | }]])], | ||
663 | [gl_cv_func_mbrtowc_stores_incomplete=no], | ||
664 | [gl_cv_func_mbrtowc_stores_incomplete=yes], | ||
665 | [:]) | ||
666 | fi | ||
667 | ;; | ||
668 | esac | ||
669 | ]) | ||
670 | ]) | ||
671 | |||
672 | dnl Test whether mbrtowc returns the correct value on empty input. | ||
673 | |||
674 | AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], | ||
675 | [ | ||
676 | AC_REQUIRE([AC_PROG_CC]) | ||
677 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
678 | AC_CACHE_CHECK([whether mbrtowc works on empty input], | ||
679 | [gl_cv_func_mbrtowc_empty_input], | ||
680 | [ | ||
681 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
682 | dnl is present. | ||
683 | changequote(,)dnl | ||
684 | case "$host_os" in | ||
685 | # Guess no on AIX and glibc systems. | ||
686 | aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; | ||
687 | # Guess yes on native Windows. | ||
688 | mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; | ||
689 | *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; | ||
690 | esac | ||
691 | changequote([,])dnl | ||
692 | AC_RUN_IFELSE( | ||
693 | [AC_LANG_SOURCE([[ | ||
694 | #include <wchar.h> | ||
695 | static wchar_t wc; | ||
696 | static mbstate_t mbs; | ||
697 | int | ||
698 | main (void) | ||
699 | { | ||
700 | return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; | ||
701 | }]])], | ||
702 | [gl_cv_func_mbrtowc_empty_input=yes], | ||
703 | [gl_cv_func_mbrtowc_empty_input=no], | ||
704 | [:]) | ||
705 | ]) | ||
706 | ]) | ||
707 | |||
708 | 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 | ||
710 | dnl and other implementations do it. See: | ||
711 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 | ||
712 | |||
713 | AC_DEFUN([gl_MBRTOWC_C_LOCALE], | ||
714 | [ | ||
715 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
716 | AC_CACHE_CHECK([whether the C locale is free of encoding errors], | ||
717 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], | ||
718 | [ | ||
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( | ||
725 | [[#include <limits.h> | ||
726 | #include <locale.h> | ||
727 | #include <wchar.h> | ||
728 | ]], [[ | ||
729 | int i; | ||
730 | char *locale = setlocale (LC_ALL, "C"); | ||
731 | if (! locale) | ||
732 | return 2; | ||
733 | for (i = CHAR_MIN; i <= CHAR_MAX; i++) | ||
734 | { | ||
735 | char c = i; | ||
736 | wchar_t wc; | ||
737 | mbstate_t mbs = { 0, }; | ||
738 | size_t ss = mbrtowc (&wc, &c, 1, &mbs); | ||
739 | if (1 < ss) | ||
740 | return 3; | ||
741 | } | ||
742 | return 0; | ||
743 | ]])], | ||
744 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], | ||
745 | [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], | ||
746 | [case "$host_os" in | ||
747 | # Guess yes on native Windows. | ||
748 | mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; | ||
749 | esac | ||
750 | ]) | ||
751 | ]) | ||
752 | ]) | ||
753 | |||
754 | # Prerequisites of lib/mbrtowc.c and lib/lc-charset-dispatch.c. | ||
537 | AC_DEFUN([gl_PREREQ_MBRTOWC], [ | 755 | AC_DEFUN([gl_PREREQ_MBRTOWC], [ |
756 | AC_REQUIRE([AC_C_INLINE]) | ||
538 | : | 757 | : |
539 | ]) | 758 | ]) |
540 | 759 | ||
760 | # Prerequisites of lib/mbtowc-lock.c. | ||
761 | AC_DEFUN([gl_PREREQ_MBTOWC_LOCK], | ||
762 | [ | ||
763 | gl_VISIBILITY | ||
764 | ]) | ||
765 | |||
541 | 766 | ||
542 | dnl From Paul Eggert | 767 | dnl From Paul Eggert |
543 | 768 | ||
@@ -547,24 +772,17 @@ AC_DEFUN([AC_FUNC_MBRTOWC], | |||
547 | [ | 772 | [ |
548 | dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. | 773 | dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. |
549 | AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], | 774 | AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], |
550 | gl_cv_func_mbrtowc, | 775 | [gl_cv_func_mbrtowc], |
551 | [AC_LINK_IFELSE( | 776 | [AC_LINK_IFELSE( |
552 | [AC_LANG_PROGRAM( | 777 | [AC_LANG_PROGRAM( |
553 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 778 | [[#include <wchar.h>]], |
554 | included before <wchar.h>. | ||
555 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
556 | must be included before <wchar.h>. */ | ||
557 | #include <stddef.h> | ||
558 | #include <stdio.h> | ||
559 | #include <time.h> | ||
560 | #include <wchar.h>]], | ||
561 | [[wchar_t wc; | 779 | [[wchar_t wc; |
562 | char const s[] = ""; | 780 | char const s[] = ""; |
563 | size_t n = 1; | 781 | size_t n = 1; |
564 | mbstate_t state; | 782 | mbstate_t state; |
565 | return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], | 783 | return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], |
566 | gl_cv_func_mbrtowc=yes, | 784 | [gl_cv_func_mbrtowc=yes], |
567 | gl_cv_func_mbrtowc=no)]) | 785 | [gl_cv_func_mbrtowc=no])]) |
568 | if test $gl_cv_func_mbrtowc = yes; then | 786 | if test $gl_cv_func_mbrtowc = yes; then |
569 | AC_DEFINE([HAVE_MBRTOWC], [1], | 787 | AC_DEFINE([HAVE_MBRTOWC], [1], |
570 | [Define to 1 if mbrtowc and mbstate_t are properly declared.]) | 788 | [Define to 1 if mbrtowc and mbstate_t are properly declared.]) |
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4 index 2e6d092..c388a8b 100644 --- a/gl/m4/mbsinit.m4 +++ b/gl/m4/mbsinit.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # mbsinit.m4 serial 8 | 1 | # mbsinit.m4 serial 9 |
2 | dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -16,15 +16,8 @@ AC_DEFUN([gl_FUNC_MBSINIT], | |||
16 | if test $ac_cv_func_mbsinit = no; then | 16 | if test $ac_cv_func_mbsinit = no; then |
17 | HAVE_MBSINIT=0 | 17 | HAVE_MBSINIT=0 |
18 | AC_CHECK_DECLS([mbsinit],,, [[ | 18 | AC_CHECK_DECLS([mbsinit],,, [[ |
19 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 19 | #include <wchar.h> |
20 | <wchar.h>. | 20 | ]]) |
21 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
22 | included before <wchar.h>. */ | ||
23 | #include <stddef.h> | ||
24 | #include <stdio.h> | ||
25 | #include <time.h> | ||
26 | #include <wchar.h> | ||
27 | ]]) | ||
28 | if test $ac_cv_have_decl_mbsinit = yes; then | 21 | if test $ac_cv_have_decl_mbsinit = yes; then |
29 | dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although | 22 | dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although |
30 | dnl it does not have the function. Avoid a collision with gnulib's | 23 | dnl it does not have the function. Avoid a collision with gnulib's |
diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4 index ed00117..dcd66b9 100644 --- a/gl/m4/mbstate_t.m4 +++ b/gl/m4/mbstate_t.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # mbstate_t.m4 serial 13 | 1 | # mbstate_t.m4 serial 14 |
2 | dnl Copyright (C) 2000-2002, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -20,14 +20,7 @@ AC_DEFUN([AC_TYPE_MBSTATE_T], | |||
20 | [AC_COMPILE_IFELSE( | 20 | [AC_COMPILE_IFELSE( |
21 | [AC_LANG_PROGRAM( | 21 | [AC_LANG_PROGRAM( |
22 | [AC_INCLUDES_DEFAULT[ | 22 | [AC_INCLUDES_DEFAULT[ |
23 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 23 | #include <wchar.h>]], |
24 | <wchar.h>. | ||
25 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
26 | included before <wchar.h>. */ | ||
27 | #include <stddef.h> | ||
28 | #include <stdio.h> | ||
29 | #include <time.h> | ||
30 | #include <wchar.h>]], | ||
31 | [[mbstate_t x; return sizeof x;]])], | 24 | [[mbstate_t x; return sizeof x;]])], |
32 | [ac_cv_type_mbstate_t=yes], | 25 | [ac_cv_type_mbstate_t=yes], |
33 | [ac_cv_type_mbstate_t=no])]) | 26 | [ac_cv_type_mbstate_t=no])]) |
diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4 index e479461..7823be0 100644 --- a/gl/m4/mbtowc.m4 +++ b/gl/m4/mbtowc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # mbtowc.m4 serial 2 | 1 | # mbtowc.m4 serial 3 |
2 | dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,8 +8,13 @@ AC_DEFUN([gl_FUNC_MBTOWC], | |||
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
10 | 10 | ||
11 | if false; then | 11 | AC_CHECK_FUNCS([mbtowc]) |
12 | REPLACE_MBTOWC=1 | 12 | if test $ac_cv_func_mbtowc = no; then |
13 | HAVE_MBTOWC=0 | ||
14 | else | ||
15 | if false; then | ||
16 | REPLACE_MBTOWC=1 | ||
17 | fi | ||
13 | fi | 18 | fi |
14 | ]) | 19 | ]) |
15 | 20 | ||
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index 2d8abe7..4f1aed0 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 | |||
@@ -1,35 +1,30 @@ | |||
1 | # memchr.m4 serial 12 | 1 | # memchr.m4 serial 18 |
2 | dnl Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | 7 | AC_DEFUN_ONCE([gl_FUNC_MEMCHR], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
10 | |||
9 | dnl Check for prerequisites for memory fence checks. | 11 | dnl Check for prerequisites for memory fence checks. |
10 | gl_FUNC_MMAP_ANON | 12 | gl_FUNC_MMAP_ANON |
11 | AC_CHECK_HEADERS_ONCE([sys/mman.h]) | 13 | AC_CHECK_HEADERS_ONCE([sys/mman.h]) |
12 | AC_CHECK_FUNCS_ONCE([mprotect]) | 14 | AC_CHECK_FUNCS_ONCE([mprotect]) |
13 | 15 | ||
14 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | 16 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
15 | m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ | 17 | # Detect platform-specific bugs in some versions of glibc: |
16 | dnl These days, we assume memchr is present. But if support for old | 18 | # memchr should not dereference anything with length 0 |
17 | dnl platforms is desired: | 19 | # https://bugzilla.redhat.com/show_bug.cgi?id=499689 |
18 | AC_CHECK_FUNCS_ONCE([memchr]) | 20 | # memchr should not dereference overestimated length after a match |
19 | if test $ac_cv_func_memchr = no; then | 21 | # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 |
20 | HAVE_MEMCHR=0 | 22 | # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 |
21 | fi | 23 | # memchr should cast the second argument to 'unsigned char'. |
22 | ]) | 24 | # This bug exists in Android 4.3. |
23 | if test $HAVE_MEMCHR = 1; then | 25 | # Assume that memchr works on platforms that lack mprotect. |
24 | # Detect platform-specific bugs in some versions of glibc: | 26 | AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], |
25 | # memchr should not dereference anything with length 0 | 27 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
26 | # http://bugzilla.redhat.com/499689 | ||
27 | # memchr should not dereference overestimated length after a match | ||
28 | # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 | ||
29 | # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 | ||
30 | # Assume that memchr works on platforms that lack mprotect. | ||
31 | AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], | ||
32 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
33 | #include <string.h> | 28 | #include <string.h> |
34 | #if HAVE_SYS_MMAN_H | 29 | #if HAVE_SYS_MMAN_H |
35 | # include <fcntl.h> | 30 | # include <fcntl.h> |
@@ -64,6 +59,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | |||
64 | #endif | 59 | #endif |
65 | if (fence) | 60 | if (fence) |
66 | { | 61 | { |
62 | /* Test against bugs on glibc systems. */ | ||
67 | if (memchr (fence, 0, 0)) | 63 | if (memchr (fence, 0, 0)) |
68 | result |= 1; | 64 | result |= 1; |
69 | strcpy (fence - 9, "12345678"); | 65 | strcpy (fence - 9, "12345678"); |
@@ -71,15 +67,37 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], | |||
71 | result |= 2; | 67 | result |= 2; |
72 | if (memchr (fence - 1, 0, 3) != fence - 1) | 68 | if (memchr (fence - 1, 0, 3) != fence - 1) |
73 | result |= 4; | 69 | result |= 4; |
70 | /* Test against bug on AIX 7.2. */ | ||
71 | if (memchr (fence - 4, '6', 16) != fence - 4) | ||
72 | result |= 8; | ||
74 | } | 73 | } |
74 | /* Test against bug on Android 4.3. */ | ||
75 | { | ||
76 | char input[3]; | ||
77 | input[0] = 'a'; | ||
78 | input[1] = 'b'; | ||
79 | input[2] = 'c'; | ||
80 | if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) | ||
81 | result |= 16; | ||
82 | } | ||
75 | return result; | 83 | return result; |
76 | ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], | 84 | ]])], |
77 | [dnl Be pessimistic for now. | 85 | [gl_cv_func_memchr_works=yes], |
78 | gl_cv_func_memchr_works="guessing no"])]) | 86 | [gl_cv_func_memchr_works=no], |
79 | if test "$gl_cv_func_memchr_works" != yes; then | 87 | [case "$host_os" in |
80 | REPLACE_MEMCHR=1 | 88 | # Guess no on Android. |
81 | fi | 89 | linux*-android*) gl_cv_func_memchr_works="guessing no" ;; |
82 | fi | 90 | # Guess yes on native Windows. |
91 | mingw*) gl_cv_func_memchr_works="guessing yes" ;; | ||
92 | # If we don't know, obey --enable-cross-guesses. | ||
93 | *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; | ||
94 | esac | ||
95 | ]) | ||
96 | ]) | ||
97 | case "$gl_cv_func_memchr_works" in | ||
98 | *yes) ;; | ||
99 | *) REPLACE_MEMCHR=1 ;; | ||
100 | esac | ||
83 | ]) | 101 | ]) |
84 | 102 | ||
85 | # Prerequisites of lib/memchr.c. | 103 | # Prerequisites of lib/memchr.c. |
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 new file mode 100644 index 0000000..fd09846 --- /dev/null +++ b/gl/m4/minmax.m4 | |||
@@ -0,0 +1,44 @@ | |||
1 | # minmax.m4 serial 4 | ||
2 | dnl Copyright (C) 2005, 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_PREREQ([2.53]) | ||
8 | |||
9 | AC_DEFUN([gl_MINMAX], | ||
10 | [ | ||
11 | AC_REQUIRE([gl_PREREQ_MINMAX]) | ||
12 | ]) | ||
13 | |||
14 | # Prerequisites of lib/minmax.h. | ||
15 | AC_DEFUN([gl_PREREQ_MINMAX], | ||
16 | [ | ||
17 | gl_MINMAX_IN_HEADER([limits.h]) | ||
18 | gl_MINMAX_IN_HEADER([sys/param.h]) | ||
19 | ]) | ||
20 | |||
21 | dnl gl_MINMAX_IN_HEADER(HEADER) | ||
22 | dnl The parameter has to be a literal header name; it cannot be macro, | ||
23 | dnl nor a shell variable. (Because autoheader collects only AC_DEFINE | ||
24 | dnl invocations with a literal macro name.) | ||
25 | AC_DEFUN([gl_MINMAX_IN_HEADER], | ||
26 | [ | ||
27 | m4_pushdef([header], AS_TR_SH([$1])) | ||
28 | m4_pushdef([HEADER], AS_TR_CPP([$1])) | ||
29 | AC_CACHE_CHECK([whether <$1> defines MIN and MAX], | ||
30 | [gl_cv_minmax_in_]header, | ||
31 | [AC_COMPILE_IFELSE( | ||
32 | [AC_LANG_PROGRAM( | ||
33 | [[#include <$1> | ||
34 | int x = MIN (42, 17);]], | ||
35 | [[]])], | ||
36 | [gl_cv_minmax_in_]header[=yes], | ||
37 | [gl_cv_minmax_in_]header[=no])]) | ||
38 | if test $gl_cv_minmax_in_[]header = yes; then | ||
39 | AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1, | ||
40 | [Define to 1 if <$1> defines the MIN and MAX macros.]) | ||
41 | fi | ||
42 | m4_popdef([HEADER]) | ||
43 | m4_popdef([header]) | ||
44 | ]) | ||
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index faefb77..e9d31f3 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # serial 25 | 1 | # serial 37 |
2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl 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, |
@@ -7,24 +7,40 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | 7 | ||
8 | dnl From Jim Meyering. | 8 | dnl From Jim Meyering. |
9 | 9 | ||
10 | AC_DEFUN([gl_FUNC_MKTIME], | 10 | AC_DEFUN([gl_TIME_T_IS_SIGNED], |
11 | [ | ||
12 | AC_CACHE_CHECK([whether time_t is signed], | ||
13 | [gl_cv_time_t_is_signed], | ||
14 | [AC_COMPILE_IFELSE( | ||
15 | [AC_LANG_PROGRAM([[#include <time.h> | ||
16 | char time_t_signed[(time_t) -1 < 0 ? 1 : -1];]])], | ||
17 | [gl_cv_time_t_is_signed=yes], | ||
18 | [gl_cv_time_t_is_signed=no])]) | ||
19 | if test $gl_cv_time_t_is_signed = yes; then | ||
20 | AC_DEFINE([TIME_T_IS_SIGNED], [1], [Define to 1 if time_t is signed.]) | ||
21 | fi | ||
22 | ]) | ||
23 | |||
24 | dnl Test whether mktime works. Set gl_cv_func_working_mktime. | ||
25 | AC_DEFUN([gl_FUNC_MKTIME_WORKS], | ||
11 | [ | 26 | [ |
12 | AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) | 27 | AC_REQUIRE([gl_TIME_T_IS_SIGNED]) |
28 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
13 | 29 | ||
14 | dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained | 30 | dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained |
15 | dnl in Autoconf and because it invokes AC_LIBOBJ. | 31 | dnl in Autoconf and because it invokes AC_LIBOBJ. |
16 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 32 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
17 | AC_CHECK_DECLS_ONCE([alarm]) | 33 | AC_CHECK_DECLS_ONCE([alarm]) |
18 | AC_REQUIRE([gl_MULTIARCH]) | 34 | AC_REQUIRE([gl_MULTIARCH]) |
19 | if test $APPLE_UNIVERSAL_BUILD = 1; then | ||
20 | # A universal build on Apple Mac OS X platforms. | ||
21 | # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. | ||
22 | # But we need a configuration result that is valid in both modes. | ||
23 | gl_cv_func_working_mktime=no | ||
24 | fi | ||
25 | AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime], | 35 | AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime], |
26 | [AC_RUN_IFELSE( | 36 | [if test $APPLE_UNIVERSAL_BUILD = 1; then |
27 | [AC_LANG_SOURCE( | 37 | # A universal build on Apple Mac OS X platforms. |
38 | # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. | ||
39 | # But we need a configuration result that is valid in both modes. | ||
40 | gl_cv_func_working_mktime="guessing no" | ||
41 | else | ||
42 | AC_RUN_IFELSE( | ||
43 | [AC_LANG_SOURCE( | ||
28 | [[/* Test program from Paul Eggert and Tony Leneis. */ | 44 | [[/* Test program from Paul Eggert and Tony Leneis. */ |
29 | #include <limits.h> | 45 | #include <limits.h> |
30 | #include <stdlib.h> | 46 | #include <stdlib.h> |
@@ -38,8 +54,11 @@ AC_DEFUN([gl_FUNC_MKTIME], | |||
38 | # include <signal.h> | 54 | # include <signal.h> |
39 | #endif | 55 | #endif |
40 | 56 | ||
41 | /* Work around redefinition to rpl_putenv by other config tests. */ | 57 | ]GL_MDA_DEFINES[ |
42 | #undef putenv | 58 | |
59 | #ifndef TIME_T_IS_SIGNED | ||
60 | # define TIME_T_IS_SIGNED 0 | ||
61 | #endif | ||
43 | 62 | ||
44 | static time_t time_t_max; | 63 | static time_t time_t_max; |
45 | static time_t time_t_min; | 64 | static time_t time_t_min; |
@@ -63,7 +82,8 @@ spring_forward_gap () | |||
63 | instead of "TZ=America/Vancouver" in order to detect the bug even | 82 | instead of "TZ=America/Vancouver" in order to detect the bug even |
64 | on systems that don't support the Olson extension, or don't have the | 83 | on systems that don't support the Olson extension, or don't have the |
65 | full zoneinfo tables installed. */ | 84 | full zoneinfo tables installed. */ |
66 | putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); | 85 | if (putenv ("TZ=PST8PDT,M4.1.0,M10.5.0") != 0) |
86 | return -1; | ||
67 | 87 | ||
68 | tm.tm_year = 98; | 88 | tm.tm_year = 98; |
69 | tm.tm_mon = 3; | 89 | tm.tm_mon = 3; |
@@ -151,7 +171,8 @@ year_2050_test () | |||
151 | instead of "TZ=America/Vancouver" in order to detect the bug even | 171 | instead of "TZ=America/Vancouver" in order to detect the bug even |
152 | on systems that don't support the Olson extension, or don't have the | 172 | on systems that don't support the Olson extension, or don't have the |
153 | full zoneinfo tables installed. */ | 173 | full zoneinfo tables installed. */ |
154 | putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); | 174 | if (putenv ("TZ=PST8PDT,M4.1.0,M10.5.0") != 0) |
175 | return -1; | ||
155 | 176 | ||
156 | t = mktime (&tm); | 177 | t = mktime (&tm); |
157 | 178 | ||
@@ -162,6 +183,25 @@ year_2050_test () | |||
162 | || (0 < t && answer - 120 <= t && t <= answer + 120)); | 183 | || (0 < t && answer - 120 <= t && t <= answer + 120)); |
163 | } | 184 | } |
164 | 185 | ||
186 | static int | ||
187 | indiana_test () | ||
188 | { | ||
189 | if (putenv ("TZ=America/Indiana/Indianapolis") != 0) | ||
190 | return -1; | ||
191 | struct tm tm; | ||
192 | tm.tm_year = 1986 - 1900; tm.tm_mon = 4 - 1; tm.tm_mday = 28; | ||
193 | tm.tm_hour = 16; tm.tm_min = 24; tm.tm_sec = 50; tm.tm_isdst = 0; | ||
194 | time_t std = mktime (&tm); | ||
195 | if (! (std == 515107490 || std == 515107503)) | ||
196 | return 1; | ||
197 | |||
198 | /* This platform supports TZDB, either without or with leap seconds. | ||
199 | Return true if GNU Bug#48085 is absent. */ | ||
200 | tm.tm_isdst = 1; | ||
201 | time_t dst = mktime (&tm); | ||
202 | return std - dst == 60 * 60; | ||
203 | } | ||
204 | |||
165 | int | 205 | int |
166 | main () | 206 | main () |
167 | { | 207 | { |
@@ -169,7 +209,6 @@ main () | |||
169 | time_t t, delta; | 209 | time_t t, delta; |
170 | int i, j; | 210 | int i, j; |
171 | int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1; | 211 | int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1; |
172 | int time_t_signed = ! ((time_t) 0 < (time_t) -1); | ||
173 | 212 | ||
174 | #if HAVE_DECL_ALARM | 213 | #if HAVE_DECL_ALARM |
175 | /* This test makes some buggy mktime implementations loop. | 214 | /* This test makes some buggy mktime implementations loop. |
@@ -179,11 +218,11 @@ main () | |||
179 | alarm (60); | 218 | alarm (60); |
180 | #endif | 219 | #endif |
181 | 220 | ||
182 | time_t_max = (! time_t_signed | 221 | time_t_max = (! TIME_T_IS_SIGNED |
183 | ? (time_t) -1 | 222 | ? (time_t) -1 |
184 | : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1) | 223 | : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1) |
185 | * 2 + 1)); | 224 | * 2 + 1)); |
186 | time_t_min = (! time_t_signed | 225 | time_t_min = (! TIME_T_IS_SIGNED |
187 | ? (time_t) 0 | 226 | ? (time_t) 0 |
188 | : time_t_signed_magnitude | 227 | : time_t_signed_magnitude |
189 | ? ~ (time_t) 0 | 228 | ? ~ (time_t) 0 |
@@ -218,35 +257,62 @@ main () | |||
218 | result |= 16; | 257 | result |= 16; |
219 | if (! spring_forward_gap ()) | 258 | if (! spring_forward_gap ()) |
220 | result |= 32; | 259 | result |= 32; |
221 | if (! year_2050_test ()) | 260 | if (! year_2050_test () || ! indiana_test ()) |
222 | result |= 64; | 261 | result |= 64; |
223 | return result; | 262 | return result; |
224 | }]])], | 263 | }]])], |
225 | [gl_cv_func_working_mktime=yes], | 264 | [gl_cv_func_working_mktime=yes], |
226 | [gl_cv_func_working_mktime=no], | 265 | [gl_cv_func_working_mktime=no], |
227 | [gl_cv_func_working_mktime=no]) | 266 | [case "$host_os" in |
267 | # Guess no on native Windows. | ||
268 | mingw*) gl_cv_func_working_mktime="guessing no" ;; | ||
269 | *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; | ||
270 | esac | ||
271 | ]) | ||
272 | fi | ||
228 | ]) | 273 | ]) |
274 | ]) | ||
275 | |||
276 | dnl Main macro of module 'mktime'. | ||
277 | AC_DEFUN([gl_FUNC_MKTIME], | ||
278 | [ | ||
279 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) | ||
280 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
281 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) | ||
229 | 282 | ||
230 | if test $gl_cv_func_working_mktime = no; then | 283 | REPLACE_MKTIME=0 |
284 | if test "$gl_cv_func_working_mktime" != yes; then | ||
231 | REPLACE_MKTIME=1 | 285 | REPLACE_MKTIME=1 |
232 | else | 286 | AC_DEFINE([NEED_MKTIME_WORKING], [1], |
233 | REPLACE_MKTIME=0 | 287 | [Define if the compilation of mktime.c should define 'mktime' |
288 | with the algorithmic workarounds.]) | ||
234 | fi | 289 | fi |
290 | case "$host_os" in | ||
291 | mingw*) | ||
292 | REPLACE_MKTIME=1 | ||
293 | AC_DEFINE([NEED_MKTIME_WINDOWS], [1], | ||
294 | [Define if the compilation of mktime.c should define 'mktime' | ||
295 | with the native Windows TZ workaround.]) | ||
296 | ;; | ||
297 | esac | ||
235 | ]) | 298 | ]) |
236 | 299 | ||
300 | dnl Main macro of module 'mktime-internal'. | ||
237 | AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ | 301 | AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ |
238 | AC_REQUIRE([gl_FUNC_MKTIME]) | 302 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) |
239 | if test $REPLACE_MKTIME = 0; then | 303 | |
240 | dnl BeOS has __mktime_internal in libc, but other platforms don't. | 304 | WANT_MKTIME_INTERNAL=0 |
241 | AC_CHECK_FUNC([__mktime_internal], | 305 | dnl BeOS has __mktime_internal in libc, but other platforms don't. |
242 | [AC_DEFINE([mktime_internal], [__mktime_internal], | 306 | AC_CHECK_FUNC([__mktime_internal], |
243 | [Define to the real name of the mktime_internal function.]) | 307 | [AC_DEFINE([mktime_internal], [__mktime_internal], |
244 | ], | 308 | [Define to the real name of the mktime_internal function.]) |
245 | [dnl mktime works but it doesn't export __mktime_internal, | 309 | ], |
246 | dnl so we need to substitute our own mktime implementation. | 310 | [dnl mktime works but it doesn't export __mktime_internal, |
247 | REPLACE_MKTIME=1 | 311 | dnl so we need to substitute our own mktime implementation. |
248 | ]) | 312 | WANT_MKTIME_INTERNAL=1 |
249 | fi | 313 | AC_DEFINE([NEED_MKTIME_INTERNAL], [1], |
314 | [Define if the compilation of mktime.c should define 'mktime_internal'.]) | ||
315 | ]) | ||
250 | ]) | 316 | ]) |
251 | 317 | ||
252 | # Prerequisites of lib/mktime.c. | 318 | # Prerequisites of lib/mktime.c. |
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 index 9b60ddf..d07d26e 100644 --- a/gl/m4/mmap-anon.m4 +++ b/gl/m4/mmap-anon.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # mmap-anon.m4 serial 10 | 1 | # mmap-anon.m4 serial 12 |
2 | dnl Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -9,11 +9,11 @@ dnl with or without modifications, as long as this notice is preserved. | |||
9 | # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS | 9 | # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS |
10 | # and MAP_ANON exist and have the same value. | 10 | # and MAP_ANON exist and have the same value. |
11 | # - On HP-UX, only MAP_ANONYMOUS exists. | 11 | # - On HP-UX, only MAP_ANONYMOUS exists. |
12 | # - On Mac OS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. | 12 | # - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. |
13 | # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be | 13 | # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be |
14 | # used. | 14 | # used. |
15 | 15 | ||
16 | AC_DEFUN([gl_FUNC_MMAP_ANON], | 16 | AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], |
17 | [ | 17 | [ |
18 | dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. | 18 | dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. |
19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4 new file mode 100644 index 0000000..82197c0 --- /dev/null +++ b/gl/m4/mode_t.m4 | |||
@@ -0,0 +1,26 @@ | |||
1 | # mode_t.m4 serial 2 | ||
2 | dnl Copyright (C) 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 | # For using mode_t, it's sufficient to use AC_TYPE_MODE_T and | ||
8 | # include <sys/types.h>. | ||
9 | |||
10 | # Define PROMOTED_MODE_T to the type that is the result of "default argument | ||
11 | # promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. | ||
12 | AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], | ||
13 | [ | ||
14 | AC_REQUIRE([AC_TYPE_MODE_T]) | ||
15 | AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ | ||
16 | dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', | ||
17 | dnl and to itself otherwise. This assumption is not guaranteed by the ISO C | ||
18 | dnl standard, but we don't know of any real-world counterexamples. | ||
19 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], | ||
20 | [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], | ||
21 | [gl_cv_promoted_mode_t='int'], | ||
22 | [gl_cv_promoted_mode_t='mode_t']) | ||
23 | ]) | ||
24 | AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], | ||
25 | [Define to the type that is the result of default argument promotions of type mode_t.]) | ||
26 | ]) | ||
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4 index cd137c9..a9b4edb 100644 --- a/gl/m4/mountlist.m4 +++ b/gl/m4/mountlist.m4 | |||
@@ -1,19 +1,338 @@ | |||
1 | # serial 11 | 1 | # serial 15 |
2 | dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Jim Meyering. | ||
8 | |||
9 | AC_PREREQ([2.60]) | ||
10 | |||
7 | AC_DEFUN([gl_MOUNTLIST], | 11 | AC_DEFUN([gl_MOUNTLIST], |
8 | [ | 12 | [ |
9 | gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes], | 13 | AC_REQUIRE([AC_CANONICAL_HOST]) |
10 | [gl_cv_list_mounted_fs=no]) | 14 | AC_CHECK_FUNCS([listmntent]) |
15 | AC_CHECK_HEADERS_ONCE([sys/param.h sys/statvfs.h]) | ||
16 | |||
17 | # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses | ||
18 | # NGROUPS (as the array dimension for a struct member) without a definition. | ||
19 | AC_CHECK_HEADERS([sys/ucred.h], [], [], [#include <grp.h>]) | ||
20 | |||
21 | AC_CHECK_HEADERS([sys/mount.h], [], [], | ||
22 | [AC_INCLUDES_DEFAULT | ||
23 | [#if HAVE_SYS_PARAM_H | ||
24 | #include <sys/param.h> | ||
25 | #endif | ||
26 | ]]) | ||
27 | |||
28 | AC_CHECK_HEADERS([mntent.h sys/fs_types.h]) | ||
29 | getfsstat_includes="\ | ||
30 | $ac_includes_default | ||
31 | #if HAVE_SYS_PARAM_H | ||
32 | # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
33 | #endif | ||
34 | #if HAVE_SYS_UCRED_H | ||
35 | # include <grp.h> /* needed for definition of NGROUPS */ | ||
36 | # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
37 | #endif | ||
38 | #if HAVE_SYS_MOUNT_H | ||
39 | # include <sys/mount.h> | ||
40 | #endif | ||
41 | #if HAVE_SYS_FS_TYPES_H | ||
42 | # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
43 | #endif | ||
44 | " | ||
45 | AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) | ||
46 | |||
47 | # Determine how to get the list of mounted file systems. | ||
48 | ac_list_mounted_fs= | ||
49 | |||
50 | # If the getmntent function is available but not in the standard library, | ||
51 | # make sure LIBS contains the appropriate -l option. | ||
52 | AC_FUNC_GETMNTENT | ||
53 | |||
54 | if test -z "$ac_list_mounted_fs"; then | ||
55 | # AIX. | ||
56 | AC_CACHE_CHECK([for mntctl function and struct vmount], | ||
57 | [fu_cv_sys_mounted_vmount], | ||
58 | [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])], | ||
59 | [fu_cv_sys_mounted_vmount=yes], | ||
60 | [fu_cv_sys_mounted_vmount=no])]) | ||
61 | if test $fu_cv_sys_mounted_vmount = yes; then | ||
62 | ac_list_mounted_fs=found | ||
63 | AC_DEFINE([MOUNTED_VMOUNT], [1], | ||
64 | [Define if there is a function named mntctl that can be used to read | ||
65 | the list of mounted file systems, and there is a system header file | ||
66 | that declares 'struct vmount'. (AIX)]) | ||
67 | fi | ||
68 | fi | ||
69 | |||
70 | if test $ac_cv_func_getmntent = yes; then | ||
71 | |||
72 | # This system has the getmntent function. | ||
73 | # Determine whether it's the one-argument variant or the two-argument one. | ||
74 | |||
75 | if test -z "$ac_list_mounted_fs"; then | ||
76 | # glibc, HP-UX, IRIX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS. | ||
77 | AC_CACHE_CHECK([for one-argument getmntent function], | ||
78 | [fu_cv_sys_mounted_getmntent1], | ||
79 | [AC_COMPILE_IFELSE( | ||
80 | [AC_LANG_PROGRAM([[ | ||
81 | /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ | ||
82 | #include <stdio.h> | ||
83 | |||
84 | #include <mntent.h> | ||
85 | #if defined __ANDROID__ /* Android */ | ||
86 | # undef MOUNTED | ||
87 | # define MOUNTED "/proc/mounts" | ||
88 | #elif !defined MOUNTED | ||
89 | # if defined _PATH_MOUNTED /* GNU libc */ | ||
90 | # define MOUNTED _PATH_MOUNTED | ||
91 | # endif | ||
92 | # if defined MNT_MNTTAB /* HP-UX. */ | ||
93 | # define MOUNTED MNT_MNTTAB | ||
94 | # endif | ||
95 | #endif | ||
96 | ]], | ||
97 | [[struct mntent *mnt = 0; char *table = MOUNTED; | ||
98 | if (sizeof mnt && sizeof table) return 0; | ||
99 | ]])], | ||
100 | [fu_cv_sys_mounted_getmntent1=yes], | ||
101 | [fu_cv_sys_mounted_getmntent1=no]) | ||
102 | ]) | ||
103 | if test $fu_cv_sys_mounted_getmntent1 = yes; then | ||
104 | ac_list_mounted_fs=found | ||
105 | AC_DEFINE([MOUNTED_GETMNTENT1], [1], | ||
106 | [Define if there is a function named getmntent for reading the list | ||
107 | of mounted file systems, and that function takes a single argument. | ||
108 | (4.3BSD, SunOS, HP-UX, Irix)]) | ||
109 | AC_CHECK_FUNCS([setmntent endmntent hasmntopt]) | ||
110 | fi | ||
111 | fi | ||
112 | |||
113 | if test -z "$ac_list_mounted_fs"; then | ||
114 | # Solaris >= 8. | ||
115 | AC_CACHE_CHECK([for getextmntent function], | ||
116 | [fu_cv_sys_mounted_getextmntent], | ||
117 | [AC_EGREP_HEADER([getextmntent], [sys/mnttab.h], | ||
118 | [fu_cv_sys_mounted_getextmntent=yes], | ||
119 | [fu_cv_sys_mounted_getextmntent=no])]) | ||
120 | if test $fu_cv_sys_mounted_getextmntent = yes; then | ||
121 | ac_list_mounted_fs=found | ||
122 | AC_DEFINE([MOUNTED_GETEXTMNTENT], [1], | ||
123 | [Define if there is a function named getextmntent for reading the list | ||
124 | of mounted file systems. (Solaris)]) | ||
125 | fi | ||
126 | fi | ||
127 | |||
128 | if test -z "$ac_list_mounted_fs"; then | ||
129 | # Solaris < 8, also (obsolete) SVR4. | ||
130 | # Solaris >= 8 has the two-argument getmntent but is already handled above. | ||
131 | AC_CACHE_CHECK([for two-argument getmntent function], | ||
132 | [fu_cv_sys_mounted_getmntent2], | ||
133 | [AC_EGREP_HEADER([getmntent], [sys/mnttab.h], | ||
134 | [fu_cv_sys_mounted_getmntent2=yes], | ||
135 | [fu_cv_sys_mounted_getmntent2=no]) | ||
136 | ]) | ||
137 | if test $fu_cv_sys_mounted_getmntent2 = yes; then | ||
138 | ac_list_mounted_fs=found | ||
139 | AC_DEFINE([MOUNTED_GETMNTENT2], [1], | ||
140 | [Define if there is a function named getmntent for reading the list of | ||
141 | mounted file systems, and that function takes two arguments. (SVR4)]) | ||
142 | AC_CHECK_FUNCS([hasmntopt]) | ||
143 | fi | ||
144 | fi | ||
145 | |||
146 | fi | ||
147 | |||
148 | if test -z "$ac_list_mounted_fs"; then | ||
149 | # OSF/1, also (obsolete) Apple Darwin 1.3. | ||
150 | # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h | ||
151 | |||
152 | AC_CACHE_CHECK([for getfsstat function], | ||
153 | [fu_cv_sys_mounted_getfsstat], | ||
154 | [AC_LINK_IFELSE( | ||
155 | [AC_LANG_PROGRAM([[ | ||
156 | #include <sys/types.h> | ||
157 | #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME | ||
158 | # define FS_TYPE(Ent) ((Ent).f_fstypename) | ||
159 | #else | ||
160 | # define FS_TYPE(Ent) mnt_names[(Ent).f_type] | ||
161 | #endif | ||
162 | $getfsstat_includes | ||
163 | ]], | ||
164 | [[struct statfs *stats; | ||
165 | int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); | ||
166 | char *t = FS_TYPE (*stats); | ||
167 | ]])], | ||
168 | [fu_cv_sys_mounted_getfsstat=yes], | ||
169 | [fu_cv_sys_mounted_getfsstat=no]) | ||
170 | ]) | ||
171 | if test $fu_cv_sys_mounted_getfsstat = yes; then | ||
172 | ac_list_mounted_fs=found | ||
173 | AC_DEFINE([MOUNTED_GETFSSTAT], [1], | ||
174 | [Define if there is a function named getfsstat for reading the | ||
175 | list of mounted file systems. (DEC Alpha running OSF/1)]) | ||
176 | fi | ||
177 | fi | ||
178 | |||
179 | if test -z "$ac_list_mounted_fs"; then | ||
180 | # (obsolete) SVR3 | ||
181 | AC_CACHE_CHECK([for FIXME existence of three headers], | ||
182 | [fu_cv_sys_mounted_fread_fstyp], | ||
183 | [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ | ||
184 | #include <sys/statfs.h> | ||
185 | #include <sys/fstyp.h> | ||
186 | #include <mnttab.h> | ||
187 | ]])], | ||
188 | [fu_cv_sys_mounted_fread_fstyp=yes], | ||
189 | [fu_cv_sys_mounted_fread_fstyp=no]) | ||
190 | ]) | ||
191 | if test $fu_cv_sys_mounted_fread_fstyp = yes; then | ||
192 | ac_list_mounted_fs=found | ||
193 | AC_DEFINE([MOUNTED_FREAD_FSTYP], [1], | ||
194 | [Define if (like SVR2) there is no specific function for reading the | ||
195 | list of mounted file systems, and your system has these header files: | ||
196 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) | ||
197 | fi | ||
198 | fi | ||
199 | |||
200 | if test -z "$ac_list_mounted_fs"; then | ||
201 | # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD. | ||
202 | # OSF/1 also has getmntinfo but is already handled above. | ||
203 | # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker | ||
204 | # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64 | ||
205 | # on Mac OS X, __getmntinfo13 on NetBSD and Minix, _F64_getmntinfo on OSF/1. | ||
206 | AC_CACHE_CHECK([for getmntinfo function], | ||
207 | [fu_cv_sys_mounted_getmntinfo], | ||
208 | [AC_LINK_IFELSE( | ||
209 | [AC_LANG_PROGRAM([[ | ||
210 | #if HAVE_SYS_PARAM_H | ||
211 | # include <sys/param.h> | ||
212 | #endif | ||
213 | #include <sys/types.h> | ||
214 | #if HAVE_SYS_MOUNT_H | ||
215 | # include <sys/mount.h> | ||
216 | #endif | ||
217 | #if HAVE_SYS_STATVFS_H | ||
218 | # include <sys/statvfs.h> | ||
219 | #endif | ||
220 | #include <stdlib.h> | ||
221 | ]], | ||
222 | [[int count = getmntinfo (NULL, MNT_WAIT); | ||
223 | ]])], | ||
224 | [fu_cv_sys_mounted_getmntinfo=yes], | ||
225 | [fu_cv_sys_mounted_getmntinfo=no]) | ||
226 | ]) | ||
227 | if test $fu_cv_sys_mounted_getmntinfo = yes; then | ||
228 | AC_CACHE_CHECK([whether getmntinfo returns statvfs structures], | ||
229 | [fu_cv_sys_mounted_getmntinfo2], | ||
230 | [AC_COMPILE_IFELSE( | ||
231 | [AC_LANG_PROGRAM([[ | ||
232 | #if HAVE_SYS_PARAM_H | ||
233 | # include <sys/param.h> | ||
234 | #endif | ||
235 | #include <sys/types.h> | ||
236 | #if HAVE_SYS_MOUNT_H | ||
237 | # include <sys/mount.h> | ||
238 | #endif | ||
239 | #if HAVE_SYS_STATVFS_H | ||
240 | # include <sys/statvfs.h> | ||
241 | #endif | ||
242 | extern | ||
243 | #ifdef __cplusplus | ||
244 | "C" | ||
245 | #endif | ||
246 | int getmntinfo (struct statfs **, int); | ||
247 | ]], [[]])], | ||
248 | [fu_cv_sys_mounted_getmntinfo2=no], | ||
249 | [fu_cv_sys_mounted_getmntinfo2=yes]) | ||
250 | ]) | ||
251 | if test $fu_cv_sys_mounted_getmntinfo2 = no; then | ||
252 | # Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD. | ||
253 | ac_list_mounted_fs=found | ||
254 | AC_DEFINE([MOUNTED_GETMNTINFO], [1], | ||
255 | [Define if there is a function named getmntinfo for reading the | ||
256 | list of mounted file systems and it returns an array of | ||
257 | 'struct statfs'. (4.4BSD, Darwin)]) | ||
258 | else | ||
259 | # NetBSD, Minix. | ||
260 | ac_list_mounted_fs=found | ||
261 | AC_DEFINE([MOUNTED_GETMNTINFO2], [1], | ||
262 | [Define if there is a function named getmntinfo for reading the | ||
263 | list of mounted file systems and it returns an array of | ||
264 | 'struct statvfs'. (NetBSD 3.0)]) | ||
265 | fi | ||
266 | fi | ||
267 | fi | ||
268 | |||
269 | if test -z "$ac_list_mounted_fs"; then | ||
270 | # Haiku, also (obsolete) BeOS. | ||
271 | AC_CHECK_FUNCS([next_dev fs_stat_dev]) | ||
272 | AC_CHECK_HEADERS([fs_info.h]) | ||
273 | AC_CACHE_CHECK([for BEOS mounted file system support functions], | ||
274 | [fu_cv_sys_mounted_fs_stat_dev], | ||
275 | [if test $ac_cv_header_fs_info_h = yes \ | ||
276 | && test $ac_cv_func_next_dev = yes \ | ||
277 | && test $ac_cv_func_fs_stat_dev = yes; then | ||
278 | fu_cv_sys_mounted_fs_stat_dev=yes | ||
279 | else | ||
280 | fu_cv_sys_mounted_fs_stat_dev=no | ||
281 | fi | ||
282 | ]) | ||
283 | if test $fu_cv_sys_mounted_fs_stat_dev = yes; then | ||
284 | ac_list_mounted_fs=found | ||
285 | AC_DEFINE([MOUNTED_FS_STAT_DEV], [1], | ||
286 | [Define if there are functions named next_dev and fs_stat_dev for | ||
287 | reading the list of mounted file systems. (BeOS)]) | ||
288 | fi | ||
289 | fi | ||
290 | |||
291 | if test -z "$ac_list_mounted_fs"; then | ||
292 | # Interix / BSD alike statvfs | ||
293 | # the code is really interix specific, so make sure, we're on it. | ||
294 | case "$host" in | ||
295 | *-interix*) | ||
296 | AC_CHECK_FUNCS([statvfs]) | ||
297 | if test $ac_cv_func_statvfs = yes; then | ||
298 | ac_list_mounted_fs=found | ||
299 | AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1], | ||
300 | [Define if we are on interix, and ought to use statvfs plus | ||
301 | some special knowledge on where mounted file systems can be | ||
302 | found. (Interix)]) | ||
303 | fi | ||
304 | ;; | ||
305 | esac | ||
306 | fi | ||
307 | |||
308 | if test -z "$ac_list_mounted_fs"; then | ||
309 | AC_MSG_ERROR([could not determine how to read list of mounted file systems]) | ||
310 | # FIXME -- no need to abort building the whole package | ||
311 | # Can't build mountlist.c or anything that needs its functions | ||
312 | fi | ||
313 | |||
314 | if test $ac_list_mounted_fs = found; then | ||
315 | gl_cv_list_mounted_fs=yes | ||
316 | else | ||
317 | gl_cv_list_mounted_fs=no | ||
318 | fi | ||
11 | ]) | 319 | ]) |
12 | 320 | ||
13 | # Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS. | 321 | # Prerequisites of lib/mountlist.c not done by gl_MOUNTLIST. |
14 | AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], | 322 | AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], |
15 | [ | 323 | [ |
16 | dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h. | 324 | dnl Note gl_MOUNTLIST checks for mntent.h, not sys/mntent.h. |
17 | AC_CHECK_HEADERS([sys/mntent.h]) | 325 | AC_CHECK_HEADERS([sys/mntent.h]) |
326 | AC_HEADER_MAJOR()dnl for use of makedev () | ||
18 | gl_FSTYPENAME | 327 | gl_FSTYPENAME |
19 | ]) | 328 | ]) |
329 | |||
330 | # Replace Autoconf's AC_FUNC_GETMNTENT to omit checks that are unnecessary | ||
331 | # nowadays. | ||
332 | AC_DEFUN([AC_FUNC_GETMNTENT], | ||
333 | [ | ||
334 | # getmntent is in the standard C library on most systems, but in -lgen on | ||
335 | # Unixware. | ||
336 | AC_SEARCH_LIBS([getmntent], [gen]) | ||
337 | AC_CHECK_FUNCS([getmntent]) | ||
338 | ]) | ||
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4 index 9a6a47a..8d9d21b 100644 --- a/gl/m4/msvc-inval.m4 +++ b/gl/m4/msvc-inval.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # msvc-inval.m4 serial 1 | 1 | # msvc-inval.m4 serial 1 |
2 | dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4 index a39618a..0263e49 100644 --- a/gl/m4/msvc-nothrow.m4 +++ b/gl/m4/msvc-nothrow.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # msvc-nothrow.m4 serial 1 | 1 | # msvc-nothrow.m4 serial 1 |
2 | dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 552ec7e..3ba5b0f 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # multiarch.m4 serial 7 | 1 | # multiarch.m4 serial 9 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -21,37 +21,40 @@ dnl with or without modifications, as long as this notice is preserved. | |||
21 | AC_DEFUN_ONCE([gl_MULTIARCH], | 21 | AC_DEFUN_ONCE([gl_MULTIARCH], |
22 | [ | 22 | [ |
23 | dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. | 23 | dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. |
24 | gl_cv_c_multiarch=no | 24 | AC_CACHE_CHECK([whether the compiler produces multi-arch binaries], |
25 | AC_COMPILE_IFELSE( | 25 | [gl_cv_c_multiarch], |
26 | [AC_LANG_SOURCE( | 26 | [gl_cv_c_multiarch=no |
27 | [[#ifndef __APPLE_CC__ | 27 | AC_COMPILE_IFELSE( |
28 | not a universal capable compiler | 28 | [AC_LANG_SOURCE( |
29 | #endif | 29 | [[#ifndef __APPLE_CC__ |
30 | typedef int dummy; | 30 | not a universal capable compiler |
31 | ]])], | 31 | #endif |
32 | [ | 32 | typedef int dummy; |
33 | dnl Check for potential -arch flags. It is not universal unless | 33 | ]])], |
34 | dnl there are at least two -arch flags with different values. | 34 | [ |
35 | arch= | 35 | dnl Check for potential -arch flags. It is not universal unless |
36 | prev= | 36 | dnl there are at least two -arch flags with different values. |
37 | for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do | 37 | arch= |
38 | if test -n "$prev"; then | 38 | prev= |
39 | case $word in | 39 | for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do |
40 | i?86 | x86_64 | ppc | ppc64) | 40 | if test -n "$prev"; then |
41 | if test -z "$arch" || test "$arch" = "$word"; then | 41 | case $word in |
42 | arch="$word" | 42 | i?86 | x86_64 | ppc | ppc64 | arm | arm64) |
43 | else | 43 | if test -z "$arch" || test "$arch" = "$word"; then |
44 | gl_cv_c_multiarch=yes | 44 | arch="$word" |
45 | fi | 45 | else |
46 | ;; | 46 | gl_cv_c_multiarch=yes |
47 | esac | 47 | fi |
48 | prev= | 48 | ;; |
49 | else | 49 | esac |
50 | if test "x$word" = "x-arch"; then | 50 | prev= |
51 | prev=arch | 51 | else |
52 | fi | 52 | if test "x$word" = "x-arch"; then |
53 | fi | 53 | prev=arch |
54 | done | 54 | fi |
55 | fi | ||
56 | done | ||
57 | ]) | ||
55 | ]) | 58 | ]) |
56 | if test $gl_cv_c_multiarch = yes; then | 59 | if test $gl_cv_c_multiarch = yes; then |
57 | APPLE_UNIVERSAL_BUILD=1 | 60 | APPLE_UNIVERSAL_BUILD=1 |
diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index 2c69f99..e6aa892 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 | |||
@@ -1,10 +1,10 @@ | |||
1 | # netdb_h.m4 serial 11 | 1 | # netdb_h.m4 serial 15 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_HEADER_NETDB], | 7 | AC_DEFUN_ONCE([gl_NETDB_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) |
10 | gl_CHECK_NEXT_HEADERS([netdb.h]) | 10 | gl_CHECK_NEXT_HEADERS([netdb.h]) |
@@ -21,18 +21,33 @@ AC_DEFUN([gl_HEADER_NETDB], | |||
21 | [getaddrinfo freeaddrinfo gai_strerror getnameinfo]) | 21 | [getaddrinfo freeaddrinfo gai_strerror getnameinfo]) |
22 | ]) | 22 | ]) |
23 | 23 | ||
24 | # gl_NETDB_MODULE_INDICATOR([modulename]) | ||
25 | # sets the shell variable that indicates the presence of the given module | ||
26 | # to a C preprocessor expression that will evaluate to 1. | ||
27 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
24 | AC_DEFUN([gl_NETDB_MODULE_INDICATOR], | 28 | AC_DEFUN([gl_NETDB_MODULE_INDICATOR], |
25 | [ | 29 | [ |
26 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 30 | dnl Ensure to expand the default settings once only. |
27 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) | 31 | gl_NETDB_H_REQUIRE_DEFAULTS |
28 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 32 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
29 | dnl Define it also as a C macro, for the benefit of the unit tests. | 33 | dnl Define it also as a C macro, for the benefit of the unit tests. |
30 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 34 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
31 | ]) | 35 | ]) |
32 | 36 | ||
37 | # Initializes the default values for AC_SUBSTed shell variables. | ||
38 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
39 | # outside of macros or in macros that are not AC_REQUIREd. | ||
40 | AC_DEFUN([gl_NETDB_H_REQUIRE_DEFAULTS], | ||
41 | [ | ||
42 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS], [ | ||
43 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETADDRINFO]) | ||
44 | ]) | ||
45 | m4_require(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS]) | ||
46 | AC_REQUIRE([gl_NETDB_H_DEFAULTS]) | ||
47 | ]) | ||
48 | |||
33 | AC_DEFUN([gl_NETDB_H_DEFAULTS], | 49 | AC_DEFUN([gl_NETDB_H_DEFAULTS], |
34 | [ | 50 | [ |
35 | GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO]) | ||
36 | dnl Assume proper GNU behavior unless another module says otherwise. | 51 | dnl Assume proper GNU behavior unless another module says otherwise. |
37 | HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO]) | 52 | HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO]) |
38 | HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO]) | 53 | HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO]) |
@@ -40,4 +55,5 @@ AC_DEFUN([gl_NETDB_H_DEFAULTS], | |||
40 | HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) | 55 | HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) |
41 | HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) | 56 | HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) |
42 | REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR]) | 57 | REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR]) |
58 | REPLACE_GETADDRINFO=0; AC_SUBST([REPLACE_GETADDRINFO]) | ||
43 | ]) | 59 | ]) |
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index 21971b2..7115419 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # netinet_in_h.m4 serial 5 | 1 | # netinet_in_h.m4 serial 6 |
2 | dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -14,9 +14,9 @@ AC_DEFUN([gl_HEADER_NETINET_IN], | |||
14 | [gl_cv_header_netinet_in_h_selfcontained=no]) | 14 | [gl_cv_header_netinet_in_h_selfcontained=no]) |
15 | ]) | 15 | ]) |
16 | if test $gl_cv_header_netinet_in_h_selfcontained = yes; then | 16 | if test $gl_cv_header_netinet_in_h_selfcontained = yes; then |
17 | NETINET_IN_H='' | 17 | GL_GENERATE_NETINET_IN_H=false |
18 | else | 18 | else |
19 | NETINET_IN_H='netinet/in.h' | 19 | GL_GENERATE_NETINET_IN_H=true |
20 | AC_CHECK_HEADERS([netinet/in.h]) | 20 | AC_CHECK_HEADERS([netinet/in.h]) |
21 | gl_CHECK_NEXT_HEADERS([netinet/in.h]) | 21 | gl_CHECK_NEXT_HEADERS([netinet/in.h]) |
22 | if test $ac_cv_header_netinet_in_h = yes; then | 22 | if test $ac_cv_header_netinet_in_h = yes; then |
@@ -26,6 +26,4 @@ AC_DEFUN([gl_HEADER_NETINET_IN], | |||
26 | fi | 26 | fi |
27 | AC_SUBST([HAVE_NETINET_IN_H]) | 27 | AC_SUBST([HAVE_NETINET_IN_H]) |
28 | fi | 28 | fi |
29 | AC_SUBST([NETINET_IN_H]) | ||
30 | AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"]) | ||
31 | ]) | 29 | ]) |
diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4 index 25e2101..51e783c 100644 --- a/gl/m4/nl_langinfo.m4 +++ b/gl/m4/nl_langinfo.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # nl_langinfo.m4 serial 5 | 1 | # nl_langinfo.m4 serial 8 |
2 | dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -9,7 +9,10 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
9 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) |
10 | AC_REQUIRE([gl_LANGINFO_H]) | 10 | AC_REQUIRE([gl_LANGINFO_H]) |
11 | AC_CHECK_FUNCS_ONCE([nl_langinfo]) | 11 | AC_CHECK_FUNCS_ONCE([nl_langinfo]) |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) | ||
14 | AC_REQUIRE([gl_PTHREADLIB]) | ||
15 | AC_CHECK_HEADERS_ONCE([threads.h]) | ||
13 | if test $ac_cv_func_nl_langinfo = yes; then | 16 | if test $ac_cv_func_nl_langinfo = yes; then |
14 | # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. | 17 | # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. |
15 | AC_CACHE_CHECK([whether YESEXPR works], | 18 | AC_CACHE_CHECK([whether YESEXPR works], |
@@ -36,8 +39,19 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
36 | AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], | 39 | AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], |
37 | [$FUNC_NL_LANGINFO_YESEXPR_WORKS], | 40 | [$FUNC_NL_LANGINFO_YESEXPR_WORKS], |
38 | [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) | 41 | [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) |
39 | if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1 \ | 42 | # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. |
40 | && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then | 43 | case "$host_os" in |
44 | solaris*) NL_LANGINFO_MTSAFE=0 ;; | ||
45 | *) NL_LANGINFO_MTSAFE=1 ;; | ||
46 | esac | ||
47 | AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], | ||
48 | [Define to 1 if nl_langinfo is multithread-safe.]) | ||
49 | if test $HAVE_LANGINFO_CODESET = 1 \ | ||
50 | && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ | ||
51 | && test $HAVE_LANGINFO_ALTMON = 1 \ | ||
52 | && test $HAVE_LANGINFO_ERA = 1 \ | ||
53 | && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ | ||
54 | && test $NL_LANGINFO_MTSAFE = 1; then | ||
41 | : | 55 | : |
42 | else | 56 | else |
43 | REPLACE_NL_LANGINFO=1 | 57 | REPLACE_NL_LANGINFO=1 |
@@ -47,4 +61,17 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], | |||
47 | else | 61 | else |
48 | HAVE_NL_LANGINFO=0 | 62 | HAVE_NL_LANGINFO=0 |
49 | fi | 63 | fi |
64 | if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then | ||
65 | LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" | ||
66 | else | ||
67 | LIB_NL_LANGINFO= | ||
68 | fi | ||
69 | dnl LIB_NL_LANGINFO is expected to be empty everywhere. | ||
70 | AC_SUBST([LIB_NL_LANGINFO]) | ||
71 | ]) | ||
72 | |||
73 | # Prerequisites of lib/nl_langinfo-lock.c. | ||
74 | AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK], | ||
75 | [ | ||
76 | gl_VISIBILITY | ||
50 | ]) | 77 | ]) |
diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4 index 8f8a147..6572448 100644 --- a/gl/m4/nls.m4 +++ b/gl/m4/nls.m4 | |||
@@ -1,17 +1,17 @@ | |||
1 | # nls.m4 serial 5 (gettext-0.18) | 1 | # nls.m4 serial 6 (gettext-0.20.2) |
2 | dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation, | 2 | dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2023 Free |
3 | dnl Inc. | 3 | dnl 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 | 7 | dnl |
8 | dnl This file can can be used in projects which are not available under | 8 | dnl This file can be used in projects which are not available under |
9 | dnl the GNU General Public License or the GNU Library General Public | 9 | dnl the GNU General Public License or the GNU Lesser General Public |
10 | dnl License but which still want to provide support for the GNU gettext | 10 | dnl License but which still want to provide support for the GNU gettext |
11 | dnl functionality. | 11 | dnl functionality. |
12 | dnl Please note that the actual code of the GNU gettext library is covered | 12 | dnl Please note that the actual code of the GNU gettext library is covered |
13 | dnl by the GNU Library General Public License, and the rest of the GNU | 13 | dnl by the GNU Lesser General Public License, and the rest of the GNU |
14 | dnl gettext package package is covered by the GNU General Public License. | 14 | dnl gettext package is covered by the GNU General Public License. |
15 | dnl They are *not* in the public domain. | 15 | dnl They are *not* in the public domain. |
16 | 16 | ||
17 | dnl Authors: | 17 | dnl Authors: |
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4 index 105b884..6a76638 100644 --- a/gl/m4/nocrash.m4 +++ b/gl/m4/nocrash.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # nocrash.m4 serial 4 | 1 | # nocrash.m4 serial 5 |
2 | dnl Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -53,7 +53,7 @@ nocrash_init (void) | |||
53 | /* Allocate a port on which the thread shall listen for exceptions. */ | 53 | /* Allocate a port on which the thread shall listen for exceptions. */ |
54 | if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) | 54 | if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) |
55 | == KERN_SUCCESS) { | 55 | == KERN_SUCCESS) { |
56 | /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ | 56 | /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ |
57 | if (mach_port_insert_right (self, our_exception_port, our_exception_port, | 57 | if (mach_port_insert_right (self, our_exception_port, our_exception_port, |
58 | MACH_MSG_TYPE_MAKE_SEND) | 58 | MACH_MSG_TYPE_MAKE_SEND) |
59 | == KERN_SUCCESS) { | 59 | == KERN_SUCCESS) { |
@@ -72,14 +72,14 @@ nocrash_init (void) | |||
72 | for a particular thread. This has the effect that when our exception | 72 | for a particular thread. This has the effect that when our exception |
73 | port gets the message, the thread specific exception port has already | 73 | port gets the message, the thread specific exception port has already |
74 | been asked, and we don't need to bother about it. | 74 | been asked, and we don't need to bother about it. |
75 | See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ | 75 | See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ |
76 | task_set_exception_ports (self, mask, our_exception_port, | 76 | task_set_exception_ports (self, mask, our_exception_port, |
77 | EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); | 77 | EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } |
82 | #elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 82 | #elif defined _WIN32 && ! defined __CYGWIN__ |
83 | /* Avoid a crash on native Windows. */ | 83 | /* Avoid a crash on native Windows. */ |
84 | #define WIN32_LEAN_AND_MEAN | 84 | #define WIN32_LEAN_AND_MEAN |
85 | #include <windows.h> | 85 | #include <windows.h> |
@@ -110,11 +110,12 @@ nocrash_init (void) | |||
110 | #else | 110 | #else |
111 | /* Avoid a crash on POSIX systems. */ | 111 | /* Avoid a crash on POSIX systems. */ |
112 | #include <signal.h> | 112 | #include <signal.h> |
113 | #include <unistd.h> | ||
113 | /* A POSIX signal handler. */ | 114 | /* A POSIX signal handler. */ |
114 | static void | 115 | static void |
115 | exception_handler (int sig) | 116 | exception_handler (int sig) |
116 | { | 117 | { |
117 | exit (1); | 118 | _exit (1); |
118 | } | 119 | } |
119 | static void | 120 | static void |
120 | nocrash_init (void) | 121 | nocrash_init (void) |
diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4 index d355d01..880f347 100644 --- a/gl/m4/off_t.m4 +++ b/gl/m4/off_t.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # off_t.m4 serial 1 | 1 | # off_t.m4 serial 1 |
2 | dnl Copyright (C) 2012-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/onceonly.m4 b/gl/m4/onceonly.m4 deleted file mode 100644 index 0a875a3..0000000 --- a/gl/m4/onceonly.m4 +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | # onceonly.m4 serial 9 | ||
2 | dnl Copyright (C) 2002-2003, 2005-2006, 2008-2013 Free Software Foundation, | ||
3 | dnl Inc. | ||
4 | dnl | ||
5 | dnl This file is free software; you can redistribute it and/or modify | ||
6 | dnl it under the terms of the GNU General Public License as published by | ||
7 | dnl the Free Software Foundation; either version 3 of the License, or | ||
8 | dnl (at your option) any later version. | ||
9 | dnl | ||
10 | dnl This file is distributed in the hope that it will be useful, | ||
11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | dnl GNU General Public License for more details. | ||
14 | dnl | ||
15 | dnl You should have received a copy of the GNU General Public License | ||
16 | dnl along with this file. If not, see <http://www.gnu.org/licenses/>. | ||
17 | dnl | ||
18 | dnl As a special exception to the GNU General Public License, | ||
19 | dnl this file may be distributed as part of a program | ||
20 | dnl that contains a configuration script generated by Autoconf, under | ||
21 | dnl the same distribution terms as the rest of that program. | ||
22 | |||
23 | dnl This file defines some "once only" variants of standard autoconf macros. | ||
24 | dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS | ||
25 | dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS | ||
26 | dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS | ||
27 | dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL | ||
28 | dnl The advantage is that the check for each of the headers/functions/decls | ||
29 | dnl will be put only once into the 'configure' file. It keeps the size of | ||
30 | dnl the 'configure' file down, and avoids redundant output when 'configure' | ||
31 | dnl is run. | ||
32 | dnl The drawback is that the checks cannot be conditionalized. If you write | ||
33 | dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi | ||
34 | dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to | ||
35 | dnl empty, and the check will be inserted before the body of the AC_DEFUNed | ||
36 | dnl function. | ||
37 | |||
38 | dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE | ||
39 | dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to | ||
40 | dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested | ||
41 | dnl headers at once, thus reducing the size of 'configure'. It is known to work | ||
42 | dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%. | ||
43 | |||
44 | dnl Autoconf version 2.59 plus gnulib is required; this file is not needed | ||
45 | dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of | ||
46 | dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first | ||
47 | dnl argument! | ||
48 | AC_PREREQ([2.59]) | ||
49 | |||
50 | # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of | ||
51 | # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). | ||
52 | AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ | ||
53 | : | ||
54 | m4_foreach_w([gl_HEADER_NAME], [$1], [ | ||
55 | AC_DEFUN([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, | ||
56 | [./-], [___])), [ | ||
57 | m4_divert_text([INIT_PREPARE], | ||
58 | [gl_header_list="$gl_header_list gl_HEADER_NAME"]) | ||
59 | gl_HEADERS_EXPANSION | ||
60 | AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), | ||
61 | [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) | ||
62 | ]) | ||
63 | AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, | ||
64 | [./-], [___]))) | ||
65 | ]) | ||
66 | ]) | ||
67 | m4_define([gl_HEADERS_EXPANSION], [ | ||
68 | m4_divert_text([DEFAULTS], [gl_header_list=]) | ||
69 | AC_CHECK_HEADERS([$gl_header_list]) | ||
70 | m4_define([gl_HEADERS_EXPANSION], []) | ||
71 | ]) | ||
72 | |||
73 | # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of | ||
74 | # AC_CHECK_FUNCS(FUNC1 FUNC2 ...). | ||
75 | AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ | ||
76 | : | ||
77 | m4_foreach_w([gl_FUNC_NAME], [$1], [ | ||
78 | AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ | ||
79 | m4_divert_text([INIT_PREPARE], | ||
80 | [gl_func_list="$gl_func_list gl_FUNC_NAME"]) | ||
81 | gl_FUNCS_EXPANSION | ||
82 | AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), | ||
83 | [Define to 1 if you have the ']m4_defn([gl_FUNC_NAME])[' function.]) | ||
84 | ]) | ||
85 | AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) | ||
86 | ]) | ||
87 | ]) | ||
88 | m4_define([gl_FUNCS_EXPANSION], [ | ||
89 | m4_divert_text([DEFAULTS], [gl_func_list=]) | ||
90 | AC_CHECK_FUNCS([$gl_func_list]) | ||
91 | m4_define([gl_FUNCS_EXPANSION], []) | ||
92 | ]) | ||
93 | |||
94 | # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of | ||
95 | # AC_CHECK_DECLS(DECL1, DECL2, ...). | ||
96 | AC_DEFUN([AC_CHECK_DECLS_ONCE], [ | ||
97 | : | ||
98 | m4_foreach_w([gl_DECL_NAME], [$1], [ | ||
99 | AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ | ||
100 | AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) | ||
101 | ]) | ||
102 | AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) | ||
103 | ]) | ||
104 | ]) | ||
diff --git a/gl/m4/open-cloexec.m4 b/gl/m4/open-cloexec.m4 new file mode 100644 index 0000000..fd572fc --- /dev/null +++ b/gl/m4/open-cloexec.m4 | |||
@@ -0,0 +1,21 @@ | |||
1 | # Test whether O_CLOEXEC is defined. | ||
2 | |||
3 | dnl Copyright 2017-2023 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 | |||
8 | AC_DEFUN([gl_PREPROC_O_CLOEXEC], | ||
9 | [ | ||
10 | AC_CACHE_CHECK([for O_CLOEXEC], | ||
11 | [gl_cv_macro_O_CLOEXEC], | ||
12 | [AC_COMPILE_IFELSE( | ||
13 | [AC_LANG_PROGRAM([[#include <fcntl.h> | ||
14 | #ifndef O_CLOEXEC | ||
15 | choke me; | ||
16 | #endif | ||
17 | ]], | ||
18 | [[return O_CLOEXEC;]])], | ||
19 | [gl_cv_macro_O_CLOEXEC=yes], | ||
20 | [gl_cv_macro_O_CLOEXEC=no])]) | ||
21 | ]) | ||
diff --git a/gl/m4/open-slash.m4 b/gl/m4/open-slash.m4 new file mode 100644 index 0000000..1f731f8 --- /dev/null +++ b/gl/m4/open-slash.m4 | |||
@@ -0,0 +1,60 @@ | |||
1 | # open-slash.m4 serial 2 | ||
2 | dnl Copyright (C) 2007-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 Tests whether open() and creat() recognize a trailing slash. | ||
8 | dnl Sets gl_cv_func_open_slash. | ||
9 | AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG], | ||
10 | [ | ||
11 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
12 | dnl open("foo/") should not create a file when the file name has a | ||
13 | dnl trailing slash. FreeBSD only has the problem on symlinks. | ||
14 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
15 | AC_CACHE_CHECK([whether open recognizes a trailing slash], | ||
16 | [gl_cv_func_open_slash], | ||
17 | [# Assume that if we have lstat, we can also check symlinks. | ||
18 | if test $ac_cv_func_lstat = yes; then | ||
19 | touch conftest.tmp | ||
20 | ln -s conftest.tmp conftest.lnk | ||
21 | fi | ||
22 | AC_RUN_IFELSE( | ||
23 | [AC_LANG_SOURCE([[ | ||
24 | #include <fcntl.h> | ||
25 | #if HAVE_UNISTD_H | ||
26 | # include <unistd.h> | ||
27 | #endif | ||
28 | ]GL_MDA_DEFINES[ | ||
29 | int main () | ||
30 | { | ||
31 | int result = 0; | ||
32 | #if HAVE_LSTAT | ||
33 | if (open ("conftest.lnk/", O_RDONLY) != -1) | ||
34 | result |= 1; | ||
35 | #endif | ||
36 | if (open ("conftest.sl/", O_CREAT, 0600) >= 0) | ||
37 | result |= 2; | ||
38 | return result; | ||
39 | }]])], | ||
40 | [gl_cv_func_open_slash=yes], | ||
41 | [gl_cv_func_open_slash=no], | ||
42 | [ | ||
43 | changequote(,)dnl | ||
44 | case "$host_os" in | ||
45 | freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) | ||
46 | gl_cv_func_open_slash="guessing no" ;; | ||
47 | *) | ||
48 | gl_cv_func_open_slash="guessing yes" ;; | ||
49 | esac | ||
50 | changequote([,])dnl | ||
51 | ]) | ||
52 | rm -f conftest.sl conftest.tmp conftest.lnk | ||
53 | ]) | ||
54 | case "$gl_cv_func_open_slash" in | ||
55 | *no) | ||
56 | AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], | ||
57 | [Define to 1 if open() fails to recognize a trailing slash.]) | ||
58 | ;; | ||
59 | esac | ||
60 | ]) | ||
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 new file mode 100644 index 0000000..94fa2bb --- /dev/null +++ b/gl/m4/open.m4 | |||
@@ -0,0 +1,56 @@ | |||
1 | # open.m4 serial 15 | ||
2 | dnl Copyright (C) 2007-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_FUNC_OPEN], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
10 | AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) | ||
11 | case "$host_os" in | ||
12 | mingw* | pw*) | ||
13 | REPLACE_OPEN=1 | ||
14 | ;; | ||
15 | *) | ||
16 | dnl open("foo/") should not create a file when the file name has a | ||
17 | dnl trailing slash. FreeBSD only has the problem on symlinks. | ||
18 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
19 | if test "$gl_cv_macro_O_CLOEXEC" != yes; then | ||
20 | REPLACE_OPEN=1 | ||
21 | fi | ||
22 | gl_OPEN_TRAILING_SLASH_BUG | ||
23 | case "$gl_cv_func_open_slash" in | ||
24 | *no) | ||
25 | REPLACE_OPEN=1 | ||
26 | ;; | ||
27 | esac | ||
28 | ;; | ||
29 | esac | ||
30 | dnl Replace open() for supporting the gnulib-defined fchdir() function, | ||
31 | dnl to keep fchdir's bookkeeping up-to-date. | ||
32 | m4_ifdef([gl_FUNC_FCHDIR], [ | ||
33 | if test $REPLACE_OPEN = 0; then | ||
34 | gl_TEST_FCHDIR | ||
35 | if test $HAVE_FCHDIR = 0; then | ||
36 | REPLACE_OPEN=1 | ||
37 | fi | ||
38 | fi | ||
39 | ]) | ||
40 | dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. | ||
41 | m4_ifdef([gl_NONBLOCKING_IO], [ | ||
42 | if test $REPLACE_OPEN = 0; then | ||
43 | gl_NONBLOCKING_IO | ||
44 | if test $gl_cv_have_open_O_NONBLOCK != yes; then | ||
45 | REPLACE_OPEN=1 | ||
46 | fi | ||
47 | fi | ||
48 | ]) | ||
49 | ]) | ||
50 | |||
51 | # Prerequisites of lib/open.c. | ||
52 | AC_DEFUN([gl_PREREQ_OPEN], | ||
53 | [ | ||
54 | AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) | ||
55 | : | ||
56 | ]) | ||
diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4 new file mode 100644 index 0000000..6d47d2c --- /dev/null +++ b/gl/m4/pathmax.m4 | |||
@@ -0,0 +1,42 @@ | |||
1 | # pathmax.m4 serial 11 | ||
2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2023 Free Software Foundation, | ||
3 | dnl 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 | |||
8 | AC_DEFUN([gl_PATHMAX], | ||
9 | [ | ||
10 | dnl Prerequisites of lib/pathmax.h. | ||
11 | AC_CHECK_HEADERS_ONCE([sys/param.h]) | ||
12 | ]) | ||
13 | |||
14 | # Expands to a piece of C program that defines PATH_MAX in the same way as | ||
15 | # "pathmax.h" will do. | ||
16 | AC_DEFUN([gl_PATHMAX_SNIPPET], [[ | ||
17 | /* Arrange to define PATH_MAX, like "pathmax.h" does. */ | ||
18 | #if HAVE_UNISTD_H | ||
19 | # include <unistd.h> | ||
20 | #endif | ||
21 | #include <limits.h> | ||
22 | #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN | ||
23 | # include <sys/param.h> | ||
24 | #endif | ||
25 | #if !defined PATH_MAX && defined MAXPATHLEN | ||
26 | # define PATH_MAX MAXPATHLEN | ||
27 | #endif | ||
28 | #ifdef __hpux | ||
29 | # undef PATH_MAX | ||
30 | # define PATH_MAX 1024 | ||
31 | #endif | ||
32 | #if defined _WIN32 && ! defined __CYGWIN__ | ||
33 | # undef PATH_MAX | ||
34 | # define PATH_MAX 260 | ||
35 | #endif | ||
36 | ]]) | ||
37 | |||
38 | # Prerequisites of gl_PATHMAX_SNIPPET. | ||
39 | AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], | ||
40 | [ | ||
41 | AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) | ||
42 | ]) | ||
diff --git a/gl/m4/pid_t.m4 b/gl/m4/pid_t.m4 new file mode 100644 index 0000000..0fd7d0a --- /dev/null +++ b/gl/m4/pid_t.m4 | |||
@@ -0,0 +1,38 @@ | |||
1 | # pid_t.m4 serial 4 | ||
2 | dnl Copyright (C) 2020-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 | # The following implementation works around a problem in autoconf <= 2.69. | ||
8 | m4_version_prereq([2.70], [], [ | ||
9 | |||
10 | dnl Define pid_t if the headers don't define it. | ||
11 | AC_DEFUN([AC_TYPE_PID_T], | ||
12 | [ | ||
13 | AC_CHECK_TYPE([pid_t], | ||
14 | [], | ||
15 | [dnl On 64-bit native Windows, define it to the equivalent of 'intptr_t' | ||
16 | dnl (= 'long long' = '__int64'), because that is the return type | ||
17 | dnl of the _spawnv* functions | ||
18 | dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvp-wspawnvp> | ||
19 | dnl and the argument type of the _cwait function | ||
20 | dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait>. | ||
21 | dnl Otherwise (on 32-bit Windows and on old Unix platforms), define it | ||
22 | dnl to 'int'. | ||
23 | AC_COMPILE_IFELSE( | ||
24 | [AC_LANG_PROGRAM([[ | ||
25 | #if defined _WIN64 && !defined __CYGWIN__ | ||
26 | LLP64 | ||
27 | #endif | ||
28 | ]]) | ||
29 | ], | ||
30 | [gl_pid_type='int'], | ||
31 | [gl_pid_type='__int64']) | ||
32 | AC_DEFINE_UNQUOTED([pid_t], [$gl_pid_type], | ||
33 | [Define as a signed integer type capable of holding a process identifier.]) | ||
34 | ], | ||
35 | [AC_INCLUDES_DEFAULT]) | ||
36 | ]) | ||
37 | |||
38 | ])# m4_version_prereq 2.70 | ||
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4 index 1c70b6c..26a5a6f 100644 --- a/gl/m4/po.m4 +++ b/gl/m4/po.m4 | |||
@@ -1,16 +1,16 @@ | |||
1 | # po.m4 serial 21 (gettext-0.18.3) | 1 | # po.m4 serial 31 (gettext-0.20.2) |
2 | dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl | 6 | dnl |
7 | dnl This file can can be used in projects which are not available under | 7 | dnl This file can be used in projects which are not available under |
8 | dnl the GNU General Public License or the GNU Library General Public | 8 | dnl the GNU General Public License or the GNU Lesser General Public |
9 | dnl License but which still want to provide support for the GNU gettext | 9 | dnl License but which still want to provide support for the GNU gettext |
10 | dnl functionality. | 10 | dnl functionality. |
11 | dnl Please note that the actual code of the GNU gettext library is covered | 11 | dnl Please note that the actual code of the GNU gettext library is covered |
12 | dnl by the GNU Library General Public License, and the rest of the GNU | 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU |
13 | dnl gettext package package is covered by the GNU General Public License. | 13 | dnl gettext package is covered by the GNU General Public License. |
14 | dnl They are *not* in the public domain. | 14 | dnl They are *not* in the public domain. |
15 | 15 | ||
16 | dnl Authors: | 16 | dnl Authors: |
@@ -30,7 +30,7 @@ AC_DEFUN([AM_PO_SUBDIRS], | |||
30 | 30 | ||
31 | dnl Release version of the gettext macros. This is used to ensure that | 31 | dnl Release version of the gettext macros. This is used to ensure that |
32 | dnl the gettext macros and po/Makefile.in.in are in sync. | 32 | dnl the gettext macros and po/Makefile.in.in are in sync. |
33 | AC_SUBST([GETTEXT_MACRO_VERSION], [0.18]) | 33 | AC_SUBST([GETTEXT_MACRO_VERSION], [0.20]) |
34 | 34 | ||
35 | dnl Perform the following tests also if --disable-nls has been given, | 35 | dnl Perform the following tests also if --disable-nls has been given, |
36 | dnl because they are needed for "make dist" to work. | 36 | dnl because they are needed for "make dist" to work. |
@@ -46,13 +46,6 @@ AC_DEFUN([AM_PO_SUBDIRS], | |||
46 | 46 | ||
47 | dnl Test whether it is GNU msgfmt >= 0.15. | 47 | dnl Test whether it is GNU msgfmt >= 0.15. |
48 | changequote(,)dnl | 48 | changequote(,)dnl |
49 | case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in | ||
50 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; | ||
51 | *) MSGFMT_015=$MSGFMT ;; | ||
52 | esac | ||
53 | changequote([,])dnl | ||
54 | AC_SUBST([MSGFMT_015]) | ||
55 | changequote(,)dnl | ||
56 | case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in | 49 | case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in |
57 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; | 50 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; |
58 | *) GMSGFMT_015=$GMSGFMT ;; | 51 | *) GMSGFMT_015=$GMSGFMT ;; |
@@ -83,11 +76,21 @@ changequote([,])dnl | |||
83 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, | 76 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, |
84 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) | 77 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) |
85 | 78 | ||
86 | dnl Installation directories. | 79 | dnl Test whether it is GNU msgmerge >= 0.20. |
87 | dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we | 80 | if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then |
88 | dnl have to define it here, so that it can be used in po/Makefile. | 81 | MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt' |
89 | test -n "$localedir" || localedir='${datadir}/locale' | 82 | else |
90 | AC_SUBST([localedir]) | 83 | dnl Test whether it is GNU msgmerge >= 0.12. |
84 | if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then | ||
85 | MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet' | ||
86 | else | ||
87 | dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is | ||
88 | dnl slow. But this is not a big problem, as such old gettext versions are | ||
89 | dnl hardly in use any more. | ||
90 | MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet' | ||
91 | fi | ||
92 | fi | ||
93 | AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION]) | ||
91 | 94 | ||
92 | dnl Support for AM_XGETTEXT_OPTION. | 95 | dnl Support for AM_XGETTEXT_OPTION. |
93 | test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= | 96 | test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= |
@@ -130,14 +133,11 @@ changequote([,])dnl | |||
130 | if test -n "$OBSOLETE_ALL_LINGUAS"; then | 133 | if test -n "$OBSOLETE_ALL_LINGUAS"; then |
131 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | 134 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" |
132 | fi | 135 | fi |
133 | ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` | 136 | ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` |
134 | # Hide the ALL_LINGUAS assignment from automake < 1.5. | ||
135 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' | ||
136 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" | 137 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" |
137 | else | 138 | else |
138 | # The set of available languages was given in configure.in. | 139 | # The set of available languages was given in configure.in. |
139 | # Hide the ALL_LINGUAS assignment from automake < 1.5. | 140 | ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS |
140 | eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' | ||
141 | fi | 141 | fi |
142 | # Compute POFILES | 142 | # Compute POFILES |
143 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) | 143 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) |
@@ -208,9 +208,8 @@ changequote([,])dnl | |||
208 | esac | 208 | esac |
209 | done]], | 209 | done]], |
210 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute | 210 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute |
211 | # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it | 211 | # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. |
212 | # from automake < 1.5. | 212 | OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS" |
213 | eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' | ||
214 | # Capture the value of LINGUAS because we need it to compute CATALOGS. | 213 | # Capture the value of LINGUAS because we need it to compute CATALOGS. |
215 | LINGUAS="${LINGUAS-%UNSET%}" | 214 | LINGUAS="${LINGUAS-%UNSET%}" |
216 | ]) | 215 | ]) |
@@ -311,15 +310,13 @@ changequote([,])dnl | |||
311 | fi | 310 | fi |
312 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | 311 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then |
313 | # The LINGUAS file contains the set of available languages. | 312 | # The LINGUAS file contains the set of available languages. |
314 | ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` | 313 | ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` |
315 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" | 314 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" |
316 | else | 315 | else |
317 | # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. | 316 | # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. |
318 | sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` | 317 | sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` |
319 | ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` | 318 | ALL_LINGUAS=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` |
320 | fi | 319 | fi |
321 | # Hide the ALL_LINGUAS assignment from automake < 1.5. | ||
322 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' | ||
323 | # Compute POFILES | 320 | # Compute POFILES |
324 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) | 321 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) |
325 | # Compute UPDATEPOFILES | 322 | # Compute UPDATEPOFILES |
@@ -329,9 +326,9 @@ changequote([,])dnl | |||
329 | # Compute GMOFILES | 326 | # Compute GMOFILES |
330 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) | 327 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) |
331 | # Compute PROPERTIESFILES | 328 | # Compute PROPERTIESFILES |
332 | # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties) | 329 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).properties) |
333 | # Compute CLASSFILES | 330 | # Compute CLASSFILES |
334 | # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class) | 331 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).class) |
335 | # Compute QMFILES | 332 | # Compute QMFILES |
336 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) | 333 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) |
337 | # Compute MSGFILES | 334 | # Compute MSGFILES |
@@ -356,8 +353,8 @@ changequote([,])dnl | |||
356 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | 353 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" |
357 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | 354 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" |
358 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | 355 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" |
359 | PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties" | 356 | PROPERTIESFILES="$PROPERTIESFILES \$(srcdir)/\$(DOMAIN)_$lang.properties" |
360 | CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class" | 357 | CLASSFILES="$CLASSFILES \$(srcdir)/\$(DOMAIN)_$lang.class" |
361 | QMFILES="$QMFILES $srcdirpre$lang.qm" | 358 | QMFILES="$QMFILES $srcdirpre$lang.qm" |
362 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | 359 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
363 | MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" | 360 | MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" |
diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4 deleted file mode 100644 index d7dfb60..0000000 --- a/gl/m4/printf-posix.m4 +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | # printf-posix.m4 serial 6 (gettext-0.18.2) | ||
2 | dnl Copyright (C) 2003, 2007, 2009-2013 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 the printf() function supports POSIX/XSI format strings with | ||
9 | dnl positions. | ||
10 | |||
11 | AC_DEFUN([gt_PRINTF_POSIX], | ||
12 | [ | ||
13 | AC_REQUIRE([AC_PROG_CC]) | ||
14 | AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], | ||
15 | gt_cv_func_printf_posix, | ||
16 | [ | ||
17 | AC_RUN_IFELSE( | ||
18 | [AC_LANG_SOURCE([[ | ||
19 | #include <stdio.h> | ||
20 | #include <string.h> | ||
21 | /* The string "%2$d %1$d", with dollar characters protected from the shell's | ||
22 | dollar expansion (possibly an autoconf bug). */ | ||
23 | static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; | ||
24 | static char buf[100]; | ||
25 | int main () | ||
26 | { | ||
27 | sprintf (buf, format, 33, 55); | ||
28 | return (strcmp (buf, "55 33") != 0); | ||
29 | }]])], | ||
30 | [gt_cv_func_printf_posix=yes], | ||
31 | [gt_cv_func_printf_posix=no], | ||
32 | [ | ||
33 | AC_EGREP_CPP([notposix], [ | ||
34 | #if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ | ||
35 | notposix | ||
36 | #endif | ||
37 | ], | ||
38 | [gt_cv_func_printf_posix="guessing no"], | ||
39 | [gt_cv_func_printf_posix="guessing yes"]) | ||
40 | ]) | ||
41 | ]) | ||
42 | case $gt_cv_func_printf_posix in | ||
43 | *yes) | ||
44 | AC_DEFINE([HAVE_POSIX_PRINTF], [1], | ||
45 | [Define if your printf() function supports format strings with positions.]) | ||
46 | ;; | ||
47 | esac | ||
48 | ]) | ||
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index ef44f78..4e65abc 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # printf.m4 serial 50 | 1 | # printf.m4 serial 73 |
2 | dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -38,6 +38,8 @@ int main () | |||
38 | if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 | 38 | if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 |
39 | || strcmp (buf, "12345671 33") != 0) | 39 | || strcmp (buf, "12345671 33") != 0) |
40 | result |= 1; | 40 | result |= 1; |
41 | #else | ||
42 | result |= 1; | ||
41 | #endif | 43 | #endif |
42 | buf[0] = '\0'; | 44 | buf[0] = '\0'; |
43 | if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 | 45 | if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 |
@@ -56,13 +58,16 @@ int main () | |||
56 | [gl_cv_func_printf_sizes_c99=yes], | 58 | [gl_cv_func_printf_sizes_c99=yes], |
57 | [gl_cv_func_printf_sizes_c99=no], | 59 | [gl_cv_func_printf_sizes_c99=no], |
58 | [ | 60 | [ |
59 | changequote(,)dnl | ||
60 | case "$host_os" in | 61 | case "$host_os" in |
62 | changequote(,)dnl | ||
61 | # Guess yes on glibc systems. | 63 | # Guess yes on glibc systems. |
62 | *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; | 64 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; |
65 | # Guess yes on musl systems. | ||
66 | *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
63 | # Guess yes on FreeBSD >= 5. | 67 | # Guess yes on FreeBSD >= 5. |
64 | freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; | 68 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; |
65 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | 69 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; |
70 | midnightbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
66 | # Guess yes on Mac OS X >= 10.3. | 71 | # Guess yes on Mac OS X >= 10.3. |
67 | darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; | 72 | darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; |
68 | darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; | 73 | darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; |
@@ -77,10 +82,21 @@ changequote(,)dnl | |||
77 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | 82 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) |
78 | gl_cv_func_printf_sizes_c99="guessing no";; | 83 | gl_cv_func_printf_sizes_c99="guessing no";; |
79 | netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | 84 | netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; |
80 | # If we don't know, assume the worst. | 85 | # Guess yes on Android. |
81 | *) gl_cv_func_printf_sizes_c99="guessing no";; | 86 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; |
82 | esac | ||
83 | changequote([,])dnl | 87 | changequote([,])dnl |
88 | # Guess yes on MSVC, no on mingw. | ||
89 | mingw*) AC_EGREP_CPP([Known], [ | ||
90 | #ifdef _MSC_VER | ||
91 | Known | ||
92 | #endif | ||
93 | ], | ||
94 | [gl_cv_func_printf_sizes_c99="guessing yes"], | ||
95 | [gl_cv_func_printf_sizes_c99="guessing no"]) | ||
96 | ;; | ||
97 | # If we don't know, obey --enable-cross-guesses. | ||
98 | *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; | ||
99 | esac | ||
84 | ]) | 100 | ]) |
85 | ]) | 101 | ]) |
86 | ]) | 102 | ]) |
@@ -120,14 +136,22 @@ int main () | |||
120 | }]])], | 136 | }]])], |
121 | [gl_cv_func_printf_long_double=yes], | 137 | [gl_cv_func_printf_long_double=yes], |
122 | [gl_cv_func_printf_long_double=no], | 138 | [gl_cv_func_printf_long_double=no], |
123 | [ | 139 | [case "$host_os" in |
124 | changequote(,)dnl | 140 | # Guess no on BeOS. |
125 | case "$host_os" in | 141 | beos*) gl_cv_func_printf_long_double="guessing no";; |
126 | beos*) gl_cv_func_printf_long_double="guessing no";; | 142 | # Guess yes on Android. |
127 | mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; | 143 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; |
128 | *) gl_cv_func_printf_long_double="guessing yes";; | 144 | # Guess yes on MSVC, no on mingw. |
145 | mingw*) AC_EGREP_CPP([Known], [ | ||
146 | #ifdef _MSC_VER | ||
147 | Known | ||
148 | #endif | ||
149 | ], | ||
150 | [gl_cv_func_printf_long_double="guessing yes"], | ||
151 | [gl_cv_func_printf_long_double="guessing no"]) | ||
152 | ;; | ||
153 | *) gl_cv_func_printf_long_double="guessing yes";; | ||
129 | esac | 154 | esac |
130 | changequote([,])dnl | ||
131 | ]) | 155 | ]) |
132 | ]) | 156 | ]) |
133 | ]) | 157 | ]) |
@@ -215,13 +239,16 @@ int main () | |||
215 | [gl_cv_func_printf_infinite=yes], | 239 | [gl_cv_func_printf_infinite=yes], |
216 | [gl_cv_func_printf_infinite=no], | 240 | [gl_cv_func_printf_infinite=no], |
217 | [ | 241 | [ |
218 | changequote(,)dnl | ||
219 | case "$host_os" in | 242 | case "$host_os" in |
243 | changequote(,)dnl | ||
220 | # Guess yes on glibc systems. | 244 | # Guess yes on glibc systems. |
221 | *-gnu*) gl_cv_func_printf_infinite="guessing yes";; | 245 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; |
246 | # Guess yes on musl systems. | ||
247 | *-musl*) gl_cv_func_printf_infinite="guessing yes";; | ||
222 | # Guess yes on FreeBSD >= 6. | 248 | # Guess yes on FreeBSD >= 6. |
223 | freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; | 249 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; |
224 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; | 250 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; |
251 | midnightbsd*) gl_cv_func_printf_infinite="guessing yes";; | ||
225 | # Guess yes on Mac OS X >= 10.3. | 252 | # Guess yes on Mac OS X >= 10.3. |
226 | darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; | 253 | darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; |
227 | darwin*) gl_cv_func_printf_infinite="guessing yes";; | 254 | darwin*) gl_cv_func_printf_infinite="guessing yes";; |
@@ -232,12 +259,26 @@ changequote(,)dnl | |||
232 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | 259 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) |
233 | gl_cv_func_printf_infinite="guessing no";; | 260 | gl_cv_func_printf_infinite="guessing no";; |
234 | netbsd*) gl_cv_func_printf_infinite="guessing yes";; | 261 | netbsd*) gl_cv_func_printf_infinite="guessing yes";; |
262 | # Guess yes on OpenBSD >= 6.0. | ||
263 | openbsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; | ||
264 | openbsd*) gl_cv_func_printf_infinite="guessing yes";; | ||
235 | # Guess yes on BeOS. | 265 | # Guess yes on BeOS. |
236 | beos*) gl_cv_func_printf_infinite="guessing yes";; | 266 | beos*) gl_cv_func_printf_infinite="guessing yes";; |
237 | # If we don't know, assume the worst. | 267 | # Guess no on Android. |
238 | *) gl_cv_func_printf_infinite="guessing no";; | 268 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; |
239 | esac | ||
240 | changequote([,])dnl | 269 | changequote([,])dnl |
270 | # Guess yes on MSVC, no on mingw. | ||
271 | mingw*) AC_EGREP_CPP([Known], [ | ||
272 | #ifdef _MSC_VER | ||
273 | Known | ||
274 | #endif | ||
275 | ], | ||
276 | [gl_cv_func_printf_infinite="guessing yes"], | ||
277 | [gl_cv_func_printf_infinite="guessing no"]) | ||
278 | ;; | ||
279 | # If we don't know, obey --enable-cross-guesses. | ||
280 | *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; | ||
281 | esac | ||
241 | ]) | 282 | ]) |
242 | ]) | 283 | ]) |
243 | ]) | 284 | ]) |
@@ -328,7 +369,7 @@ int main () | |||
328 | # ifdef WORDS_BIGENDIAN | 369 | # ifdef WORDS_BIGENDIAN |
329 | # define LDBL80_WORDS(exponent,manthi,mantlo) \ | 370 | # define LDBL80_WORDS(exponent,manthi,mantlo) \ |
330 | { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ | 371 | { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ |
331 | ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ | 372 | ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ |
332 | (unsigned int) (mantlo) << 16 \ | 373 | (unsigned int) (mantlo) << 16 \ |
333 | } | 374 | } |
334 | # else | 375 | # else |
@@ -365,66 +406,51 @@ int main () | |||
365 | { /* Pseudo-NaN. */ | 406 | { /* Pseudo-NaN. */ |
366 | static union { unsigned int word[4]; long double value; } x = | 407 | static union { unsigned int word[4]; long double value; } x = |
367 | { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; | 408 | { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; |
368 | if (sprintf (buf, "%Lf", x.value) < 0 | 409 | if (sprintf (buf, "%Lf", x.value) <= 0) |
369 | || !strisnan (buf, 0, strlen (buf))) | ||
370 | result |= 4; | 410 | result |= 4; |
371 | if (sprintf (buf, "%Le", x.value) < 0 | 411 | if (sprintf (buf, "%Le", x.value) <= 0) |
372 | || !strisnan (buf, 0, strlen (buf))) | ||
373 | result |= 4; | 412 | result |= 4; |
374 | if (sprintf (buf, "%Lg", x.value) < 0 | 413 | if (sprintf (buf, "%Lg", x.value) <= 0) |
375 | || !strisnan (buf, 0, strlen (buf))) | ||
376 | result |= 4; | 414 | result |= 4; |
377 | } | 415 | } |
378 | { /* Pseudo-Infinity. */ | 416 | { /* Pseudo-Infinity. */ |
379 | static union { unsigned int word[4]; long double value; } x = | 417 | static union { unsigned int word[4]; long double value; } x = |
380 | { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; | 418 | { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; |
381 | if (sprintf (buf, "%Lf", x.value) < 0 | 419 | if (sprintf (buf, "%Lf", x.value) <= 0) |
382 | || !strisnan (buf, 0, strlen (buf))) | ||
383 | result |= 8; | 420 | result |= 8; |
384 | if (sprintf (buf, "%Le", x.value) < 0 | 421 | if (sprintf (buf, "%Le", x.value) <= 0) |
385 | || !strisnan (buf, 0, strlen (buf))) | ||
386 | result |= 8; | 422 | result |= 8; |
387 | if (sprintf (buf, "%Lg", x.value) < 0 | 423 | if (sprintf (buf, "%Lg", x.value) <= 0) |
388 | || !strisnan (buf, 0, strlen (buf))) | ||
389 | result |= 8; | 424 | result |= 8; |
390 | } | 425 | } |
391 | { /* Pseudo-Zero. */ | 426 | { /* Pseudo-Zero. */ |
392 | static union { unsigned int word[4]; long double value; } x = | 427 | static union { unsigned int word[4]; long double value; } x = |
393 | { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; | 428 | { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; |
394 | if (sprintf (buf, "%Lf", x.value) < 0 | 429 | if (sprintf (buf, "%Lf", x.value) <= 0) |
395 | || !strisnan (buf, 0, strlen (buf))) | ||
396 | result |= 16; | 430 | result |= 16; |
397 | if (sprintf (buf, "%Le", x.value) < 0 | 431 | if (sprintf (buf, "%Le", x.value) <= 0) |
398 | || !strisnan (buf, 0, strlen (buf))) | ||
399 | result |= 16; | 432 | result |= 16; |
400 | if (sprintf (buf, "%Lg", x.value) < 0 | 433 | if (sprintf (buf, "%Lg", x.value) <= 0) |
401 | || !strisnan (buf, 0, strlen (buf))) | ||
402 | result |= 16; | 434 | result |= 16; |
403 | } | 435 | } |
404 | { /* Unnormalized number. */ | 436 | { /* Unnormalized number. */ |
405 | static union { unsigned int word[4]; long double value; } x = | 437 | static union { unsigned int word[4]; long double value; } x = |
406 | { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; | 438 | { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; |
407 | if (sprintf (buf, "%Lf", x.value) < 0 | 439 | if (sprintf (buf, "%Lf", x.value) <= 0) |
408 | || !strisnan (buf, 0, strlen (buf))) | ||
409 | result |= 32; | 440 | result |= 32; |
410 | if (sprintf (buf, "%Le", x.value) < 0 | 441 | if (sprintf (buf, "%Le", x.value) <= 0) |
411 | || !strisnan (buf, 0, strlen (buf))) | ||
412 | result |= 32; | 442 | result |= 32; |
413 | if (sprintf (buf, "%Lg", x.value) < 0 | 443 | if (sprintf (buf, "%Lg", x.value) <= 0) |
414 | || !strisnan (buf, 0, strlen (buf))) | ||
415 | result |= 32; | 444 | result |= 32; |
416 | } | 445 | } |
417 | { /* Pseudo-Denormal. */ | 446 | { /* Pseudo-Denormal. */ |
418 | static union { unsigned int word[4]; long double value; } x = | 447 | static union { unsigned int word[4]; long double value; } x = |
419 | { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; | 448 | { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; |
420 | if (sprintf (buf, "%Lf", x.value) < 0 | 449 | if (sprintf (buf, "%Lf", x.value) <= 0) |
421 | || !strisnan (buf, 0, strlen (buf))) | ||
422 | result |= 64; | 450 | result |= 64; |
423 | if (sprintf (buf, "%Le", x.value) < 0 | 451 | if (sprintf (buf, "%Le", x.value) <= 0) |
424 | || !strisnan (buf, 0, strlen (buf))) | ||
425 | result |= 64; | 452 | result |= 64; |
426 | if (sprintf (buf, "%Lg", x.value) < 0 | 453 | if (sprintf (buf, "%Lg", x.value) <= 0) |
427 | || !strisnan (buf, 0, strlen (buf))) | ||
428 | result |= 64; | 454 | result |= 64; |
429 | } | 455 | } |
430 | #endif | 456 | #endif |
@@ -432,27 +458,43 @@ int main () | |||
432 | }]])], | 458 | }]])], |
433 | [gl_cv_func_printf_infinite_long_double=yes], | 459 | [gl_cv_func_printf_infinite_long_double=yes], |
434 | [gl_cv_func_printf_infinite_long_double=no], | 460 | [gl_cv_func_printf_infinite_long_double=no], |
435 | [ | 461 | [case "$host_cpu" in |
436 | changequote(,)dnl | ||
437 | case "$host_cpu" in | ||
438 | # Guess no on ia64, x86_64, i386. | 462 | # Guess no on ia64, x86_64, i386. |
439 | ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; | 463 | ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; |
440 | *) | 464 | *) |
441 | case "$host_os" in | 465 | case "$host_os" in |
466 | changequote(,)dnl | ||
442 | # Guess yes on glibc systems. | 467 | # Guess yes on glibc systems. |
443 | *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 468 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
469 | # Guess yes on musl systems. | ||
470 | *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
444 | # Guess yes on FreeBSD >= 6. | 471 | # Guess yes on FreeBSD >= 6. |
445 | freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; | 472 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; |
446 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 473 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
474 | midnightbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
447 | # Guess yes on HP-UX >= 11. | 475 | # Guess yes on HP-UX >= 11. |
448 | hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; | 476 | hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; |
449 | hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 477 | hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
450 | # If we don't know, assume the worst. | 478 | # Guess yes on OpenBSD >= 6.0. |
451 | *) gl_cv_func_printf_infinite_long_double="guessing no";; | 479 | openbsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; |
480 | openbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
481 | # Guess no on Android. | ||
482 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; | ||
483 | changequote([,])dnl | ||
484 | # Guess yes on MSVC, no on mingw. | ||
485 | mingw*) AC_EGREP_CPP([Known], [ | ||
486 | #ifdef _MSC_VER | ||
487 | Known | ||
488 | #endif | ||
489 | ], | ||
490 | [gl_cv_func_printf_infinite_long_double="guessing yes"], | ||
491 | [gl_cv_func_printf_infinite_long_double="guessing no"]) | ||
492 | ;; | ||
493 | # If we don't know, obey --enable-cross-guesses. | ||
494 | *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; | ||
452 | esac | 495 | esac |
453 | ;; | 496 | ;; |
454 | esac | 497 | esac |
455 | changequote([,])dnl | ||
456 | ]) | 498 | ]) |
457 | ]) | 499 | ]) |
458 | ;; | 500 | ;; |
@@ -495,15 +537,22 @@ int main () | |||
495 | && strcmp (buf, "-0X6.488P-1 33") != 0 | 537 | && strcmp (buf, "-0X6.488P-1 33") != 0 |
496 | && strcmp (buf, "-0XC.91P-2 33") != 0)) | 538 | && strcmp (buf, "-0XC.91P-2 33") != 0)) |
497 | result |= 2; | 539 | result |= 2; |
498 | /* This catches a FreeBSD 6.1 bug: it doesn't round. */ | 540 | /* This catches a FreeBSD 13.0 bug: it doesn't round. */ |
499 | if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 | 541 | if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 |
500 | || (strcmp (buf, "0x1.83p+0 33") != 0 | 542 | || (strcmp (buf, "0x1.83p+0 33") != 0 |
501 | && strcmp (buf, "0x3.05p-1 33") != 0 | 543 | && strcmp (buf, "0x3.05p-1 33") != 0 |
502 | && strcmp (buf, "0x6.0ap-2 33") != 0 | 544 | && strcmp (buf, "0x6.0ap-2 33") != 0 |
503 | && strcmp (buf, "0xc.14p-3 33") != 0)) | 545 | && strcmp (buf, "0xc.14p-3 33") != 0)) |
504 | result |= 4; | 546 | result |= 4; |
547 | /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ | ||
548 | if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 | ||
549 | || (strcmp (buf, "0x2p+0 33") != 0 | ||
550 | && strcmp (buf, "0x3p-1 33") != 0 | ||
551 | && strcmp (buf, "0x6p-2 33") != 0 | ||
552 | && strcmp (buf, "0xcp-3 33") != 0)) | ||
553 | result |= 4; | ||
505 | /* This catches a FreeBSD 6.1 bug. See | 554 | /* This catches a FreeBSD 6.1 bug. See |
506 | <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ | 555 | <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ |
507 | if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 | 556 | if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 |
508 | || buf[0] == '0') | 557 | || buf[0] == '0') |
509 | result |= 8; | 558 | result |= 8; |
@@ -515,7 +564,7 @@ int main () | |||
515 | && strcmp (buf, "0x8.0p-2") != 0)) | 564 | && strcmp (buf, "0x8.0p-2") != 0)) |
516 | result |= 16; | 565 | result |= 16; |
517 | /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a | 566 | /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a |
518 | glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ | 567 | glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ |
519 | if (sprintf (buf, "%.1La", 1.999L) < 0 | 568 | if (sprintf (buf, "%.1La", 1.999L) < 0 |
520 | || (strcmp (buf, "0x1.0p+1") != 0 | 569 | || (strcmp (buf, "0x1.0p+1") != 0 |
521 | && strcmp (buf, "0x2.0p+0") != 0 | 570 | && strcmp (buf, "0x2.0p+0") != 0 |
@@ -529,7 +578,7 @@ int main () | |||
529 | [ | 578 | [ |
530 | case "$host_os" in | 579 | case "$host_os" in |
531 | # Guess yes on glibc >= 2.5 systems. | 580 | # Guess yes on glibc >= 2.5 systems. |
532 | *-gnu*) | 581 | *-gnu* | gnu*) |
533 | AC_EGREP_CPP([BZ2908], [ | 582 | AC_EGREP_CPP([BZ2908], [ |
534 | #include <features.h> | 583 | #include <features.h> |
535 | #ifdef __GNU_LIBRARY__ | 584 | #ifdef __GNU_LIBRARY__ |
@@ -541,8 +590,14 @@ int main () | |||
541 | [gl_cv_func_printf_directive_a="guessing yes"], | 590 | [gl_cv_func_printf_directive_a="guessing yes"], |
542 | [gl_cv_func_printf_directive_a="guessing no"]) | 591 | [gl_cv_func_printf_directive_a="guessing no"]) |
543 | ;; | 592 | ;; |
544 | # If we don't know, assume the worst. | 593 | # Guess yes on musl systems. |
545 | *) gl_cv_func_printf_directive_a="guessing no";; | 594 | *-musl*) gl_cv_func_printf_directive_a="guessing yes";; |
595 | # Guess no on Android. | ||
596 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; | ||
597 | # Guess no on native Windows. | ||
598 | mingw*) gl_cv_func_printf_directive_a="guessing no";; | ||
599 | # If we don't know, obey --enable-cross-guesses. | ||
600 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; | ||
546 | esac | 601 | esac |
547 | ]) | 602 | ]) |
548 | ]) | 603 | ]) |
@@ -583,23 +638,40 @@ int main () | |||
583 | [gl_cv_func_printf_directive_f=yes], | 638 | [gl_cv_func_printf_directive_f=yes], |
584 | [gl_cv_func_printf_directive_f=no], | 639 | [gl_cv_func_printf_directive_f=no], |
585 | [ | 640 | [ |
586 | changequote(,)dnl | ||
587 | case "$host_os" in | 641 | case "$host_os" in |
642 | changequote(,)dnl | ||
588 | # Guess yes on glibc systems. | 643 | # Guess yes on glibc systems. |
589 | *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; | 644 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; |
645 | # Guess yes on musl systems. | ||
646 | *-musl*) gl_cv_func_printf_directive_f="guessing yes";; | ||
590 | # Guess yes on FreeBSD >= 6. | 647 | # Guess yes on FreeBSD >= 6. |
591 | freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; | 648 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; |
592 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; | 649 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; |
650 | midnightbsd*) gl_cv_func_printf_directive_f="guessing yes";; | ||
593 | # Guess yes on Mac OS X >= 10.3. | 651 | # Guess yes on Mac OS X >= 10.3. |
594 | darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; | 652 | darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; |
595 | darwin*) gl_cv_func_printf_directive_f="guessing yes";; | 653 | darwin*) gl_cv_func_printf_directive_f="guessing yes";; |
654 | # Guess yes on OpenBSD >= 6.0. | ||
655 | openbsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; | ||
656 | openbsd*) gl_cv_func_printf_directive_f="guessing yes";; | ||
596 | # Guess yes on Solaris >= 2.10. | 657 | # Guess yes on Solaris >= 2.10. |
597 | solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; | 658 | solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; |
598 | solaris*) gl_cv_func_printf_sizes_c99="guessing no";; | 659 | solaris*) gl_cv_func_printf_directive_f="guessing no";; |
599 | # If we don't know, assume the worst. | 660 | # Guess no on Android. |
600 | *) gl_cv_func_printf_directive_f="guessing no";; | 661 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; |
601 | esac | ||
602 | changequote([,])dnl | 662 | changequote([,])dnl |
663 | # Guess yes on MSVC, no on mingw. | ||
664 | mingw*) AC_EGREP_CPP([Known], [ | ||
665 | #ifdef _MSC_VER | ||
666 | Known | ||
667 | #endif | ||
668 | ], | ||
669 | [gl_cv_func_printf_directive_f="guessing yes"], | ||
670 | [gl_cv_func_printf_directive_f="guessing no"]) | ||
671 | ;; | ||
672 | # If we don't know, obey --enable-cross-guesses. | ||
673 | *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; | ||
674 | esac | ||
603 | ]) | 675 | ]) |
604 | ]) | 676 | ]) |
605 | ]) | 677 | ]) |
@@ -621,7 +693,10 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], | |||
621 | #include <stdlib.h> | 693 | #include <stdlib.h> |
622 | #include <string.h> | 694 | #include <string.h> |
623 | #ifdef _MSC_VER | 695 | #ifdef _MSC_VER |
624 | /* See page about "Parameter Validation" on msdn.microsoft.com. */ | 696 | #include <inttypes.h> |
697 | /* See page about "Parameter Validation" on msdn.microsoft.com. | ||
698 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> | ||
699 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler> */ | ||
625 | static void cdecl | 700 | static void cdecl |
626 | invalid_parameter_handler (const wchar_t *expression, | 701 | invalid_parameter_handler (const wchar_t *expression, |
627 | const wchar_t *function, | 702 | const wchar_t *function, |
@@ -651,13 +726,23 @@ int main () | |||
651 | }]])], | 726 | }]])], |
652 | [gl_cv_func_printf_directive_n=yes], | 727 | [gl_cv_func_printf_directive_n=yes], |
653 | [gl_cv_func_printf_directive_n=no], | 728 | [gl_cv_func_printf_directive_n=no], |
654 | [ | 729 | [case "$host_os" in |
655 | changequote(,)dnl | 730 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. |
656 | case "$host_os" in | 731 | *-gnu* | gnu*) AC_COMPILE_IFELSE( |
657 | mingw*) gl_cv_func_printf_directive_n="guessing no";; | 732 | [AC_LANG_SOURCE( |
658 | *) gl_cv_func_printf_directive_n="guessing yes";; | 733 | [[#if _FORTIFY_SOURCE >= 2 |
734 | error fail | ||
735 | #endif | ||
736 | ]])], | ||
737 | [gl_cv_func_printf_directive_n="guessing yes"], | ||
738 | [gl_cv_func_printf_directive_n="guessing no"]) | ||
739 | ;; | ||
740 | # Guess no on Android. | ||
741 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; | ||
742 | # Guess no on native Windows. | ||
743 | mingw*) gl_cv_func_printf_directive_n="guessing no";; | ||
744 | *) gl_cv_func_printf_directive_n="guessing yes";; | ||
659 | esac | 745 | esac |
660 | changequote([,])dnl | ||
661 | ]) | 746 | ]) |
662 | ]) | 747 | ]) |
663 | ]) | 748 | ]) |
@@ -678,13 +763,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], | |||
678 | [ | 763 | [ |
679 | AC_RUN_IFELSE( | 764 | AC_RUN_IFELSE( |
680 | [AC_LANG_SOURCE([[ | 765 | [AC_LANG_SOURCE([[ |
681 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
682 | <wchar.h>. | ||
683 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
684 | included before <wchar.h>. */ | ||
685 | #include <stddef.h> | ||
686 | #include <stdio.h> | 766 | #include <stdio.h> |
687 | #include <time.h> | ||
688 | #include <wchar.h> | 767 | #include <wchar.h> |
689 | #include <string.h> | 768 | #include <string.h> |
690 | int main () | 769 | int main () |
@@ -732,11 +811,17 @@ int main () | |||
732 | [ | 811 | [ |
733 | changequote(,)dnl | 812 | changequote(,)dnl |
734 | case "$host_os" in | 813 | case "$host_os" in |
735 | openbsd*) gl_cv_func_printf_directive_ls="guessing no";; | 814 | # Guess yes on OpenBSD >= 6.0. |
815 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; | ||
816 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; | ||
736 | irix*) gl_cv_func_printf_directive_ls="guessing no";; | 817 | irix*) gl_cv_func_printf_directive_ls="guessing no";; |
737 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; | 818 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; |
738 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; | 819 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; |
739 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; | 820 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; |
821 | # Guess no on Android. | ||
822 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; | ||
823 | # Guess yes on native Windows. | ||
824 | mingw*) gl_cv_func_printf_directive_ls="guessing yes";; | ||
740 | *) gl_cv_func_printf_directive_ls="guessing yes";; | 825 | *) gl_cv_func_printf_directive_ls="guessing yes";; |
741 | esac | 826 | esac |
742 | changequote([,])dnl | 827 | changequote([,])dnl |
@@ -774,10 +859,13 @@ int main () | |||
774 | changequote(,)dnl | 859 | changequote(,)dnl |
775 | case "$host_os" in | 860 | case "$host_os" in |
776 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) | 861 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) |
777 | gl_cv_func_printf_positions="guessing no";; | 862 | gl_cv_func_printf_positions="guessing no";; |
778 | beos*) gl_cv_func_printf_positions="guessing no";; | 863 | beos*) gl_cv_func_printf_positions="guessing no";; |
779 | mingw* | pw*) gl_cv_func_printf_positions="guessing no";; | 864 | # Guess yes on Android. |
780 | *) gl_cv_func_printf_positions="guessing yes";; | 865 | linux*-android*) gl_cv_func_printf_positions="guessing yes";; |
866 | # Guess no on native Windows. | ||
867 | mingw* | pw*) gl_cv_func_printf_positions="guessing no";; | ||
868 | *) gl_cv_func_printf_positions="guessing yes";; | ||
781 | esac | 869 | esac |
782 | changequote([,])dnl | 870 | changequote([,])dnl |
783 | ]) | 871 | ]) |
@@ -812,10 +900,13 @@ int main () | |||
812 | [ | 900 | [ |
813 | changequote(,)dnl | 901 | changequote(,)dnl |
814 | case "$host_os" in | 902 | case "$host_os" in |
815 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; | 903 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; |
816 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; | 904 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; |
817 | mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; | 905 | # Guess no on Android. |
818 | *) gl_cv_func_printf_flag_grouping="guessing yes";; | 906 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; |
907 | # Guess no on native Windows. | ||
908 | mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; | ||
909 | *) gl_cv_func_printf_flag_grouping="guessing yes";; | ||
819 | esac | 910 | esac |
820 | changequote([,])dnl | 911 | changequote([,])dnl |
821 | ]) | 912 | ]) |
@@ -824,7 +915,7 @@ changequote([,])dnl | |||
824 | 915 | ||
825 | dnl Test whether the *printf family of functions supports the - flag correctly. | 916 | dnl Test whether the *printf family of functions supports the - flag correctly. |
826 | dnl (ISO C99.) See | 917 | dnl (ISO C99.) See |
827 | dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html> | 918 | dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> |
828 | dnl Result is gl_cv_func_printf_flag_leftadjust. | 919 | dnl Result is gl_cv_func_printf_flag_leftadjust. |
829 | 920 | ||
830 | AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], | 921 | AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], |
@@ -852,12 +943,16 @@ int main () | |||
852 | [ | 943 | [ |
853 | changequote(,)dnl | 944 | changequote(,)dnl |
854 | case "$host_os" in | 945 | case "$host_os" in |
855 | # Guess yes on HP-UX 11. | 946 | # Guess yes on HP-UX 11. |
856 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 947 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
857 | # Guess no on HP-UX 10 and older. | 948 | # Guess no on HP-UX 10 and older. |
858 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; | 949 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; |
859 | # Guess yes otherwise. | 950 | # Guess yes on Android. |
860 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 951 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
952 | # Guess yes on native Windows. | ||
953 | mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | ||
954 | # Guess yes otherwise. | ||
955 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; | ||
861 | esac | 956 | esac |
862 | changequote([,])dnl | 957 | changequote([,])dnl |
863 | ]) | 958 | ]) |
@@ -866,7 +961,7 @@ changequote([,])dnl | |||
866 | 961 | ||
867 | dnl Test whether the *printf family of functions supports padding of non-finite | 962 | dnl Test whether the *printf family of functions supports padding of non-finite |
868 | dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See | 963 | dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See |
869 | dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> | 964 | dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> |
870 | dnl Result is gl_cv_func_printf_flag_zero. | 965 | dnl Result is gl_cv_func_printf_flag_zero. |
871 | 966 | ||
872 | AC_DEFUN([gl_PRINTF_FLAG_ZERO], | 967 | AC_DEFUN([gl_PRINTF_FLAG_ZERO], |
@@ -895,12 +990,18 @@ int main () | |||
895 | [ | 990 | [ |
896 | changequote(,)dnl | 991 | changequote(,)dnl |
897 | case "$host_os" in | 992 | case "$host_os" in |
898 | # Guess yes on glibc systems. | 993 | # Guess yes on glibc systems. |
899 | *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; | 994 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; |
900 | # Guess yes on BeOS. | 995 | # Guess yes on musl systems. |
901 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; | 996 | *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; |
902 | # If we don't know, assume the worst. | 997 | # Guess yes on BeOS. |
903 | *) gl_cv_func_printf_flag_zero="guessing no";; | 998 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; |
999 | # Guess no on Android. | ||
1000 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; | ||
1001 | # Guess no on native Windows. | ||
1002 | mingw*) gl_cv_func_printf_flag_zero="guessing no";; | ||
1003 | # If we don't know, obey --enable-cross-guesses. | ||
1004 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; | ||
904 | esac | 1005 | esac |
905 | changequote([,])dnl | 1006 | changequote([,])dnl |
906 | ]) | 1007 | ]) |
@@ -953,10 +1054,12 @@ int main () | |||
953 | changequote(,)dnl | 1054 | changequote(,)dnl |
954 | case "$host_os" in | 1055 | case "$host_os" in |
955 | # Guess no only on Solaris, native Windows, and BeOS systems. | 1056 | # Guess no only on Solaris, native Windows, and BeOS systems. |
956 | solaris*) gl_cv_func_printf_precision="guessing no" ;; | 1057 | solaris*) gl_cv_func_printf_precision="guessing no" ;; |
957 | mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; | 1058 | mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; |
958 | beos*) gl_cv_func_printf_precision="guessing no" ;; | 1059 | beos*) gl_cv_func_printf_precision="guessing no" ;; |
959 | *) gl_cv_func_printf_precision="guessing yes" ;; | 1060 | # Guess yes on Android. |
1061 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; | ||
1062 | *) gl_cv_func_printf_precision="guessing yes" ;; | ||
960 | esac | 1063 | esac |
961 | changequote([,])dnl | 1064 | changequote([,])dnl |
962 | ]) | 1065 | ]) |
@@ -978,9 +1081,8 @@ AC_DEFUN([gl_PRINTF_ENOMEM], | |||
978 | gl_cv_func_printf_enomem="guessing no" | 1081 | gl_cv_func_printf_enomem="guessing no" |
979 | if test "$cross_compiling" = no; then | 1082 | if test "$cross_compiling" = no; then |
980 | if test $APPLE_UNIVERSAL_BUILD = 0; then | 1083 | if test $APPLE_UNIVERSAL_BUILD = 0; then |
981 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | 1084 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
982 | ]GL_NOCRASH[ | 1085 | ]GL_NOCRASH[ |
983 | changequote(,)dnl | ||
984 | #include <stdio.h> | 1086 | #include <stdio.h> |
985 | #include <sys/types.h> | 1087 | #include <sys/types.h> |
986 | #include <sys/time.h> | 1088 | #include <sys/time.h> |
@@ -1025,8 +1127,7 @@ int main() | |||
1025 | ret = printf ("%.5000000f", 1.0); | 1127 | ret = printf ("%.5000000f", 1.0); |
1026 | return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); | 1128 | return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); |
1027 | } | 1129 | } |
1028 | changequote([,])dnl | 1130 | ]])]) |
1029 | ])]) | ||
1030 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 1131 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
1031 | (./conftest 2>&AS_MESSAGE_LOG_FD | 1132 | (./conftest 2>&AS_MESSAGE_LOG_FD |
1032 | result=$? | 1133 | result=$? |
@@ -1053,28 +1154,30 @@ changequote([,])dnl | |||
1053 | if test "$gl_cv_func_printf_enomem" = "guessing no"; then | 1154 | if test "$gl_cv_func_printf_enomem" = "guessing no"; then |
1054 | changequote(,)dnl | 1155 | changequote(,)dnl |
1055 | case "$host_os" in | 1156 | case "$host_os" in |
1056 | # Guess yes on glibc systems. | 1157 | # Guess yes on glibc systems. |
1057 | *-gnu*) gl_cv_func_printf_enomem="guessing yes";; | 1158 | *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; |
1058 | # Guess yes on Solaris. | 1159 | # Guess yes on Solaris. |
1059 | solaris*) gl_cv_func_printf_enomem="guessing yes";; | 1160 | solaris*) gl_cv_func_printf_enomem="guessing yes";; |
1060 | # Guess yes on AIX. | 1161 | # Guess yes on AIX. |
1061 | aix*) gl_cv_func_printf_enomem="guessing yes";; | 1162 | aix*) gl_cv_func_printf_enomem="guessing yes";; |
1062 | # Guess yes on HP-UX/hppa. | 1163 | # Guess yes on HP-UX/hppa. |
1063 | hpux*) case "$host_cpu" in | 1164 | hpux*) case "$host_cpu" in |
1064 | hppa*) gl_cv_func_printf_enomem="guessing yes";; | 1165 | hppa*) gl_cv_func_printf_enomem="guessing yes";; |
1065 | *) gl_cv_func_printf_enomem="guessing no";; | 1166 | *) gl_cv_func_printf_enomem="guessing no";; |
1066 | esac | 1167 | esac |
1067 | ;; | 1168 | ;; |
1068 | # Guess yes on IRIX. | 1169 | # Guess yes on IRIX. |
1069 | irix*) gl_cv_func_printf_enomem="guessing yes";; | 1170 | irix*) gl_cv_func_printf_enomem="guessing yes";; |
1070 | # Guess yes on OSF/1. | 1171 | # Guess yes on OSF/1. |
1071 | osf*) gl_cv_func_printf_enomem="guessing yes";; | 1172 | osf*) gl_cv_func_printf_enomem="guessing yes";; |
1072 | # Guess yes on BeOS. | 1173 | # Guess yes on BeOS. |
1073 | beos*) gl_cv_func_printf_enomem="guessing yes";; | 1174 | beos*) gl_cv_func_printf_enomem="guessing yes";; |
1074 | # Guess yes on Haiku. | 1175 | # Guess yes on Haiku. |
1075 | haiku*) gl_cv_func_printf_enomem="guessing yes";; | 1176 | haiku*) gl_cv_func_printf_enomem="guessing yes";; |
1076 | # If we don't know, assume the worst. | 1177 | # Guess no on Android. |
1077 | *) gl_cv_func_printf_enomem="guessing no";; | 1178 | linux*-android*) gl_cv_func_printf_enomem="guessing no";; |
1179 | # If we don't know, obey --enable-cross-guesses. | ||
1180 | *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; | ||
1078 | esac | 1181 | esac |
1079 | changequote([,])dnl | 1182 | changequote([,])dnl |
1080 | fi | 1183 | fi |
@@ -1093,7 +1196,7 @@ dnl Test whether the string produced by the snprintf function is always NUL | |||
1093 | dnl terminated. (ISO C99, POSIX:2001) | 1196 | dnl terminated. (ISO C99, POSIX:2001) |
1094 | dnl Result is gl_cv_func_snprintf_truncation_c99. | 1197 | dnl Result is gl_cv_func_snprintf_truncation_c99. |
1095 | 1198 | ||
1096 | AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], | 1199 | AC_DEFUN_ONCE([gl_SNPRINTF_TRUNCATION_C99], |
1097 | [ | 1200 | [ |
1098 | AC_REQUIRE([AC_PROG_CC]) | 1201 | AC_REQUIRE([AC_PROG_CC]) |
1099 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 1202 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
@@ -1134,10 +1237,13 @@ int main () | |||
1134 | changequote(,)dnl | 1237 | changequote(,)dnl |
1135 | case "$host_os" in | 1238 | case "$host_os" in |
1136 | # Guess yes on glibc systems. | 1239 | # Guess yes on glibc systems. |
1137 | *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1240 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1241 | # Guess yes on musl systems. | ||
1242 | *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
1138 | # Guess yes on FreeBSD >= 5. | 1243 | # Guess yes on FreeBSD >= 5. |
1139 | freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1244 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
1140 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1245 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1246 | midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
1141 | # Guess yes on Mac OS X >= 10.3. | 1247 | # Guess yes on Mac OS X >= 10.3. |
1142 | darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1248 | darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
1143 | darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1249 | darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
@@ -1166,8 +1272,12 @@ changequote(,)dnl | |||
1166 | netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1272 | netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1167 | # Guess yes on BeOS. | 1273 | # Guess yes on BeOS. |
1168 | beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1274 | beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1169 | # If we don't know, assume the worst. | 1275 | # Guess yes on Android. |
1170 | *) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1276 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1277 | # Guess no on native Windows. | ||
1278 | mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
1279 | # If we don't know, obey --enable-cross-guesses. | ||
1280 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; | ||
1171 | esac | 1281 | esac |
1172 | changequote([,])dnl | 1282 | changequote([,])dnl |
1173 | ]) | 1283 | ]) |
@@ -1229,14 +1339,16 @@ int main () | |||
1229 | }]])], | 1339 | }]])], |
1230 | [gl_cv_func_snprintf_retval_c99=yes], | 1340 | [gl_cv_func_snprintf_retval_c99=yes], |
1231 | [gl_cv_func_snprintf_retval_c99=no], | 1341 | [gl_cv_func_snprintf_retval_c99=no], |
1232 | [ | 1342 | [case "$host_os" in |
1233 | changequote(,)dnl | 1343 | changequote(,)dnl |
1234 | case "$host_os" in | ||
1235 | # Guess yes on glibc systems. | 1344 | # Guess yes on glibc systems. |
1236 | *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1345 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1346 | # Guess yes on musl systems. | ||
1347 | *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
1237 | # Guess yes on FreeBSD >= 5. | 1348 | # Guess yes on FreeBSD >= 5. |
1238 | freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; | 1349 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; |
1239 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1350 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1351 | midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
1240 | # Guess yes on Mac OS X >= 10.3. | 1352 | # Guess yes on Mac OS X >= 10.3. |
1241 | darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; | 1353 | darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; |
1242 | darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1354 | darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
@@ -1256,10 +1368,21 @@ changequote(,)dnl | |||
1256 | netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1368 | netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1257 | # Guess yes on BeOS. | 1369 | # Guess yes on BeOS. |
1258 | beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1370 | beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1259 | # If we don't know, assume the worst. | 1371 | # Guess yes on Android. |
1260 | *) gl_cv_func_snprintf_retval_c99="guessing no";; | 1372 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1261 | esac | ||
1262 | changequote([,])dnl | 1373 | changequote([,])dnl |
1374 | # Guess yes on MSVC, no on mingw. | ||
1375 | mingw*) AC_EGREP_CPP([Known], [ | ||
1376 | #ifdef _MSC_VER | ||
1377 | Known | ||
1378 | #endif | ||
1379 | ], | ||
1380 | [gl_cv_func_snprintf_retval_c99="guessing yes"], | ||
1381 | [gl_cv_func_snprintf_retval_c99="guessing no"]) | ||
1382 | ;; | ||
1383 | # If we don't know, obey --enable-cross-guesses. | ||
1384 | *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; | ||
1385 | esac | ||
1263 | ]) | 1386 | ]) |
1264 | ]) | 1387 | ]) |
1265 | ]) | 1388 | ]) |
@@ -1311,13 +1434,24 @@ int main () | |||
1311 | [gl_cv_func_snprintf_directive_n=yes], | 1434 | [gl_cv_func_snprintf_directive_n=yes], |
1312 | [gl_cv_func_snprintf_directive_n=no], | 1435 | [gl_cv_func_snprintf_directive_n=no], |
1313 | [ | 1436 | [ |
1314 | changequote(,)dnl | ||
1315 | case "$host_os" in | 1437 | case "$host_os" in |
1316 | # Guess yes on glibc systems. | 1438 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. |
1317 | *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1439 | *-gnu* | gnu*) AC_COMPILE_IFELSE( |
1440 | [AC_LANG_SOURCE( | ||
1441 | [[#if _FORTIFY_SOURCE >= 2 | ||
1442 | error fail | ||
1443 | #endif | ||
1444 | ]])], | ||
1445 | [gl_cv_func_snprintf_directive_n="guessing yes"], | ||
1446 | [gl_cv_func_snprintf_directive_n="guessing no"]) | ||
1447 | ;; | ||
1448 | changequote(,)dnl | ||
1449 | # Guess yes on musl systems. | ||
1450 | *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
1318 | # Guess yes on FreeBSD >= 5. | 1451 | # Guess yes on FreeBSD >= 5. |
1319 | freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; | 1452 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; |
1320 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1453 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; |
1454 | midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
1321 | # Guess yes on Mac OS X >= 10.3. | 1455 | # Guess yes on Mac OS X >= 10.3. |
1322 | darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; | 1456 | darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; |
1323 | darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1457 | darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; |
@@ -1339,10 +1473,14 @@ changequote(,)dnl | |||
1339 | netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1473 | netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; |
1340 | # Guess yes on BeOS. | 1474 | # Guess yes on BeOS. |
1341 | beos*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1475 | beos*) gl_cv_func_snprintf_directive_n="guessing yes";; |
1342 | # If we don't know, assume the worst. | 1476 | # Guess no on Android. |
1343 | *) gl_cv_func_snprintf_directive_n="guessing no";; | 1477 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; |
1344 | esac | 1478 | # Guess no on native Windows. |
1479 | mingw*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
1480 | # If we don't know, obey --enable-cross-guesses. | ||
1481 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; | ||
1345 | changequote([,])dnl | 1482 | changequote([,])dnl |
1483 | esac | ||
1346 | ]) | 1484 | ]) |
1347 | ]) | 1485 | ]) |
1348 | ]) | 1486 | ]) |
@@ -1355,6 +1493,7 @@ dnl Result is gl_cv_func_snprintf_size1. | |||
1355 | AC_DEFUN([gl_SNPRINTF_SIZE1], | 1493 | AC_DEFUN([gl_SNPRINTF_SIZE1], |
1356 | [ | 1494 | [ |
1357 | AC_REQUIRE([AC_PROG_CC]) | 1495 | AC_REQUIRE([AC_PROG_CC]) |
1496 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1358 | AC_REQUIRE([gl_SNPRINTF_PRESENCE]) | 1497 | AC_REQUIRE([gl_SNPRINTF_PRESENCE]) |
1359 | AC_CACHE_CHECK([whether snprintf respects a size of 1], | 1498 | AC_CACHE_CHECK([whether snprintf respects a size of 1], |
1360 | [gl_cv_func_snprintf_size1], | 1499 | [gl_cv_func_snprintf_size1], |
@@ -1384,7 +1523,14 @@ int main() | |||
1384 | }]])], | 1523 | }]])], |
1385 | [gl_cv_func_snprintf_size1=yes], | 1524 | [gl_cv_func_snprintf_size1=yes], |
1386 | [gl_cv_func_snprintf_size1=no], | 1525 | [gl_cv_func_snprintf_size1=no], |
1387 | [gl_cv_func_snprintf_size1="guessing yes"]) | 1526 | [case "$host_os" in |
1527 | # Guess yes on Android. | ||
1528 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; | ||
1529 | # Guess yes on native Windows. | ||
1530 | mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; | ||
1531 | *) gl_cv_func_snprintf_size1="guessing yes" ;; | ||
1532 | esac | ||
1533 | ]) | ||
1388 | ]) | 1534 | ]) |
1389 | ]) | 1535 | ]) |
1390 | 1536 | ||
@@ -1456,10 +1602,13 @@ int main() | |||
1456 | changequote(,)dnl | 1602 | changequote(,)dnl |
1457 | case "$host_os" in | 1603 | case "$host_os" in |
1458 | # Guess yes on glibc systems. | 1604 | # Guess yes on glibc systems. |
1459 | *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1605 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1606 | # Guess yes on musl systems. | ||
1607 | *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
1460 | # Guess yes on FreeBSD >= 5. | 1608 | # Guess yes on FreeBSD >= 5. |
1461 | freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1609 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1462 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1610 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1611 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
1463 | # Guess yes on Mac OS X >= 10.3. | 1612 | # Guess yes on Mac OS X >= 10.3. |
1464 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1613 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1465 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1614 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
@@ -1480,10 +1629,12 @@ changequote(,)dnl | |||
1480 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1629 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1481 | # Guess yes on BeOS. | 1630 | # Guess yes on BeOS. |
1482 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1631 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1483 | # Guess yes on mingw. | 1632 | # Guess yes on Android. |
1633 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
1634 | # Guess yes on native Windows. | ||
1484 | mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1635 | mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1485 | # If we don't know, assume the worst. | 1636 | # If we don't know, obey --enable-cross-guesses. |
1486 | *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1637 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; |
1487 | esac | 1638 | esac |
1488 | changequote([,])dnl | 1639 | changequote([,])dnl |
1489 | ]) | 1640 | ]) |
@@ -1539,14 +1690,19 @@ dnl | |||
1539 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1690 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
1540 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . | 1691 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . |
1541 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . | 1692 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . |
1693 | dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . | ||
1542 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . | 1694 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . |
1695 | dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . | ||
1543 | dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . | 1696 | dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . |
1544 | dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . | 1697 | dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . |
1698 | dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . | ||
1545 | dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . | 1699 | dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . |
1546 | dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . | 1700 | dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . |
1547 | dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . | 1701 | dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . |
1548 | dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . | 1702 | dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . |
1549 | dnl Solaris 11 2011-11 . . # # # . . # . . . # . . . . . . . . | 1703 | dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . |
1704 | dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . | ||
1705 | dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . | ||
1550 | dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . | 1706 | dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . |
1551 | dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . | 1707 | dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . |
1552 | dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # | 1708 | dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # |
@@ -1559,11 +1715,13 @@ dnl HP-UX 10.20 # . # . # # . ? . . # # . . . | |||
1559 | dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . | 1715 | dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . |
1560 | dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # | 1716 | dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # |
1561 | dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # | 1717 | dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # |
1718 | dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . | ||
1562 | dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . | 1719 | dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . |
1563 | dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? | 1720 | dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? |
1564 | dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . | 1721 | dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . |
1565 | dnl Haiku . . . # # # . # . . . . . ? . . ? . . . | 1722 | dnl Haiku . . . # # # . # . . . . . ? . . ? . . . |
1566 | dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . | 1723 | dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . |
1724 | dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . | ||
1567 | dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . | 1725 | dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . |
1568 | dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . | 1726 | dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . |
1569 | dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . | 1727 | dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . |
diff --git a/gl/m4/progtest.m4 b/gl/m4/progtest.m4 index 7b39123..906567b 100644 --- a/gl/m4/progtest.m4 +++ b/gl/m4/progtest.m4 | |||
@@ -1,22 +1,22 @@ | |||
1 | # progtest.m4 serial 7 (gettext-0.18.2) | 1 | # progtest.m4 serial 9 (gettext-0.21.1) |
2 | dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1996-2003, 2005, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl | 6 | dnl |
7 | dnl This file can can be used in projects which are not available under | 7 | dnl This file can be used in projects which are not available under |
8 | dnl the GNU General Public License or the GNU Library General Public | 8 | dnl the GNU General Public License or the GNU Lesser General Public |
9 | dnl License but which still want to provide support for the GNU gettext | 9 | dnl License but which still want to provide support for the GNU gettext |
10 | dnl functionality. | 10 | dnl functionality. |
11 | dnl Please note that the actual code of the GNU gettext library is covered | 11 | dnl Please note that the actual code of the GNU gettext library is covered |
12 | dnl by the GNU Library General Public License, and the rest of the GNU | 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU |
13 | dnl gettext package package is covered by the GNU General Public License. | 13 | dnl gettext package is covered by the GNU General Public License. |
14 | dnl They are *not* in the public domain. | 14 | dnl They are *not* in the public domain. |
15 | 15 | ||
16 | dnl Authors: | 16 | dnl Authors: |
17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1996. | 17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1996. |
18 | 18 | ||
19 | AC_PREREQ([2.50]) | 19 | AC_PREREQ([2.53]) |
20 | 20 | ||
21 | # Search path for a program which passes the given test. | 21 | # Search path for a program which passes the given test. |
22 | 22 | ||
@@ -61,7 +61,7 @@ AC_CACHE_VAL([ac_cv_path_$1], | |||
61 | ;; | 61 | ;; |
62 | *) | 62 | *) |
63 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR | 63 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR |
64 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | 64 | for ac_dir in m4_if([$5], , $PATH, [$5]); do |
65 | IFS="$ac_save_IFS" | 65 | IFS="$ac_save_IFS" |
66 | test -z "$ac_dir" && ac_dir=. | 66 | test -z "$ac_dir" && ac_dir=. |
67 | for ac_exec_ext in '' $ac_executable_extensions; do | 67 | for ac_exec_ext in '' $ac_executable_extensions; do |
@@ -77,12 +77,12 @@ AC_CACHE_VAL([ac_cv_path_$1], | |||
77 | IFS="$ac_save_IFS" | 77 | IFS="$ac_save_IFS" |
78 | dnl If no 4th arg is given, leave the cache variable unset, | 78 | dnl If no 4th arg is given, leave the cache variable unset, |
79 | dnl so AC_PATH_PROGS will keep looking. | 79 | dnl so AC_PATH_PROGS will keep looking. |
80 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | 80 | m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" |
81 | ])dnl | 81 | ])dnl |
82 | ;; | 82 | ;; |
83 | esac])dnl | 83 | esac])dnl |
84 | $1="$ac_cv_path_$1" | 84 | $1="$ac_cv_path_$1" |
85 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then | 85 | if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then |
86 | AC_MSG_RESULT([$][$1]) | 86 | AC_MSG_RESULT([$][$1]) |
87 | else | 87 | else |
88 | AC_MSG_RESULT([no]) | 88 | AC_MSG_RESULT([no]) |
diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4 new file mode 100644 index 0000000..ae6a885 --- /dev/null +++ b/gl/m4/pthread_rwlock_rdlock.m4 | |||
@@ -0,0 +1,185 @@ | |||
1 | # pthread_rwlock_rdlock.m4 serial 4 | ||
2 | dnl Copyright (C) 2017-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 Inspired by | ||
9 | dnl https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c | ||
10 | dnl by Intel Corporation. | ||
11 | |||
12 | dnl Test whether in a situation where | ||
13 | dnl - an rwlock is taken by a reader and has a writer waiting, | ||
14 | dnl - an additional reader requests the lock, | ||
15 | dnl - the waiting writer and the requesting reader threads have the same | ||
16 | dnl priority, | ||
17 | dnl the requesting reader thread gets blocked, so that at some point the | ||
18 | dnl waiting writer can acquire the lock. | ||
19 | dnl Without such a guarantee, when there a N readers and each of the readers | ||
20 | dnl spends more than 1/Nth of the time with the lock held, there is a high | ||
21 | dnl probability that the waiting writer will not get the lock in a given finite | ||
22 | dnl time, a phenomenon called "writer starvation". | ||
23 | dnl Without such a guarantee, applications have a hard time avoiding writer | ||
24 | dnl starvation. | ||
25 | dnl | ||
26 | dnl POSIX:2017 makes this requirement only for implementations that support TPS | ||
27 | dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO | ||
28 | dnl and SCHED_RR, see | ||
29 | dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html | ||
30 | dnl but this test verifies the guarantee regardless of TPS and regardless of | ||
31 | dnl scheduling policy. | ||
32 | dnl Glibc does not provide this guarantee (and never will on Linux), see | ||
33 | dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 | ||
34 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 | ||
35 | AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], | ||
36 | [ | ||
37 | AC_REQUIRE([gl_THREADLIB_EARLY]) | ||
38 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
39 | AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], | ||
40 | [gl_cv_pthread_rwlock_rdlock_prefer_writer], | ||
41 | [save_LIBS="$LIBS" | ||
42 | LIBS="$LIBS $LIBMULTITHREAD" | ||
43 | AC_RUN_IFELSE( | ||
44 | [AC_LANG_SOURCE([[ | ||
45 | #include <errno.h> | ||
46 | #include <pthread.h> | ||
47 | #include <stdlib.h> | ||
48 | #include <unistd.h> | ||
49 | |||
50 | #define SUCCEED() exit (0) | ||
51 | #define FAILURE() exit (1) | ||
52 | #define UNEXPECTED(n) (exit (10 + (n))) | ||
53 | |||
54 | /* The main thread creates the waiting writer and the requesting reader threads | ||
55 | in the default way; this guarantees that they have the same priority. | ||
56 | We can reuse the main thread as first reader thread. */ | ||
57 | |||
58 | static pthread_rwlock_t lock; | ||
59 | static pthread_t reader1; | ||
60 | static pthread_t writer; | ||
61 | static pthread_t reader2; | ||
62 | static pthread_t timer; | ||
63 | /* Used to pass control from writer to reader2 and from reader2 to timer, | ||
64 | as in a relay race. | ||
65 | Passing control from one running thread to another running thread | ||
66 | is most likely faster than to create the second thread. */ | ||
67 | static pthread_mutex_t baton; | ||
68 | |||
69 | static void * | ||
70 | timer_func (void *ignored) | ||
71 | { | ||
72 | /* Step 13 (can be before or after step 12): | ||
73 | The timer thread takes the baton, then waits a moment to make sure | ||
74 | it can tell whether the second reader thread is blocked at step 12. */ | ||
75 | if (pthread_mutex_lock (&baton)) | ||
76 | UNEXPECTED (13); | ||
77 | usleep (100000); | ||
78 | /* By the time we get here, it's clear that the second reader thread is | ||
79 | blocked at step 12. This is the desired behaviour. */ | ||
80 | SUCCEED (); | ||
81 | } | ||
82 | |||
83 | static void * | ||
84 | reader2_func (void *ignored) | ||
85 | { | ||
86 | int err; | ||
87 | |||
88 | /* Step 8 (can be before or after step 7): | ||
89 | The second reader thread takes the baton, then waits a moment to make sure | ||
90 | the writer thread has reached step 7. */ | ||
91 | if (pthread_mutex_lock (&baton)) | ||
92 | UNEXPECTED (8); | ||
93 | usleep (100000); | ||
94 | /* Step 9: The second reader thread requests the lock. */ | ||
95 | err = pthread_rwlock_tryrdlock (&lock); | ||
96 | if (err == 0) | ||
97 | FAILURE (); | ||
98 | else if (err != EBUSY) | ||
99 | UNEXPECTED (9); | ||
100 | /* Step 10: Launch a timer, to test whether the next call blocks. */ | ||
101 | if (pthread_create (&timer, NULL, timer_func, NULL)) | ||
102 | UNEXPECTED (10); | ||
103 | /* Step 11: Release the baton. */ | ||
104 | if (pthread_mutex_unlock (&baton)) | ||
105 | UNEXPECTED (11); | ||
106 | /* Step 12: The second reader thread requests the lock. */ | ||
107 | err = pthread_rwlock_rdlock (&lock); | ||
108 | if (err == 0) | ||
109 | FAILURE (); | ||
110 | else | ||
111 | UNEXPECTED (12); | ||
112 | } | ||
113 | |||
114 | static void * | ||
115 | writer_func (void *ignored) | ||
116 | { | ||
117 | /* Step 4: Take the baton, so that the second reader thread does not go ahead | ||
118 | too early. */ | ||
119 | if (pthread_mutex_lock (&baton)) | ||
120 | UNEXPECTED (4); | ||
121 | /* Step 5: Create the second reader thread. */ | ||
122 | if (pthread_create (&reader2, NULL, reader2_func, NULL)) | ||
123 | UNEXPECTED (5); | ||
124 | /* Step 6: Release the baton. */ | ||
125 | if (pthread_mutex_unlock (&baton)) | ||
126 | UNEXPECTED (6); | ||
127 | /* Step 7: The writer thread requests the lock. */ | ||
128 | if (pthread_rwlock_wrlock (&lock)) | ||
129 | UNEXPECTED (7); | ||
130 | return NULL; | ||
131 | } | ||
132 | |||
133 | int | ||
134 | main () | ||
135 | { | ||
136 | reader1 = pthread_self (); | ||
137 | |||
138 | /* Step 1: The main thread initializes the lock and the baton. */ | ||
139 | if (pthread_rwlock_init (&lock, NULL)) | ||
140 | UNEXPECTED (1); | ||
141 | if (pthread_mutex_init (&baton, NULL)) | ||
142 | UNEXPECTED (1); | ||
143 | /* Step 2: The main thread acquires the lock as a reader. */ | ||
144 | if (pthread_rwlock_rdlock (&lock)) | ||
145 | UNEXPECTED (2); | ||
146 | /* Step 3: Create the writer thread. */ | ||
147 | if (pthread_create (&writer, NULL, writer_func, NULL)) | ||
148 | UNEXPECTED (3); | ||
149 | /* Job done. Go to sleep. */ | ||
150 | for (;;) | ||
151 | { | ||
152 | sleep (1); | ||
153 | } | ||
154 | } | ||
155 | ]])], | ||
156 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], | ||
157 | [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], | ||
158 | [case "$host_os" in | ||
159 | # Guess no on glibc systems. | ||
160 | *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | ||
161 | # Guess no on musl systems. | ||
162 | *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | ||
163 | # Guess no on bionic systems. | ||
164 | *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; | ||
165 | # Guess yes on native Windows with the mingw-w64 winpthreads library. | ||
166 | # 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 | ||
168 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" | ||
169 | else | ||
170 | gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" | ||
171 | fi | ||
172 | ;; | ||
173 | # If we don't know, obey --enable-cross-guesses. | ||
174 | *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; | ||
175 | esac | ||
176 | ]) | ||
177 | LIBS="$save_LIBS" | ||
178 | ]) | ||
179 | case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in | ||
180 | *yes) | ||
181 | AC_DEFINE([HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [1], | ||
182 | [Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader.]) | ||
183 | ;; | ||
184 | esac | ||
185 | ]) | ||
diff --git a/gl/m4/read.m4 b/gl/m4/read.m4 deleted file mode 100644 index 81f0f3a..0000000 --- a/gl/m4/read.m4 +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | # read.m4 serial 4 | ||
2 | dnl Copyright (C) 2011-2013 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_FUNC_READ], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
10 | AC_REQUIRE([gl_MSVC_INVAL]) | ||
11 | if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then | ||
12 | REPLACE_READ=1 | ||
13 | fi | ||
14 | dnl This ifdef is just an optimization, to avoid performing a configure | ||
15 | dnl check whose result is not used. It does not make the test of | ||
16 | dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. | ||
17 | m4_ifdef([gl_NONBLOCKING_IO], [ | ||
18 | gl_NONBLOCKING_IO | ||
19 | if test $gl_cv_have_nonblocking != yes; then | ||
20 | REPLACE_READ=1 | ||
21 | fi | ||
22 | ]) | ||
23 | ]) | ||
24 | |||
25 | # Prerequisites of lib/read.c. | ||
26 | AC_DEFUN([gl_PREREQ_READ], [:]) | ||
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 new file mode 100644 index 0000000..d22138f --- /dev/null +++ b/gl/m4/realloc.m4 | |||
@@ -0,0 +1,63 @@ | |||
1 | # realloc.m4 serial 26 | ||
2 | dnl Copyright (C) 2007, 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 | # This is adapted with modifications from upstream Autoconf here: | ||
8 | # https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 | ||
9 | AC_DEFUN([_AC_FUNC_REALLOC_IF], | ||
10 | [ | ||
11 | AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | ||
12 | AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], | ||
13 | [ac_cv_func_realloc_0_nonnull], | ||
14 | [AC_RUN_IFELSE( | ||
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 | |||
51 | # gl_FUNC_REALLOC_POSIX | ||
52 | # --------------------- | ||
53 | # Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it | ||
54 | # fails, and doesn't mess up with ptrdiff_t overflow), | ||
55 | # and replace realloc if it is not. | ||
56 | AC_DEFUN([gl_FUNC_REALLOC_POSIX], | ||
57 | [ | ||
58 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
59 | AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) | ||
60 | if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then | ||
61 | REPLACE_REALLOC_FOR_REALLOC_POSIX=1 | ||
62 | fi | ||
63 | ]) | ||
diff --git a/gl/m4/reallocarray.m4 b/gl/m4/reallocarray.m4 new file mode 100644 index 0000000..1607b7a --- /dev/null +++ b/gl/m4/reallocarray.m4 | |||
@@ -0,0 +1,23 @@ | |||
1 | # reallocarray.m4 serial 3 | ||
2 | dnl Copyright (C) 2017-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_FUNC_REALLOCARRAY], | ||
8 | [ | ||
9 | dnl Persuade glibc <stdlib.h> to declare reallocarray. | ||
10 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
11 | |||
12 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
13 | AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) | ||
14 | AC_CHECK_FUNCS([reallocarray]) | ||
15 | if test "$ac_cv_func_reallocarray" = no; then | ||
16 | HAVE_REALLOCARRAY=0 | ||
17 | elif test "$gl_cv_malloc_ptrdiff" = no; then | ||
18 | REPLACE_REALLOCARRAY=1 | ||
19 | fi | ||
20 | ]) | ||
21 | |||
22 | # Prerequisites of lib/reallocarray.c. | ||
23 | AC_DEFUN([gl_PREREQ_REALLOCARRAY], [:]) | ||
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index 0945c11..c89a143 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 | |||
@@ -1,6 +1,6 @@ | |||
1 | # serial 64 | 1 | # serial 73 |
2 | 2 | ||
3 | # Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc. | 3 | # Copyright (C) 1996-2001, 2003-2023 Free Software Foundation, Inc. |
4 | # | 4 | # |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
@@ -13,6 +13,7 @@ AC_PREREQ([2.50]) | |||
13 | 13 | ||
14 | AC_DEFUN([gl_REGEX], | 14 | AC_DEFUN([gl_REGEX], |
15 | [ | 15 | [ |
16 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
16 | AC_ARG_WITH([included-regex], | 17 | AC_ARG_WITH([included-regex], |
17 | [AS_HELP_STRING([--without-included-regex], | 18 | [AS_HELP_STRING([--without-included-regex], |
18 | [don't compile regex; this is the default on systems | 19 | [don't compile regex; this is the default on systems |
@@ -28,6 +29,7 @@ AC_DEFUN([gl_REGEX], | |||
28 | # If cross compiling, assume the test would fail and use the included | 29 | # If cross compiling, assume the test would fail and use the included |
29 | # regex.c. | 30 | # regex.c. |
30 | AC_CHECK_DECLS_ONCE([alarm]) | 31 | AC_CHECK_DECLS_ONCE([alarm]) |
32 | AC_CHECK_HEADERS_ONCE([malloc.h]) | ||
31 | AC_CACHE_CHECK([for working re_compile_pattern], | 33 | AC_CACHE_CHECK([for working re_compile_pattern], |
32 | [gl_cv_func_re_compile_pattern_working], | 34 | [gl_cv_func_re_compile_pattern_working], |
33 | [AC_RUN_IFELSE( | 35 | [AC_RUN_IFELSE( |
@@ -37,9 +39,19 @@ AC_DEFUN([gl_REGEX], | |||
37 | #include <locale.h> | 39 | #include <locale.h> |
38 | #include <limits.h> | 40 | #include <limits.h> |
39 | #include <string.h> | 41 | #include <string.h> |
40 | #if HAVE_DECL_ALARM | 42 | |
41 | # include <unistd.h> | 43 | #if defined M_CHECK_ACTION || HAVE_DECL_ALARM |
42 | # include <signal.h> | 44 | # include <signal.h> |
45 | # include <unistd.h> | ||
46 | #endif | ||
47 | |||
48 | #if HAVE_MALLOC_H | ||
49 | # include <malloc.h> | ||
50 | #endif | ||
51 | |||
52 | #ifdef M_CHECK_ACTION | ||
53 | /* Exit with distinguishable exit code. */ | ||
54 | static void sigabrt_no_core (int sig) { raise (SIGTERM); } | ||
43 | #endif | 55 | #endif |
44 | ]], | 56 | ]], |
45 | [[int result = 0; | 57 | [[int result = 0; |
@@ -49,15 +61,22 @@ AC_DEFUN([gl_REGEX], | |||
49 | const char *s; | 61 | const char *s; |
50 | struct re_registers regs; | 62 | struct re_registers regs; |
51 | 63 | ||
64 | /* Some builds of glibc go into an infinite loop on this | ||
65 | test. Use alarm to force death, and mallopt to avoid | ||
66 | malloc recursion in diagnosing the corrupted heap. */ | ||
52 | #if HAVE_DECL_ALARM | 67 | #if HAVE_DECL_ALARM |
53 | /* Some builds of glibc go into an infinite loop on this test. */ | ||
54 | signal (SIGALRM, SIG_DFL); | 68 | signal (SIGALRM, SIG_DFL); |
55 | alarm (2); | 69 | alarm (2); |
56 | #endif | 70 | #endif |
71 | #ifdef M_CHECK_ACTION | ||
72 | signal (SIGABRT, sigabrt_no_core); | ||
73 | mallopt (M_CHECK_ACTION, 2); | ||
74 | #endif | ||
75 | |||
57 | if (setlocale (LC_ALL, "en_US.UTF-8")) | 76 | if (setlocale (LC_ALL, "en_US.UTF-8")) |
58 | { | 77 | { |
59 | { | 78 | { |
60 | /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html | 79 | /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html |
61 | This test needs valgrind to catch the bug on Debian | 80 | This test needs valgrind to catch the bug on Debian |
62 | GNU/Linux 3.1 x86, but it might catch the bug better | 81 | GNU/Linux 3.1 x86, but it might catch the bug better |
63 | on other platforms and it shouldn't hurt to try the | 82 | on other platforms and it shouldn't hurt to try the |
@@ -71,16 +90,20 @@ AC_DEFUN([gl_REGEX], | |||
71 | s = re_compile_pattern (pat, sizeof pat - 1, ®ex); | 90 | s = re_compile_pattern (pat, sizeof pat - 1, ®ex); |
72 | if (s) | 91 | if (s) |
73 | result |= 1; | 92 | result |= 1; |
74 | else if (re_search (®ex, data, sizeof data - 1, | 93 | else |
75 | 0, sizeof data - 1, ®s) | 94 | { |
76 | != -1) | 95 | if (re_search (®ex, data, sizeof data - 1, |
77 | result |= 1; | 96 | 0, sizeof data - 1, ®s) |
97 | != -1) | ||
98 | result |= 1; | ||
99 | regfree (®ex); | ||
100 | } | ||
78 | } | 101 | } |
79 | 102 | ||
80 | { | 103 | { |
81 | /* This test is from glibc bug 15078. | 104 | /* This test is from glibc bug 15078. |
82 | The test case is from Andreas Schwab in | 105 | The test case is from Andreas Schwab in |
83 | <http://www.sourceware.org/ml/libc-alpha/2013-01/msg00967.html>. | 106 | <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>. |
84 | */ | 107 | */ |
85 | static char const pat[] = "[^x]x"; | 108 | static char const pat[] = "[^x]x"; |
86 | static char const data[] = | 109 | static char const data[] = |
@@ -105,6 +128,7 @@ AC_DEFUN([gl_REGEX], | |||
105 | 0, sizeof data - 1, 0); | 128 | 0, sizeof data - 1, 0); |
106 | if (i != 0 && i != 21) | 129 | if (i != 0 && i != 21) |
107 | result |= 1; | 130 | result |= 1; |
131 | regfree (®ex); | ||
108 | } | 132 | } |
109 | } | 133 | } |
110 | 134 | ||
@@ -118,9 +142,13 @@ AC_DEFUN([gl_REGEX], | |||
118 | s = re_compile_pattern ("a[^x]b", 6, ®ex); | 142 | s = re_compile_pattern ("a[^x]b", 6, ®ex); |
119 | if (s) | 143 | if (s) |
120 | result |= 2; | 144 | result |= 2; |
121 | /* This should fail, but succeeds for glibc-2.5. */ | 145 | else |
122 | else if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) | 146 | { |
123 | result |= 2; | 147 | /* This should fail, but succeeds for glibc-2.5. */ |
148 | if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) | ||
149 | result |= 2; | ||
150 | regfree (®ex); | ||
151 | } | ||
124 | 152 | ||
125 | /* This regular expression is from Spencer ere test number 75 | 153 | /* This regular expression is from Spencer ere test number 75 |
126 | in grep-2.3. */ | 154 | in grep-2.3. */ |
@@ -132,7 +160,10 @@ AC_DEFUN([gl_REGEX], | |||
132 | s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); | 160 | s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); |
133 | /* This should fail with _Invalid character class name_ error. */ | 161 | /* This should fail with _Invalid character class name_ error. */ |
134 | if (!s) | 162 | if (!s) |
135 | result |= 4; | 163 | { |
164 | result |= 4; | ||
165 | regfree (®ex); | ||
166 | } | ||
136 | 167 | ||
137 | /* Ensure that [b-a] is diagnosed as invalid, when | 168 | /* Ensure that [b-a] is diagnosed as invalid, when |
138 | using RE_NO_EMPTY_RANGES. */ | 169 | using RE_NO_EMPTY_RANGES. */ |
@@ -140,13 +171,18 @@ AC_DEFUN([gl_REGEX], | |||
140 | memset (®ex, 0, sizeof regex); | 171 | memset (®ex, 0, sizeof regex); |
141 | s = re_compile_pattern ("a[b-a]", 6, ®ex); | 172 | s = re_compile_pattern ("a[b-a]", 6, ®ex); |
142 | if (s == 0) | 173 | if (s == 0) |
143 | result |= 8; | 174 | { |
175 | result |= 8; | ||
176 | regfree (®ex); | ||
177 | } | ||
144 | 178 | ||
145 | /* This should succeed, but does not for glibc-2.1.3. */ | 179 | /* This should succeed, but does not for glibc-2.1.3. */ |
146 | memset (®ex, 0, sizeof regex); | 180 | memset (®ex, 0, sizeof regex); |
147 | s = re_compile_pattern ("{1", 2, ®ex); | 181 | s = re_compile_pattern ("{1", 2, ®ex); |
148 | if (s) | 182 | if (s) |
149 | result |= 8; | 183 | result |= 8; |
184 | else | ||
185 | regfree (®ex); | ||
150 | 186 | ||
151 | /* The following example is derived from a problem report | 187 | /* The following example is derived from a problem report |
152 | against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ | 188 | against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ |
@@ -154,17 +190,35 @@ AC_DEFUN([gl_REGEX], | |||
154 | s = re_compile_pattern ("[an\371]*n", 7, ®ex); | 190 | s = re_compile_pattern ("[an\371]*n", 7, ®ex); |
155 | if (s) | 191 | if (s) |
156 | result |= 8; | 192 | result |= 8; |
157 | /* This should match, but does not for glibc-2.2.1. */ | 193 | else |
158 | else if (re_match (®ex, "an", 2, 0, ®s) != 2) | 194 | { |
159 | result |= 8; | 195 | /* This should match, but does not for glibc-2.2.1. */ |
196 | if (re_match (®ex, "an", 2, 0, ®s) != 2) | ||
197 | result |= 8; | ||
198 | else | ||
199 | { | ||
200 | free (regs.start); | ||
201 | free (regs.end); | ||
202 | } | ||
203 | regfree (®ex); | ||
204 | } | ||
160 | 205 | ||
161 | memset (®ex, 0, sizeof regex); | 206 | memset (®ex, 0, sizeof regex); |
162 | s = re_compile_pattern ("x", 1, ®ex); | 207 | s = re_compile_pattern ("x", 1, ®ex); |
163 | if (s) | 208 | if (s) |
164 | result |= 8; | 209 | result |= 8; |
165 | /* glibc-2.2.93 does not work with a negative RANGE argument. */ | 210 | else |
166 | else if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) | 211 | { |
167 | result |= 8; | 212 | /* glibc-2.2.93 does not work with a negative RANGE argument. */ |
213 | if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) | ||
214 | result |= 8; | ||
215 | else | ||
216 | { | ||
217 | free (regs.start); | ||
218 | free (regs.end); | ||
219 | } | ||
220 | regfree (®ex); | ||
221 | } | ||
168 | 222 | ||
169 | /* The version of regex.c in older versions of gnulib | 223 | /* The version of regex.c in older versions of gnulib |
170 | ignored RE_ICASE. Detect that problem too. */ | 224 | ignored RE_ICASE. Detect that problem too. */ |
@@ -173,25 +227,89 @@ AC_DEFUN([gl_REGEX], | |||
173 | s = re_compile_pattern ("x", 1, ®ex); | 227 | s = re_compile_pattern ("x", 1, ®ex); |
174 | if (s) | 228 | if (s) |
175 | result |= 16; | 229 | result |= 16; |
176 | else if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) | 230 | else |
177 | result |= 16; | 231 | { |
232 | if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) | ||
233 | result |= 16; | ||
234 | else | ||
235 | { | ||
236 | free (regs.start); | ||
237 | free (regs.end); | ||
238 | } | ||
239 | regfree (®ex); | ||
240 | } | ||
178 | 241 | ||
179 | /* Catch a bug reported by Vin Shelton in | 242 | /* Catch a bug reported by Vin Shelton in |
180 | http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html | 243 | https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html |
181 | */ | 244 | */ |
182 | re_set_syntax (RE_SYNTAX_POSIX_BASIC | 245 | re_set_syntax (RE_SYNTAX_POSIX_BASIC |
183 | & ~RE_CONTEXT_INVALID_DUP | 246 | & ~RE_CONTEXT_INVALID_DUP |
184 | & ~RE_NO_EMPTY_RANGES); | 247 | & ~RE_NO_EMPTY_RANGES); |
185 | memset (®ex, 0, sizeof regex); | 248 | memset (®ex, 0, sizeof regex); |
186 | s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); | 249 | s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, ®ex); |
187 | if (s) | 250 | if (s) |
188 | result |= 32; | 251 | result |= 32; |
252 | else | ||
253 | regfree (®ex); | ||
189 | 254 | ||
190 | /* REG_STARTEND was added to glibc on 2004-01-15. | 255 | /* REG_STARTEND was added to glibc on 2004-01-15. |
191 | Reject older versions. */ | 256 | Reject older versions. */ |
192 | if (! REG_STARTEND) | 257 | if (! REG_STARTEND) |
193 | result |= 64; | 258 | result |= 64; |
194 | 259 | ||
260 | /* Matching with the compiled form of this regexp would provoke | ||
261 | an assertion failure prior to glibc-2.28: | ||
262 | regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed | ||
263 | With glibc-2.28, compilation fails and reports the invalid | ||
264 | back reference. */ | ||
265 | re_set_syntax (RE_SYNTAX_POSIX_EGREP); | ||
266 | memset (®ex, 0, sizeof regex); | ||
267 | s = re_compile_pattern ("0|()0|\\\\1|0", 10, ®ex); | ||
268 | if (!s) | ||
269 | { | ||
270 | memset (®s, 0, sizeof regs); | ||
271 | i = re_search (®ex, "x", 1, 0, 1, ®s); | ||
272 | if (i != -1) | ||
273 | result |= 64; | ||
274 | if (0 <= i) | ||
275 | { | ||
276 | free (regs.start); | ||
277 | free (regs.end); | ||
278 | } | ||
279 | regfree (®ex); | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | if (strcmp (s, "Invalid back reference")) | ||
284 | result |= 64; | ||
285 | } | ||
286 | |||
287 | /* glibc bug 11053. */ | ||
288 | re_set_syntax (RE_SYNTAX_POSIX_BASIC); | ||
289 | memset (®ex, 0, sizeof regex); | ||
290 | static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1"; | ||
291 | s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); | ||
292 | if (s) | ||
293 | result |= 64; | ||
294 | else | ||
295 | { | ||
296 | memset (®s, 0, sizeof regs); | ||
297 | static char const data[] = "a"; | ||
298 | int datalen = sizeof data - 1; | ||
299 | i = re_search (®ex, data, datalen, 0, datalen, ®s); | ||
300 | if (i != 0) | ||
301 | result |= 64; | ||
302 | else if (regs.num_regs < 2) | ||
303 | result |= 64; | ||
304 | else if (! (regs.start[0] == 0 && regs.end[0] == 1)) | ||
305 | result |= 64; | ||
306 | else if (! (regs.start[1] == 0 && regs.end[1] == 0)) | ||
307 | result |= 64; | ||
308 | regfree (®ex); | ||
309 | free (regs.start); | ||
310 | free (regs.end); | ||
311 | } | ||
312 | |||
195 | #if 0 | 313 | #if 0 |
196 | /* It would be nice to reject hosts whose regoff_t values are too | 314 | /* It would be nice to reject hosts whose regoff_t values are too |
197 | narrow (including glibc on hosts with 64-bit ptrdiff_t and | 315 | narrow (including glibc on hosts with 64-bit ptrdiff_t and |
@@ -206,13 +324,19 @@ AC_DEFUN([gl_REGEX], | |||
206 | 324 | ||
207 | return result; | 325 | return result; |
208 | ]])], | 326 | ]])], |
209 | [gl_cv_func_re_compile_pattern_working=yes], | 327 | [gl_cv_func_re_compile_pattern_working=yes], |
210 | [gl_cv_func_re_compile_pattern_working=no], | 328 | [gl_cv_func_re_compile_pattern_working=no], |
211 | dnl When crosscompiling, assume it is not working. | 329 | [case "$host_os" in |
212 | [gl_cv_func_re_compile_pattern_working=no])]) | 330 | # Guess no on native Windows. |
213 | case $gl_cv_func_re_compile_pattern_working in #( | 331 | mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; |
214 | yes) ac_use_included_regex=no;; #( | 332 | # Otherwise obey --enable-cross-guesses. |
215 | no) ac_use_included_regex=yes;; | 333 | *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; |
334 | esac | ||
335 | ]) | ||
336 | ]) | ||
337 | case "$gl_cv_func_re_compile_pattern_working" in #( | ||
338 | *yes) ac_use_included_regex=no;; #( | ||
339 | *no) ac_use_included_regex=yes;; | ||
216 | esac | 340 | esac |
217 | ;; | 341 | ;; |
218 | *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) | 342 | *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) |
@@ -266,8 +390,7 @@ AC_DEFUN([gl_PREREQ_REGEX], | |||
266 | AC_REQUIRE([AC_C_RESTRICT]) | 390 | AC_REQUIRE([AC_C_RESTRICT]) |
267 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | 391 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) |
268 | AC_REQUIRE([gl_EEMALLOC]) | 392 | AC_REQUIRE([gl_EEMALLOC]) |
269 | AC_REQUIRE([gl_GLIBC21]) | ||
270 | AC_CHECK_HEADERS([libintl.h]) | 393 | AC_CHECK_HEADERS([libintl.h]) |
271 | AC_CHECK_FUNCS_ONCE([isblank iswctype wcscoll]) | 394 | AC_CHECK_FUNCS_ONCE([isblank iswctype]) |
272 | AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) | 395 | AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) |
273 | ]) | 396 | ]) |
diff --git a/gl/m4/safe-read.m4 b/gl/m4/safe-read.m4 deleted file mode 100644 index be5207a..0000000 --- a/gl/m4/safe-read.m4 +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | # safe-read.m4 serial 6 | ||
2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, | ||
3 | dnl 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 | |||
8 | # Prerequisites of lib/safe-read.c. | ||
9 | AC_DEFUN([gl_PREREQ_SAFE_READ], | ||
10 | [ | ||
11 | AC_REQUIRE([gt_TYPE_SSIZE_T]) | ||
12 | ]) | ||
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 01c037a..0f35b8b 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # servent.m4 serial 2 | 1 | # servent.m4 serial 4 |
2 | dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -10,12 +10,12 @@ AC_DEFUN([gl_SERVENT], | |||
10 | dnl getservbyport() defined? | 10 | dnl getservbyport() defined? |
11 | dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(), | 11 | dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(), |
12 | dnl getprotobynumber() defined? | 12 | dnl getprotobynumber() defined? |
13 | dnl - On Solaris, they are in libsocket. Ignore libxnet. | 13 | dnl - On Solaris < 11.4, they are in libsocket. Ignore libxnet. |
14 | dnl - On Haiku, they are in libnetwork. | 14 | dnl - On Haiku, they are in libnetwork. |
15 | dnl - On BeOS, they are in libnet. | 15 | dnl - On BeOS, they are in libnet. |
16 | dnl - On native Windows, they are in ws2_32.dll. | 16 | dnl - On native Windows, they are in ws2_32.dll. |
17 | dnl - Otherwise they are in libc. | 17 | dnl - Otherwise they are in libc. |
18 | AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H | 18 | AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H |
19 | SERVENT_LIB= | 19 | SERVENT_LIB= |
20 | gl_saved_libs="$LIBS" | 20 | gl_saved_libs="$LIBS" |
21 | AC_SEARCH_LIBS([getservbyname], [socket network net], | 21 | AC_SEARCH_LIBS([getservbyname], [socket network net], |
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4 index cb5351a..16f9eb5 100644 --- a/gl/m4/setenv.m4 +++ b/gl/m4/setenv.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # setenv.m4 serial 26 | 1 | # setenv.m4 serial 30 |
2 | dnl Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -35,10 +35,12 @@ AC_DEFUN([gl_FUNC_SETENV], | |||
35 | ]])], | 35 | ]])], |
36 | [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], | 36 | [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], |
37 | [case "$host_os" in | 37 | [case "$host_os" in |
38 | # Guess yes on glibc systems. | 38 | # Guess yes on glibc systems. |
39 | *-gnu*) gl_cv_func_setenv_works="guessing yes" ;; | 39 | *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; |
40 | # If we don't know, assume the worst. | 40 | # Guess yes on musl systems. |
41 | *) gl_cv_func_setenv_works="guessing no" ;; | 41 | *-musl*) gl_cv_func_setenv_works="guessing yes" ;; |
42 | # If we don't know, obey --enable-cross-guesses. | ||
43 | *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; | ||
42 | esac | 44 | esac |
43 | ])]) | 45 | ])]) |
44 | case "$gl_cv_func_setenv_works" in | 46 | case "$gl_cv_func_setenv_works" in |
@@ -104,35 +106,39 @@ int unsetenv (const char *name); | |||
104 | dnl OpenBSD 4.7 unsetenv("") does not fail. | 106 | dnl OpenBSD 4.7 unsetenv("") does not fail. |
105 | AC_CACHE_CHECK([whether unsetenv obeys POSIX], | 107 | AC_CACHE_CHECK([whether unsetenv obeys POSIX], |
106 | [gl_cv_func_unsetenv_works], | 108 | [gl_cv_func_unsetenv_works], |
107 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | 109 | [AC_RUN_IFELSE( |
108 | #include <stdlib.h> | 110 | [AC_LANG_PROGRAM([[ |
109 | #include <errno.h> | 111 | #include <stdlib.h> |
110 | extern char **environ; | 112 | #include <errno.h> |
111 | ]], [[ | 113 | extern char **environ; |
112 | char entry1[] = "a=1"; | 114 | ]GL_MDA_DEFINES], |
113 | char entry2[] = "b=2"; | 115 | [[ |
114 | char *env[] = { entry1, entry2, NULL }; | 116 | char entry1[] = "a=1"; |
115 | if (putenv ((char *) "a=1")) return 1; | 117 | char entry2[] = "b=2"; |
116 | if (putenv (entry2)) return 2; | 118 | char *env[] = { entry1, entry2, NULL }; |
117 | entry2[0] = 'a'; | 119 | if (putenv ((char *) "a=1")) return 1; |
118 | unsetenv ("a"); | 120 | if (putenv (entry2)) return 2; |
119 | if (getenv ("a")) return 3; | 121 | entry2[0] = 'a'; |
120 | if (!unsetenv ("") || errno != EINVAL) return 4; | 122 | unsetenv ("a"); |
121 | entry2[0] = 'b'; | 123 | if (getenv ("a")) return 3; |
122 | environ = env; | 124 | if (!unsetenv ("") || errno != EINVAL) return 4; |
123 | if (!getenv ("a")) return 5; | 125 | entry2[0] = 'b'; |
124 | entry2[0] = 'a'; | 126 | environ = env; |
125 | unsetenv ("a"); | 127 | if (!getenv ("a")) return 5; |
126 | if (getenv ("a")) return 6; | 128 | entry2[0] = 'a'; |
127 | ]])], | 129 | unsetenv ("a"); |
128 | [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no], | 130 | if (getenv ("a")) return 6; |
129 | [case "$host_os" in | 131 | ]])], |
130 | # Guess yes on glibc systems. | 132 | [gl_cv_func_unsetenv_works=yes], |
131 | *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; | 133 | [gl_cv_func_unsetenv_works=no], |
132 | # If we don't know, assume the worst. | 134 | [case "$host_os" in |
133 | *) gl_cv_func_unsetenv_works="guessing no" ;; | 135 | # Guess yes on glibc systems. |
134 | esac | 136 | *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; |
135 | ])]) | 137 | # If we don't know, obey --enable-cross-guesses. |
138 | *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; | ||
139 | esac | ||
140 | ]) | ||
141 | ]) | ||
136 | case "$gl_cv_func_unsetenv_works" in | 142 | case "$gl_cv_func_unsetenv_works" in |
137 | *yes) ;; | 143 | *yes) ;; |
138 | *) | 144 | *) |
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4 new file mode 100644 index 0000000..032119d --- /dev/null +++ b/gl/m4/setlocale_null.m4 | |||
@@ -0,0 +1,98 @@ | |||
1 | # setlocale_null.m4 serial 5 | ||
2 | dnl Copyright (C) 2019-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_FUNC_SETLOCALE_NULL], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
10 | AC_REQUIRE([gl_PTHREADLIB]) | ||
11 | AC_CHECK_HEADERS_ONCE([threads.h]) | ||
12 | |||
13 | AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], | ||
14 | [gl_cv_func_setlocale_null_all_mtsafe], | ||
15 | [case "$host_os" in | ||
16 | # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. | ||
17 | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) | ||
18 | gl_cv_func_setlocale_null_all_mtsafe=no ;; | ||
19 | # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. | ||
20 | *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) | ||
21 | gl_cv_func_setlocale_null_all_mtsafe=yes ;; | ||
22 | # If we don't know, obey --enable-cross-guesses. | ||
23 | *) | ||
24 | gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; | ||
25 | esac | ||
26 | ]) | ||
27 | dnl On platforms without multithreading, there is no issue. | ||
28 | case "$host_os" in | ||
29 | mingw*) ;; | ||
30 | *) | ||
31 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | ||
32 | gl_cv_func_setlocale_null_all_mtsafe="trivially yes" | ||
33 | fi | ||
34 | ;; | ||
35 | esac | ||
36 | case "$gl_cv_func_setlocale_null_all_mtsafe" in | ||
37 | *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; | ||
38 | *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; | ||
39 | esac | ||
40 | AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE], | ||
41 | [Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.]) | ||
42 | |||
43 | dnl This is about a single category (not LC_ALL). | ||
44 | AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe], | ||
45 | [gl_cv_func_setlocale_null_one_mtsafe], | ||
46 | [case "$host_os" in | ||
47 | # Guess no on OpenBSD, AIX. | ||
48 | openbsd* | aix*) | ||
49 | 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. | ||
51 | *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) | ||
52 | gl_cv_func_setlocale_null_one_mtsafe=yes ;; | ||
53 | # If we don't know, obey --enable-cross-guesses. | ||
54 | *) | ||
55 | gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; | ||
56 | esac | ||
57 | ]) | ||
58 | dnl On platforms without multithreading, there is no issue. | ||
59 | case "$host_os" in | ||
60 | mingw*) ;; | ||
61 | *) | ||
62 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | ||
63 | gl_cv_func_setlocale_null_one_mtsafe="trivially yes" | ||
64 | fi | ||
65 | ;; | ||
66 | esac | ||
67 | case "$gl_cv_func_setlocale_null_one_mtsafe" in | ||
68 | *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; | ||
69 | *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; | ||
70 | esac | ||
71 | AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE], | ||
72 | [Define to 1 if setlocale (category, NULL) is multithread-safe.]) | ||
73 | |||
74 | 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 | ||
76 | case "$host_os" in | ||
77 | mingw*) LIB_SETLOCALE_NULL= ;; | ||
78 | *) | ||
79 | gl_WEAK_SYMBOLS | ||
80 | case "$gl_cv_have_weak" in | ||
81 | *yes) LIB_SETLOCALE_NULL= ;; | ||
82 | *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; | ||
83 | esac | ||
84 | ;; | ||
85 | esac | ||
86 | else | ||
87 | LIB_SETLOCALE_NULL= | ||
88 | fi | ||
89 | dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX | ||
90 | dnl with gcc or xlc, and empty otherwise. | ||
91 | AC_SUBST([LIB_SETLOCALE_NULL]) | ||
92 | ]) | ||
93 | |||
94 | # Prerequisites of lib/setlocale-lock.c. | ||
95 | AC_DEFUN([gl_PREREQ_SETLOCALE_LOCK], | ||
96 | [ | ||
97 | gl_VISIBILITY | ||
98 | ]) | ||
diff --git a/gl/m4/sha1.m4 b/gl/m4/sha1.m4 index 21c775e..16b79c0 100644 --- a/gl/m4/sha1.m4 +++ b/gl/m4/sha1.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # sha1.m4 serial 11 | 1 | # sha1.m4 serial 12 |
2 | dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,5 +8,7 @@ AC_DEFUN([gl_SHA1], | |||
8 | [ | 8 | [ |
9 | dnl Prerequisites of lib/sha1.c. | 9 | dnl Prerequisites of lib/sha1.c. |
10 | AC_REQUIRE([gl_BIGENDIAN]) | 10 | AC_REQUIRE([gl_BIGENDIAN]) |
11 | : | 11 | |
12 | dnl Determine HAVE_OPENSSL_SHA1 and LIB_CRYPTO | ||
13 | gl_CRYPTO_CHECK([SHA1]) | ||
12 | ]) | 14 | ]) |
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index 4b247ab..0763366 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 | |||
@@ -1,17 +1,19 @@ | |||
1 | # size_max.m4 serial 10 | 1 | # size_max.m4 serial 12 |
2 | dnl Copyright (C) 2003, 2005-2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
8 | 8 | ||
9 | AC_PREREQ([2.61]) | ||
10 | |||
9 | AC_DEFUN([gl_SIZE_MAX], | 11 | AC_DEFUN([gl_SIZE_MAX], |
10 | [ | 12 | [ |
11 | AC_CHECK_HEADERS([stdint.h]) | 13 | AC_CHECK_HEADERS([stdint.h]) |
12 | dnl First test whether the system already has SIZE_MAX. | 14 | dnl First test whether the system already has SIZE_MAX. |
13 | AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ | 15 | AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ |
14 | gl_cv_size_max= | 16 | gl_cv_size_max=no |
15 | AC_EGREP_CPP([Found it], [ | 17 | AC_EGREP_CPP([Found it], [ |
16 | #include <limits.h> | 18 | #include <limits.h> |
17 | #if HAVE_STDINT_H | 19 | #if HAVE_STDINT_H |
@@ -21,7 +23,7 @@ AC_DEFUN([gl_SIZE_MAX], | |||
21 | Found it | 23 | Found it |
22 | #endif | 24 | #endif |
23 | ], [gl_cv_size_max=yes]) | 25 | ], [gl_cv_size_max=yes]) |
24 | if test -z "$gl_cv_size_max"; then | 26 | if test $gl_cv_size_max != yes; then |
25 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider | 27 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider |
26 | dnl than the type 'unsigned long'. Try hard to find a definition that can | 28 | dnl than the type 'unsigned long'. Try hard to find a definition that can |
27 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. | 29 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. |
@@ -71,9 +73,3 @@ Found it | |||
71 | # undef SIZE_MAX | 73 | # undef SIZE_MAX |
72 | #endif]) | 74 | #endif]) |
73 | ]) | 75 | ]) |
74 | |||
75 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | ||
76 | dnl Remove this when we can assume autoconf >= 2.61. | ||
77 | m4_ifdef([AC_COMPUTE_INT], [], [ | ||
78 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | ||
79 | ]) | ||
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 3698e84..4b5fbdb 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # snprintf.m4 serial 6 | 1 | # snprintf.m4 serial 7 |
2 | dnl Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -46,6 +46,14 @@ AC_DEFUN([gl_REPLACE_SNPRINTF], | |||
46 | AC_LIBOBJ([snprintf]) | 46 | AC_LIBOBJ([snprintf]) |
47 | if test $ac_cv_func_snprintf = yes; then | 47 | if test $ac_cv_func_snprintf = yes; then |
48 | REPLACE_SNPRINTF=1 | 48 | REPLACE_SNPRINTF=1 |
49 | else | ||
50 | AC_CHECK_DECLS_ONCE([snprintf]) | ||
51 | if test $ac_cv_have_decl_snprintf = yes; then | ||
52 | dnl If the function is declared but does not appear to exist, it may be | ||
53 | dnl defined as an inline function. In order to avoid a conflict, we have | ||
54 | dnl to define rpl_snprintf, not snprintf. | ||
55 | REPLACE_SNPRINTF=1 | ||
56 | fi | ||
49 | fi | 57 | fi |
50 | gl_PREREQ_SNPRINTF | 58 | gl_PREREQ_SNPRINTF |
51 | ]) | 59 | ]) |
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 index b08a72f..a556af1 100644 --- a/gl/m4/socketlib.m4 +++ b/gl/m4/socketlib.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # socketlib.m4 serial 1 | 1 | # socketlib.m4 serial 3 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -14,21 +14,27 @@ AC_DEFUN([gl_SOCKETLIB], | |||
14 | LIBSOCKET= | 14 | LIBSOCKET= |
15 | if test $HAVE_WINSOCK2_H = 1; then | 15 | if test $HAVE_WINSOCK2_H = 1; then |
16 | dnl Native Windows API (not Cygwin). | 16 | dnl Native Windows API (not Cygwin). |
17 | AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], | 17 | dnl If the function WSAStartup exists (declared in <winsock2.h> and |
18 | [gl_cv_func_wsastartup], [ | 18 | dnl defined through -lws2_32), we need to call it. |
19 | gl_save_LIBS="$LIBS" | 19 | AC_CACHE_CHECK([for WSAStartup], |
20 | LIBS="$LIBS -lws2_32" | 20 | [gl_cv_func_wsastartup], [ |
21 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 21 | gl_save_LIBS="$LIBS" |
22 | LIBS="$LIBS -lws2_32" | ||
23 | AC_LINK_IFELSE( | ||
24 | [AC_LANG_PROGRAM([[ | ||
22 | #ifdef HAVE_WINSOCK2_H | 25 | #ifdef HAVE_WINSOCK2_H |
23 | # include <winsock2.h> | 26 | # include <winsock2.h> |
24 | #endif]], [[ | 27 | #endif]], [[ |
25 | WORD wVersionRequested = MAKEWORD(1, 1); | 28 | WORD wVersionRequested = MAKEWORD(1, 1); |
26 | WSADATA wsaData; | 29 | WSADATA wsaData; |
27 | int err = WSAStartup(wVersionRequested, &wsaData); | 30 | int err = WSAStartup(wVersionRequested, &wsaData); |
28 | WSACleanup ();]])], | 31 | WSACleanup (); |
29 | gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) | 32 | ]]) |
30 | LIBS="$gl_save_LIBS" | 33 | ], |
31 | ]) | 34 | [gl_cv_func_wsastartup=yes], |
35 | [gl_cv_func_wsastartup=no]) | ||
36 | LIBS="$gl_save_LIBS" | ||
37 | ]) | ||
32 | if test "$gl_cv_func_wsastartup" = "yes"; then | 38 | if test "$gl_cv_func_wsastartup" = "yes"; then |
33 | AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) | 39 | AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) |
34 | LIBSOCKET='-lws2_32' | 40 | LIBSOCKET='-lws2_32' |
@@ -38,6 +44,10 @@ AC_DEFUN([gl_SOCKETLIB], | |||
38 | dnl Solaris has most socket functions in libsocket. | 44 | dnl Solaris has most socket functions in libsocket. |
39 | dnl Haiku has most socket functions in libnetwork. | 45 | dnl Haiku has most socket functions in libnetwork. |
40 | dnl BeOS has most socket functions in libnet. | 46 | dnl BeOS has most socket functions in libnet. |
47 | dnl On HP-UX, do NOT link with libxnet, because in 64-bit mode this would | ||
48 | dnl break code (e.g. in libraries) that invokes accept(), getpeername(), | ||
49 | dnl getsockname(), getsockopt(), or recvfrom() with a 32-bit addrlen. See | ||
50 | dnl "man xopen_networking" for details. | ||
41 | AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ | 51 | AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ |
42 | gl_cv_lib_socket= | 52 | gl_cv_lib_socket= |
43 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern | 53 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern |
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index b407391..ed9cb87 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # sockets.m4 serial 7 | 1 | # sockets.m4 serial 7 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index e3efd6e..1c63a85 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # socklen.m4 serial 10 | 1 | # socklen.m4 serial 11 |
2 | dnl Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -15,8 +15,8 @@ dnl So we have to test to find something that will work. | |||
15 | AC_DEFUN([gl_TYPE_SOCKLEN_T], | 15 | AC_DEFUN([gl_TYPE_SOCKLEN_T], |
16 | [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl | 16 | [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl |
17 | AC_CHECK_TYPE([socklen_t], , | 17 | AC_CHECK_TYPE([socklen_t], , |
18 | [AC_MSG_CHECKING([for socklen_t equivalent]) | 18 | [AC_CACHE_CHECK([for socklen_t equivalent], |
19 | AC_CACHE_VAL([gl_cv_socklen_t_equiv], | 19 | [gl_cv_socklen_t_equiv], |
20 | [# Systems have either "struct sockaddr *" or | 20 | [# Systems have either "struct sockaddr *" or |
21 | # "void *" as the second argument to getpeername | 21 | # "void *" as the second argument to getpeername |
22 | gl_cv_socklen_t_equiv= | 22 | gl_cv_socklen_t_equiv= |
@@ -34,11 +34,10 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T], | |||
34 | done | 34 | done |
35 | test "$gl_cv_socklen_t_equiv" != "" && break | 35 | test "$gl_cv_socklen_t_equiv" != "" && break |
36 | done | 36 | done |
37 | ]) | 37 | if test "$gl_cv_socklen_t_equiv" = ""; then |
38 | if test "$gl_cv_socklen_t_equiv" = ""; then | 38 | AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) |
39 | AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) | 39 | fi |
40 | fi | 40 | ]) |
41 | AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) | ||
42 | AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], | 41 | AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], |
43 | [type to use in place of socklen_t if not defined])], | 42 | [type to use in place of socklen_t if not defined])], |
44 | [gl_SOCKET_HEADERS])]) | 43 | [gl_SOCKET_HEADERS])]) |
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 89557b1..6c6dc2f 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # sockpfaf.m4 serial 8 | 1 | # sockpfaf.m4 serial 10 |
2 | dnl Copyright (C) 2004, 2006, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -13,11 +13,11 @@ dnl From Bruno Haible. | |||
13 | 13 | ||
14 | AC_DEFUN([gl_SOCKET_FAMILIES], | 14 | AC_DEFUN([gl_SOCKET_FAMILIES], |
15 | [ | 15 | [ |
16 | AC_REQUIRE([gl_HEADER_SYS_SOCKET]) | 16 | AC_REQUIRE([gl_SYS_SOCKET_H]) |
17 | AC_CHECK_HEADERS_ONCE([netinet/in.h]) | 17 | AC_CHECK_HEADERS_ONCE([netinet/in.h]) |
18 | 18 | ||
19 | AC_MSG_CHECKING([for IPv4 sockets]) | 19 | AC_CACHE_CHECK([for IPv4 sockets], |
20 | AC_CACHE_VAL([gl_cv_socket_ipv4], | 20 | [gl_cv_socket_ipv4], |
21 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | 21 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
22 | #ifdef HAVE_SYS_SOCKET_H | 22 | #ifdef HAVE_SYS_SOCKET_H |
23 | #include <sys/socket.h> | 23 | #include <sys/socket.h> |
@@ -31,13 +31,12 @@ AC_DEFUN([gl_SOCKET_FAMILIES], | |||
31 | [[int x = AF_INET; struct in_addr y; struct sockaddr_in z; | 31 | [[int x = AF_INET; struct in_addr y; struct sockaddr_in z; |
32 | if (&x && &y && &z) return 0;]])], | 32 | if (&x && &y && &z) return 0;]])], |
33 | gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) | 33 | gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) |
34 | AC_MSG_RESULT([$gl_cv_socket_ipv4]) | ||
35 | if test $gl_cv_socket_ipv4 = yes; then | 34 | if test $gl_cv_socket_ipv4 = yes; then |
36 | AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.]) | 35 | AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.]) |
37 | fi | 36 | fi |
38 | 37 | ||
39 | AC_MSG_CHECKING([for IPv6 sockets]) | 38 | AC_CACHE_CHECK([for IPv6 sockets], |
40 | AC_CACHE_VAL([gl_cv_socket_ipv6], | 39 | [gl_cv_socket_ipv6], |
41 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | 40 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
42 | #ifdef HAVE_SYS_SOCKET_H | 41 | #ifdef HAVE_SYS_SOCKET_H |
43 | #include <sys/socket.h> | 42 | #include <sys/socket.h> |
@@ -54,7 +53,6 @@ AC_DEFUN([gl_SOCKET_FAMILIES], | |||
54 | [[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; | 53 | [[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; |
55 | if (&x && &y && &z) return 0;]])], | 54 | if (&x && &y && &z) return 0;]])], |
56 | gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) | 55 | gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) |
57 | AC_MSG_RESULT([$gl_cv_socket_ipv6]) | ||
58 | if test $gl_cv_socket_ipv6 = yes; then | 56 | if test $gl_cv_socket_ipv6 = yes; then |
59 | AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) | 57 | AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) |
60 | fi | 58 | fi |
@@ -62,11 +60,11 @@ AC_DEFUN([gl_SOCKET_FAMILIES], | |||
62 | 60 | ||
63 | AC_DEFUN([gl_SOCKET_FAMILY_UNIX], | 61 | AC_DEFUN([gl_SOCKET_FAMILY_UNIX], |
64 | [ | 62 | [ |
65 | AC_REQUIRE([gl_HEADER_SYS_SOCKET]) | 63 | AC_REQUIRE([gl_SYS_SOCKET_H]) |
66 | AC_CHECK_HEADERS_ONCE([sys/un.h]) | 64 | AC_CHECK_HEADERS_ONCE([sys/un.h]) |
67 | 65 | ||
68 | AC_MSG_CHECKING([for UNIX domain sockets]) | 66 | AC_CACHE_CHECK([for UNIX domain sockets], |
69 | AC_CACHE_VAL([gl_cv_socket_unix], | 67 | [gl_cv_socket_unix], |
70 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | 68 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
71 | #ifdef HAVE_SYS_SOCKET_H | 69 | #ifdef HAVE_SYS_SOCKET_H |
72 | #include <sys/socket.h> | 70 | #include <sys/socket.h> |
@@ -80,7 +78,6 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], | |||
80 | [[int x = AF_UNIX; struct sockaddr_un y; | 78 | [[int x = AF_UNIX; struct sockaddr_un y; |
81 | if (&x && &y) return 0;]])], | 79 | if (&x && &y) return 0;]])], |
82 | gl_cv_socket_unix=yes, gl_cv_socket_unix=no)]) | 80 | gl_cv_socket_unix=yes, gl_cv_socket_unix=no)]) |
83 | AC_MSG_RESULT([$gl_cv_socket_unix]) | ||
84 | if test $gl_cv_socket_unix = yes; then | 81 | if test $gl_cv_socket_unix = yes; then |
85 | AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.]) | 82 | AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.]) |
86 | fi | 83 | fi |
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index 6338134..1c12c33 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # ssize_t.m4 serial 5 (gettext-0.18.2) | 1 | # ssize_t.m4 serial 5 (gettext-0.18.2) |
2 | dnl Copyright (C) 2001-2003, 2006, 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4 new file mode 100644 index 0000000..40993d5 --- /dev/null +++ b/gl/m4/stat-time.m4 | |||
@@ -0,0 +1,83 @@ | |||
1 | # Checks for stat-related time functions. | ||
2 | |||
3 | # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2023 Free Software | ||
4 | # Foundation, Inc. | ||
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 | |||
10 | dnl From Paul Eggert. | ||
11 | |||
12 | # st_atim.tv_nsec - Linux, Solaris, Cygwin | ||
13 | # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE | ||
14 | # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE | ||
15 | # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) | ||
16 | |||
17 | # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) | ||
18 | # st_birthtim - Cygwin 1.7.0+ | ||
19 | |||
20 | AC_DEFUN([gl_STAT_TIME], | ||
21 | [ | ||
22 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
23 | AC_CHECK_HEADERS_ONCE([sys/time.h]) | ||
24 | |||
25 | AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], | ||
26 | [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], | ||
27 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], | ||
28 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | ||
29 | [[ | ||
30 | #include <sys/types.h> | ||
31 | #include <sys/stat.h> | ||
32 | #if HAVE_SYS_TIME_H | ||
33 | # include <sys/time.h> | ||
34 | #endif | ||
35 | #include <time.h> | ||
36 | struct timespec ts; | ||
37 | struct stat st; | ||
38 | ]], | ||
39 | [[ | ||
40 | st.st_atim = ts; | ||
41 | ]])], | ||
42 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], | ||
43 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) | ||
44 | if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then | ||
45 | AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1], | ||
46 | [Define to 1 if the type of the st_atim member of a struct stat is | ||
47 | struct timespec.]) | ||
48 | fi], | ||
49 | [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], | ||
50 | [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], | ||
51 | [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], | ||
52 | [#include <sys/types.h> | ||
53 | #include <sys/stat.h>])], | ||
54 | [#include <sys/types.h> | ||
55 | #include <sys/stat.h>])], | ||
56 | [#include <sys/types.h> | ||
57 | #include <sys/stat.h>])], | ||
58 | [#include <sys/types.h> | ||
59 | #include <sys/stat.h>]) | ||
60 | ]) | ||
61 | |||
62 | # Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) | ||
63 | # and NTFS (Cygwin). | ||
64 | # There was a time when this field was named st_createtime (21 June | ||
65 | # 2002 to 16 July 2002) But that window is very small and applied only | ||
66 | # to development code, so systems still using that configuration are | ||
67 | # not supported. See revisions 1.10 and 1.11 of FreeBSD's | ||
68 | # src/sys/ufs/ufs/dinode.h. | ||
69 | # | ||
70 | AC_DEFUN([gl_STAT_BIRTHTIME], | ||
71 | [ | ||
72 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
73 | AC_CHECK_HEADERS_ONCE([sys/time.h]) | ||
74 | AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], | ||
75 | [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], | ||
76 | [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], | ||
77 | [#include <sys/types.h> | ||
78 | #include <sys/stat.h>])], | ||
79 | [#include <sys/types.h> | ||
80 | #include <sys/stat.h>])], | ||
81 | [#include <sys/types.h> | ||
82 | #include <sys/stat.h>]) | ||
83 | ]) | ||
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4 new file mode 100644 index 0000000..4d241e2 --- /dev/null +++ b/gl/m4/stat.m4 | |||
@@ -0,0 +1,85 @@ | |||
1 | # serial 18 | ||
2 | |||
3 | # Copyright (C) 2009-2023 Free Software Foundation, Inc. | ||
4 | # | ||
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 | AC_DEFUN([gl_FUNC_STAT], | ||
10 | [ | ||
11 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
13 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
14 | case "$host_os" in | ||
15 | mingw*) | ||
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. | ||
18 | REPLACE_STAT=1 | ||
19 | ;; | ||
20 | *) | ||
21 | dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). | ||
22 | dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) | ||
23 | dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). | ||
24 | AC_CACHE_CHECK([whether stat handles trailing slashes on files], | ||
25 | [gl_cv_func_stat_file_slash], | ||
26 | [touch conftest.tmp | ||
27 | # Assume that if we have lstat, we can also check symlinks. | ||
28 | if test $ac_cv_func_lstat = yes; then | ||
29 | ln -s conftest.tmp conftest.lnk | ||
30 | fi | ||
31 | AC_RUN_IFELSE( | ||
32 | [AC_LANG_PROGRAM( | ||
33 | [[#include <sys/stat.h> | ||
34 | ]], [[int result = 0; | ||
35 | struct stat st; | ||
36 | if (!stat ("conftest.tmp/", &st)) | ||
37 | result |= 1; | ||
38 | #if HAVE_LSTAT | ||
39 | if (!stat ("conftest.lnk/", &st)) | ||
40 | result |= 2; | ||
41 | #endif | ||
42 | return result; | ||
43 | ]])], | ||
44 | [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], | ||
45 | [case "$host_os" in | ||
46 | # Guess yes on Linux systems. | ||
47 | linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; | ||
48 | # Guess yes on glibc systems. | ||
49 | *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; | ||
50 | # If we don't know, obey --enable-cross-guesses. | ||
51 | *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; | ||
52 | esac | ||
53 | ]) | ||
54 | rm -f conftest.tmp conftest.lnk]) | ||
55 | case $gl_cv_func_stat_file_slash in | ||
56 | *no) | ||
57 | REPLACE_STAT=1 | ||
58 | AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs | ||
59 | help when passed a file name with a trailing slash]);; | ||
60 | esac | ||
61 | case $host_os in | ||
62 | dnl Solaris stat can return a negative tv_nsec. | ||
63 | solaris*) | ||
64 | REPLACE_FSTAT=1 ;; | ||
65 | esac | ||
66 | ;; | ||
67 | esac | ||
68 | ]) | ||
69 | |||
70 | # Prerequisites of lib/stat.c and lib/stat-w32.c. | ||
71 | AC_DEFUN([gl_PREREQ_STAT], [ | ||
72 | AC_REQUIRE([gl_SYS_STAT_H]) | ||
73 | AC_REQUIRE([gl_PREREQ_STAT_W32]) | ||
74 | : | ||
75 | ]) | ||
76 | |||
77 | # Prerequisites of lib/stat-w32.c. | ||
78 | AC_DEFUN([gl_PREREQ_STAT_W32], [ | ||
79 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
80 | case "$host_os" in | ||
81 | mingw*) | ||
82 | AC_CHECK_HEADERS([sdkddkver.h]) | ||
83 | ;; | ||
84 | esac | ||
85 | ]) | ||
diff --git a/gl/m4/std-gnu11.m4 b/gl/m4/std-gnu11.m4 new file mode 100644 index 0000000..4179470 --- /dev/null +++ b/gl/m4/std-gnu11.m4 | |||
@@ -0,0 +1,829 @@ | |||
1 | # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- | ||
2 | |||
3 | # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 | ||
4 | # commit 017d5ddd82854911f0119691d91ea8a1438824d6 | ||
5 | # dated Sun Apr 3 13:57:17 2016 -0700 | ||
6 | # This implementation will be obsolete once we can assume Autoconf 2.70 | ||
7 | # or later is installed everywhere a Gnulib program might be developed. | ||
8 | |||
9 | m4_version_prereq([2.70], [], [ | ||
10 | |||
11 | |||
12 | # Copyright (C) 2001-2023 Free Software Foundation, Inc. | ||
13 | |||
14 | # This program is free software; you can redistribute it and/or modify | ||
15 | # it under the terms of the GNU General Public License as published by | ||
16 | # the Free Software Foundation, either version 3 of the License, or | ||
17 | # (at your option) any later version. | ||
18 | # | ||
19 | # This program is distributed in the hope that it will be useful, | ||
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | # GNU General Public License for more details. | ||
23 | # | ||
24 | # 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/>. | ||
26 | |||
27 | # Written by David MacKenzie, with help from | ||
28 | # Akim Demaille, Paul Eggert, | ||
29 | # François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, | ||
30 | # Roland McGrath, Noah Friedman, david d zuhn, and many others. | ||
31 | |||
32 | |||
33 | # AC_PROG_CC([COMPILER ...]) | ||
34 | # -------------------------- | ||
35 | # COMPILER ... is a space separated list of C compilers to search for. | ||
36 | # This just gives the user an opportunity to specify an alternative | ||
37 | # search list for the C compiler. | ||
38 | AC_DEFUN_ONCE([AC_PROG_CC], | ||
39 | [AC_LANG_PUSH(C)dnl | ||
40 | AC_ARG_VAR([CC], [C compiler command])dnl | ||
41 | AC_ARG_VAR([CFLAGS], [C compiler flags])dnl | ||
42 | _AC_ARG_VAR_LDFLAGS()dnl | ||
43 | _AC_ARG_VAR_LIBS()dnl | ||
44 | _AC_ARG_VAR_CPPFLAGS()dnl | ||
45 | m4_ifval([$1], | ||
46 | [AC_CHECK_TOOLS(CC, [$1])], | ||
47 | [AC_CHECK_TOOL(CC, gcc) | ||
48 | if test -z "$CC"; then | ||
49 | dnl Here we want: | ||
50 | dnl AC_CHECK_TOOL(CC, cc) | ||
51 | dnl but without the check for a tool without the prefix. | ||
52 | dnl Until the check is removed from there, copy the code: | ||
53 | if test -n "$ac_tool_prefix"; then | ||
54 | AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) | ||
55 | fi | ||
56 | fi | ||
57 | if test -z "$CC"; then | ||
58 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) | ||
59 | fi | ||
60 | if test -z "$CC"; then | ||
61 | AC_CHECK_TOOLS(CC, cl.exe) | ||
62 | fi | ||
63 | if test -z "$CC"; then | ||
64 | AC_CHECK_TOOL(CC, clang) | ||
65 | fi | ||
66 | ]) | ||
67 | |||
68 | test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) | ||
69 | |||
70 | # Provide some information about the compiler. | ||
71 | _AS_ECHO_LOG([checking for _AC_LANG compiler version]) | ||
72 | set X $ac_compile | ||
73 | ac_compiler=$[2] | ||
74 | for ac_option in --version -v -V -qversion -version; do | ||
75 | _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) | ||
76 | done | ||
77 | |||
78 | m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl | ||
79 | m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl | ||
80 | _AC_LANG_COMPILER_GNU | ||
81 | if test $ac_compiler_gnu = yes; then | ||
82 | GCC=yes | ||
83 | else | ||
84 | GCC= | ||
85 | fi | ||
86 | _AC_PROG_CC_G | ||
87 | dnl | ||
88 | dnl Set ac_prog_cc_stdc to the supported C version. | ||
89 | dnl Also set the documented variable ac_cv_prog_cc_stdc; | ||
90 | dnl its name was chosen when it was cached, but it is no longer cached. | ||
91 | _AC_PROG_CC_C11([ac_prog_cc_stdc=c11 | ||
92 | ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11], | ||
93 | [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99 | ||
94 | ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], | ||
95 | [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89 | ||
96 | ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], | ||
97 | [ac_prog_cc_stdc=no | ||
98 | ac_cv_prog_cc_stdc=no])])]) | ||
99 | dnl | ||
100 | AC_LANG_POP(C)dnl | ||
101 | ])# AC_PROG_CC | ||
102 | |||
103 | |||
104 | |||
105 | # AC_PROG_CXX([LIST-OF-COMPILERS]) | ||
106 | # -------------------------------- | ||
107 | # LIST-OF-COMPILERS is a space separated list of C++ compilers to search | ||
108 | # for (if not specified, a default list is used). This just gives the | ||
109 | # user an opportunity to specify an alternative search list for the C++ | ||
110 | # compiler. | ||
111 | # aCC HP-UX C++ compiler much better than `CC', so test before. | ||
112 | # FCC Fujitsu C++ compiler | ||
113 | # KCC KAI C++ compiler | ||
114 | # RCC Rational C++ | ||
115 | # xlC_r AIX C Set++ (with support for reentrant code) | ||
116 | # xlC AIX C Set++ | ||
117 | AC_DEFUN([AC_PROG_CXX], | ||
118 | [AC_LANG_PUSH(C++)dnl | ||
119 | AC_ARG_VAR([CXX], [C++ compiler command])dnl | ||
120 | AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl | ||
121 | _AC_ARG_VAR_LDFLAGS()dnl | ||
122 | _AC_ARG_VAR_LIBS()dnl | ||
123 | _AC_ARG_VAR_CPPFLAGS()dnl | ||
124 | _AC_ARG_VAR_PRECIOUS([CCC])dnl | ||
125 | if test -z "$CXX"; then | ||
126 | if test -n "$CCC"; then | ||
127 | CXX=$CCC | ||
128 | else | ||
129 | AC_CHECK_TOOLS(CXX, | ||
130 | [m4_default([$1], | ||
131 | [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])], | ||
132 | g++) | ||
133 | fi | ||
134 | fi | ||
135 | # Provide some information about the compiler. | ||
136 | _AS_ECHO_LOG([checking for _AC_LANG compiler version]) | ||
137 | set X $ac_compile | ||
138 | ac_compiler=$[2] | ||
139 | for ac_option in --version -v -V -qversion; do | ||
140 | _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) | ||
141 | done | ||
142 | |||
143 | m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl | ||
144 | m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl | ||
145 | _AC_LANG_COMPILER_GNU | ||
146 | if test $ac_compiler_gnu = yes; then | ||
147 | GXX=yes | ||
148 | else | ||
149 | GXX= | ||
150 | fi | ||
151 | _AC_PROG_CXX_G | ||
152 | _AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11 | ||
153 | ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 | ||
154 | ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11], | ||
155 | [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98 | ||
156 | ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98], | ||
157 | [ac_prog_cxx_stdcxx=no | ||
158 | ac_cv_prog_cxx_stdcxx=no])]) | ||
159 | AC_LANG_POP(C++)dnl | ||
160 | ])# AC_PROG_CXX | ||
161 | |||
162 | |||
163 | # _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, | ||
164 | # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) | ||
165 | # -------------------------------------------------------------- | ||
166 | # Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') | ||
167 | # by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails, | ||
168 | # try again with each compiler option in the space-separated OPTION-LIST; if one | ||
169 | # helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE, | ||
170 | # else ACTION-IF-UNAVAILABLE. | ||
171 | AC_DEFUN([_AC_C_STD_TRY], | ||
172 | [AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features]) | ||
173 | AC_CACHE_VAL(ac_cv_prog_cc_$1, | ||
174 | [ac_cv_prog_cc_$1=no | ||
175 | ac_save_CC=$CC | ||
176 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) | ||
177 | for ac_arg in '' $4 | ||
178 | do | ||
179 | CC="$ac_save_CC $ac_arg" | ||
180 | _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) | ||
181 | test "x$ac_cv_prog_cc_$1" != "xno" && break | ||
182 | done | ||
183 | rm -f conftest.$ac_ext | ||
184 | CC=$ac_save_CC | ||
185 | ])# AC_CACHE_VAL | ||
186 | ac_prog_cc_stdc_options= | ||
187 | case "x$ac_cv_prog_cc_$1" in | ||
188 | x) | ||
189 | AC_MSG_RESULT([none needed]) ;; | ||
190 | xno) | ||
191 | AC_MSG_RESULT([unsupported]) ;; | ||
192 | *) | ||
193 | ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1" | ||
194 | CC=$CC$ac_prog_cc_stdc_options | ||
195 | AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;; | ||
196 | esac | ||
197 | AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) | ||
198 | ])# _AC_C_STD_TRY | ||
199 | |||
200 | # _AC_C_C99_TEST_HEADER | ||
201 | # --------------------- | ||
202 | # A C header suitable for testing for C99. | ||
203 | AC_DEFUN([_AC_C_C99_TEST_HEADER], | ||
204 | [[#include <stdarg.h> | ||
205 | #include <stdbool.h> | ||
206 | #include <stddef.h> | ||
207 | #include <stdlib.h> | ||
208 | #include <wchar.h> | ||
209 | #include <stdio.h> | ||
210 | |||
211 | // Check varargs macros. These examples are taken from C99 6.10.3.5. | ||
212 | #define debug(...) fprintf (stderr, __VA_ARGS__) | ||
213 | #define showlist(...) puts (#__VA_ARGS__) | ||
214 | #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) | ||
215 | static void | ||
216 | test_varargs_macros (void) | ||
217 | { | ||
218 | int x = 1234; | ||
219 | int y = 5678; | ||
220 | debug ("Flag"); | ||
221 | debug ("X = %d\n", x); | ||
222 | showlist (The first, second, and third items.); | ||
223 | report (x>y, "x is %d but y is %d", x, y); | ||
224 | } | ||
225 | |||
226 | // Check long long types. | ||
227 | #define BIG64 18446744073709551615ull | ||
228 | #define BIG32 4294967295ul | ||
229 | #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) | ||
230 | #if !BIG_OK | ||
231 | your preprocessor is broken; | ||
232 | #endif | ||
233 | #if BIG_OK | ||
234 | #else | ||
235 | your preprocessor is broken; | ||
236 | #endif | ||
237 | static long long int bignum = -9223372036854775807LL; | ||
238 | static unsigned long long int ubignum = BIG64; | ||
239 | |||
240 | struct incomplete_array | ||
241 | { | ||
242 | int datasize; | ||
243 | double data[]; | ||
244 | }; | ||
245 | |||
246 | struct named_init { | ||
247 | int number; | ||
248 | const wchar_t *name; | ||
249 | double average; | ||
250 | }; | ||
251 | |||
252 | typedef const char *ccp; | ||
253 | |||
254 | static inline int | ||
255 | test_restrict (ccp restrict text) | ||
256 | { | ||
257 | // See if C++-style comments work. | ||
258 | // Iterate through items via the restricted pointer. | ||
259 | // Also check for declarations in for loops. | ||
260 | for (unsigned int i = 0; *(text+i) != '\0'; ++i) | ||
261 | continue; | ||
262 | return 0; | ||
263 | } | ||
264 | |||
265 | // Check varargs and va_copy. | ||
266 | static bool | ||
267 | test_varargs (const char *format, ...) | ||
268 | { | ||
269 | va_list args; | ||
270 | va_start (args, format); | ||
271 | va_list args_copy; | ||
272 | va_copy (args_copy, args); | ||
273 | |||
274 | const char *str = ""; | ||
275 | int number = 0; | ||
276 | float fnumber = 0; | ||
277 | |||
278 | while (*format) | ||
279 | { | ||
280 | switch (*format++) | ||
281 | { | ||
282 | case 's': // string | ||
283 | str = va_arg (args_copy, const char *); | ||
284 | break; | ||
285 | case 'd': // int | ||
286 | number = va_arg (args_copy, int); | ||
287 | break; | ||
288 | case 'f': // float | ||
289 | fnumber = va_arg (args_copy, double); | ||
290 | break; | ||
291 | default: | ||
292 | break; | ||
293 | } | ||
294 | } | ||
295 | va_end (args_copy); | ||
296 | va_end (args); | ||
297 | |||
298 | return *str && number && fnumber; | ||
299 | }]])# _AC_C_C99_TEST_HEADER | ||
300 | |||
301 | # _AC_C_C99_TEST_BODY | ||
302 | # ------------------- | ||
303 | # A C body suitable for testing for C99, assuming the corresponding header. | ||
304 | AC_DEFUN([_AC_C_C99_TEST_BODY], | ||
305 | [[ | ||
306 | // Check bool. | ||
307 | _Bool success = false; | ||
308 | |||
309 | // Check restrict. | ||
310 | if (test_restrict ("String literal") == 0) | ||
311 | success = true; | ||
312 | char *restrict newvar = "Another string"; | ||
313 | |||
314 | // Check varargs. | ||
315 | success &= test_varargs ("s, d' f .", "string", 65, 34.234); | ||
316 | test_varargs_macros (); | ||
317 | |||
318 | // Check flexible array members. | ||
319 | struct incomplete_array *ia = | ||
320 | malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); | ||
321 | ia->datasize = 10; | ||
322 | for (int i = 0; i < ia->datasize; ++i) | ||
323 | ia->data[i] = i * 1.234; | ||
324 | |||
325 | // Check named initializers. | ||
326 | struct named_init ni = { | ||
327 | .number = 34, | ||
328 | .name = L"Test wide string", | ||
329 | .average = 543.34343, | ||
330 | }; | ||
331 | |||
332 | ni.number = 58; | ||
333 | |||
334 | int dynamic_array[ni.number]; | ||
335 | dynamic_array[ni.number - 1] = 543; | ||
336 | |||
337 | // work around unused variable warnings | ||
338 | return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' | ||
339 | || dynamic_array[ni.number - 1] != 543); | ||
340 | ]]) | ||
341 | |||
342 | # _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) | ||
343 | # ---------------------------------------------------------------- | ||
344 | # If the C compiler is not in ISO C99 mode by default, try to add an | ||
345 | # option to output variable CC to make it so. This macro tries | ||
346 | # various options that select ISO C99 on some system or another. It | ||
347 | # considers the compiler to be in ISO C99 mode if it handles _Bool, | ||
348 | # // comments, flexible array members, inline, long long int, mixed | ||
349 | # code and declarations, named initialization of structs, restrict, | ||
350 | # va_copy, varargs macros, variable declarations in for loops and | ||
351 | # variable length arrays. | ||
352 | AC_DEFUN([_AC_PROG_CC_C99], | ||
353 | [_AC_C_STD_TRY([c99], | ||
354 | [_AC_C_C99_TEST_HEADER], | ||
355 | [_AC_C_C99_TEST_BODY], | ||
356 | dnl Try | ||
357 | dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) | ||
358 | dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) | ||
359 | dnl IBM XL C -qlanglvl=extc99 | ||
360 | dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99) | ||
361 | dnl HP cc -AC99 | ||
362 | dnl Intel ICC -std=c99, -c99 (deprecated) | ||
363 | dnl IRIX -c99 | ||
364 | dnl Solaris -D_STDC_C99= | ||
365 | dnl cc's -xc99 option uses linker magic to define the external | ||
366 | dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 | ||
367 | dnl behavior for C library functions. This is not wanted here, | ||
368 | dnl because it means that a single module compiled with -xc99 | ||
369 | dnl alters C runtime behavior for the entire program, not for | ||
370 | dnl just the module. Instead, define the (private) symbol | ||
371 | dnl _STDC_C99, which suppresses a bogus failure in <stdbool.h>. | ||
372 | dnl The resulting compiler passes the test case here, and that's | ||
373 | dnl good enough. For more, please see the thread starting at: | ||
374 | dnl https://lists.gnu.org/r/autoconf/2010-12/msg00059.html | ||
375 | dnl Tru64 -c99 | ||
376 | dnl with extended modes being tried first. | ||
377 | [[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl | ||
378 | ])# _AC_PROG_CC_C99 | ||
379 | |||
380 | |||
381 | # _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) | ||
382 | # ---------------------------------------------------------------- | ||
383 | # If the C compiler is not in ISO C11 mode by default, try to add an | ||
384 | # option to output variable CC to make it so. This macro tries | ||
385 | # various options that select ISO C11 on some system or another. It | ||
386 | # considers the compiler to be in ISO C11 mode if it handles _Alignas, | ||
387 | # _Alignof, _Noreturn, _Static_assert, UTF-8 string literals, | ||
388 | # duplicate typedefs, and anonymous structures and unions. | ||
389 | AC_DEFUN([_AC_PROG_CC_C11], | ||
390 | [_AC_C_STD_TRY([c11], | ||
391 | [_AC_C_C99_TEST_HEADER[ | ||
392 | // Check _Alignas. | ||
393 | char _Alignas (double) aligned_as_double; | ||
394 | char _Alignas (0) no_special_alignment; | ||
395 | extern char aligned_as_int; | ||
396 | char _Alignas (0) _Alignas (int) aligned_as_int; | ||
397 | |||
398 | // Check _Alignof. | ||
399 | enum | ||
400 | { | ||
401 | int_alignment = _Alignof (int), | ||
402 | int_array_alignment = _Alignof (int[100]), | ||
403 | char_alignment = _Alignof (char) | ||
404 | }; | ||
405 | _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); | ||
406 | |||
407 | // Check _Noreturn. | ||
408 | int _Noreturn does_not_return (void) { for (;;) continue; } | ||
409 | |||
410 | // Check _Static_assert. | ||
411 | struct test_static_assert | ||
412 | { | ||
413 | int x; | ||
414 | _Static_assert (sizeof (int) <= sizeof (long int), | ||
415 | "_Static_assert does not work in struct"); | ||
416 | long int y; | ||
417 | }; | ||
418 | |||
419 | // Check UTF-8 literals. | ||
420 | #define u8 syntax error! | ||
421 | char const utf8_literal[] = u8"happens to be ASCII" "another string"; | ||
422 | |||
423 | // Check duplicate typedefs. | ||
424 | typedef long *long_ptr; | ||
425 | typedef long int *long_ptr; | ||
426 | typedef long_ptr long_ptr; | ||
427 | |||
428 | // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. | ||
429 | struct anonymous | ||
430 | { | ||
431 | union { | ||
432 | struct { int i; int j; }; | ||
433 | struct { int k; long int l; } w; | ||
434 | }; | ||
435 | int m; | ||
436 | } v1; | ||
437 | ]], | ||
438 | [_AC_C_C99_TEST_BODY[ | ||
439 | v1.i = 2; | ||
440 | v1.w.k = 5; | ||
441 | _Static_assert ((offsetof (struct anonymous, i) | ||
442 | == offsetof (struct anonymous, w.k)), | ||
443 | "Anonymous union alignment botch"); | ||
444 | ]], | ||
445 | dnl Try | ||
446 | dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) | ||
447 | dnl with extended modes being tried first. | ||
448 | dnl | ||
449 | dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as | ||
450 | dnl of September 2012) does not pass the C11 test. For now, try extc1x when | ||
451 | dnl compiling the C99 test instead, since it enables _Static_assert and | ||
452 | dnl _Noreturn, which is a win. If -qlanglvl=extc11 or -qlanglvl=extc1x passes | ||
453 | dnl the C11 test in some future version of IBM XL C, we'll add it here, | ||
454 | dnl preferably extc11. | ||
455 | [[-std=gnu11]], [$1], [$2])[]dnl | ||
456 | ])# _AC_PROG_CC_C11 | ||
457 | |||
458 | |||
459 | # AC_PROG_CC_C89 | ||
460 | # -------------- | ||
461 | # Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC, | ||
462 | # as that'd be incompatible with how Automake redefines AC_PROG_CC. See | ||
463 | # <https://lists.gnu.org/r/autoconf/2012-10/msg00048.html>. | ||
464 | AU_DEFUN([AC_PROG_CC_C89], | ||
465 | [AC_REQUIRE([AC_PROG_CC])], | ||
466 | [$0 is obsolete; use AC_PROG_CC] | ||
467 | ) | ||
468 | |||
469 | # AC_PROG_CC_C99 | ||
470 | # -------------- | ||
471 | AU_DEFUN([AC_PROG_CC_C99], | ||
472 | [AC_REQUIRE([AC_PROG_CC])], | ||
473 | [$0 is obsolete; use AC_PROG_CC] | ||
474 | ) | ||
475 | |||
476 | # AC_PROG_CC_STDC | ||
477 | # --------------- | ||
478 | AU_DEFUN([AC_PROG_CC_STDC], | ||
479 | [AC_REQUIRE([AC_PROG_CC])], | ||
480 | [$0 is obsolete; use AC_PROG_CC] | ||
481 | ) | ||
482 | |||
483 | |||
484 | # AC_C_PROTOTYPES | ||
485 | # --------------- | ||
486 | # Check if the C compiler supports prototypes, included if it needs | ||
487 | # options. | ||
488 | AC_DEFUN([AC_C_PROTOTYPES], | ||
489 | [AC_REQUIRE([AC_PROG_CC])dnl | ||
490 | if test "$ac_prog_cc_stdc" != no; then | ||
491 | AC_DEFINE(PROTOTYPES, 1, | ||
492 | [Define to 1 if the C compiler supports function prototypes.]) | ||
493 | AC_DEFINE(__PROTOTYPES, 1, | ||
494 | [Define like PROTOTYPES; this can be used by system headers.]) | ||
495 | fi | ||
496 | ])# AC_C_PROTOTYPES | ||
497 | |||
498 | |||
499 | # _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, | ||
500 | # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) | ||
501 | # ---------------------------------------------------------------- | ||
502 | # Check whether the C++ compiler accepts features of STANDARD (e.g | ||
503 | # `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE | ||
504 | # and TEST-BODY. If this fails, try again with each compiler option | ||
505 | # in the space-separated OPTION-LIST; if one helps, append it to CXX. | ||
506 | # If eventually successful, run ACTION-IF-AVAILABLE, else | ||
507 | # ACTION-IF-UNAVAILABLE. | ||
508 | AC_DEFUN([_AC_CXX_STD_TRY], | ||
509 | [AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features]) | ||
510 | AC_LANG_PUSH(C++)dnl | ||
511 | AC_CACHE_VAL(ac_cv_prog_cxx_$1, | ||
512 | [ac_cv_prog_cxx_$1=no | ||
513 | ac_save_CXX=$CXX | ||
514 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) | ||
515 | for ac_arg in '' $4 | ||
516 | do | ||
517 | CXX="$ac_save_CXX $ac_arg" | ||
518 | _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg]) | ||
519 | test "x$ac_cv_prog_cxx_$1" != "xno" && break | ||
520 | done | ||
521 | rm -f conftest.$ac_ext | ||
522 | CXX=$ac_save_CXX | ||
523 | ])# AC_CACHE_VAL | ||
524 | ac_prog_cxx_stdcxx_options= | ||
525 | case "x$ac_cv_prog_cxx_$1" in | ||
526 | x) | ||
527 | AC_MSG_RESULT([none needed]) ;; | ||
528 | xno) | ||
529 | AC_MSG_RESULT([unsupported]) ;; | ||
530 | *) | ||
531 | ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1" | ||
532 | CXX=$CXX$ac_prog_cxx_stdcxx_options | ||
533 | AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;; | ||
534 | esac | ||
535 | AC_LANG_POP(C++)dnl | ||
536 | AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6]) | ||
537 | ])# _AC_CXX_STD_TRY | ||
538 | |||
539 | # _AC_CXX_CXX98_TEST_HEADER | ||
540 | # ------------------------- | ||
541 | # A C++ header suitable for testing for CXX98. | ||
542 | AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER], | ||
543 | [[ | ||
544 | #include <algorithm> | ||
545 | #include <cstdlib> | ||
546 | #include <fstream> | ||
547 | #include <iomanip> | ||
548 | #include <iostream> | ||
549 | #include <list> | ||
550 | #include <map> | ||
551 | #include <set> | ||
552 | #include <sstream> | ||
553 | #include <stdexcept> | ||
554 | #include <string> | ||
555 | #include <utility> | ||
556 | #include <vector> | ||
557 | |||
558 | namespace test { | ||
559 | typedef std::vector<std::string> string_vec; | ||
560 | typedef std::pair<int,bool> map_value; | ||
561 | typedef std::map<std::string,map_value> map_type; | ||
562 | typedef std::set<int> set_type; | ||
563 | |||
564 | template<typename T> | ||
565 | class printer { | ||
566 | public: | ||
567 | printer(std::ostringstream& os): os(os) {} | ||
568 | void operator() (T elem) { os << elem << std::endl; } | ||
569 | private: | ||
570 | std::ostringstream& os; | ||
571 | }; | ||
572 | } | ||
573 | ]])# _AC_CXX_CXX98_TEST_HEADER | ||
574 | |||
575 | # _AC_CXX_CXX98_TEST_BODY | ||
576 | # ----------------------- | ||
577 | # A C++ body suitable for testing for CXX98, assuming the corresponding header. | ||
578 | AC_DEFUN([_AC_CXX_CXX98_TEST_BODY], | ||
579 | [[ | ||
580 | |||
581 | try { | ||
582 | // Basic string. | ||
583 | std::string teststr("ASCII text"); | ||
584 | teststr += " string"; | ||
585 | |||
586 | // Simple vector. | ||
587 | test::string_vec testvec; | ||
588 | testvec.push_back(teststr); | ||
589 | testvec.push_back("foo"); | ||
590 | testvec.push_back("bar"); | ||
591 | if (testvec.size() != 3) { | ||
592 | throw std::runtime_error("vector size is not 1"); | ||
593 | } | ||
594 | |||
595 | // Dump vector into stringstream and obtain string. | ||
596 | std::ostringstream os; | ||
597 | for (test::string_vec::const_iterator i = testvec.begin(); | ||
598 | i != testvec.end(); ++i) { | ||
599 | if (i + 1 != testvec.end()) { | ||
600 | os << teststr << '\n'; | ||
601 | } | ||
602 | } | ||
603 | // Check algorithms work. | ||
604 | std::for_each(testvec.begin(), testvec.end(), test::printer<std::string>(os)); | ||
605 | std::string os_out = os.str(); | ||
606 | |||
607 | // Test pair and map. | ||
608 | test::map_type testmap; | ||
609 | testmap.insert(std::make_pair(std::string("key"), | ||
610 | std::make_pair(53,false))); | ||
611 | |||
612 | // Test set. | ||
613 | int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; | ||
614 | test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); | ||
615 | std::list<int> testlist(testset.begin(), testset.end()); | ||
616 | std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); | ||
617 | } catch (const std::exception& e) { | ||
618 | std::cerr << "Caught exception: " << e.what() << std::endl; | ||
619 | |||
620 | // Test fstream | ||
621 | std::ofstream of("test.txt"); | ||
622 | of << "Test ASCII text\n" << std::flush; | ||
623 | of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; | ||
624 | of.close(); | ||
625 | } | ||
626 | std::exit(0); | ||
627 | ]]) | ||
628 | |||
629 | # _AC_CXX_CXX11_TEST_HEADER | ||
630 | # ------------------------- | ||
631 | # A C++ header suitable for testing for CXX11. | ||
632 | AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER], | ||
633 | [[ | ||
634 | #include <deque> | ||
635 | #include <functional> | ||
636 | #include <memory> | ||
637 | #include <tuple> | ||
638 | #include <array> | ||
639 | #include <regex> | ||
640 | #include <iostream> | ||
641 | |||
642 | namespace cxx11test | ||
643 | { | ||
644 | typedef std::shared_ptr<std::string> sptr; | ||
645 | typedef std::weak_ptr<std::string> wptr; | ||
646 | |||
647 | typedef std::tuple<std::string,int,double> tp; | ||
648 | typedef std::array<int, 20> int_array; | ||
649 | |||
650 | constexpr int get_val() { return 20; } | ||
651 | |||
652 | struct testinit | ||
653 | { | ||
654 | int i; | ||
655 | double d; | ||
656 | }; | ||
657 | |||
658 | class delegate { | ||
659 | public: | ||
660 | delegate(int n) : n(n) {} | ||
661 | delegate(): delegate(2354) {} | ||
662 | |||
663 | virtual int getval() { return this->n; }; | ||
664 | protected: | ||
665 | int n; | ||
666 | }; | ||
667 | |||
668 | class overridden : public delegate { | ||
669 | public: | ||
670 | overridden(int n): delegate(n) {} | ||
671 | virtual int getval() override final { return this->n * 2; } | ||
672 | }; | ||
673 | |||
674 | class nocopy { | ||
675 | public: | ||
676 | nocopy(int i): i(i) {} | ||
677 | nocopy() = default; | ||
678 | nocopy(const nocopy&) = delete; | ||
679 | nocopy & operator=(const nocopy&) = delete; | ||
680 | private: | ||
681 | int i; | ||
682 | }; | ||
683 | } | ||
684 | ]])# _AC_CXX_CXX11_TEST_HEADER | ||
685 | |||
686 | # _AC_CXX_CXX11_TEST_BODY | ||
687 | # ----------------------- | ||
688 | # A C++ body suitable for testing for CXX11, assuming the corresponding header. | ||
689 | AC_DEFUN([_AC_CXX_CXX11_TEST_BODY], | ||
690 | [[ | ||
691 | { | ||
692 | // Test auto and decltype | ||
693 | std::deque<int> d; | ||
694 | d.push_front(43); | ||
695 | d.push_front(484); | ||
696 | d.push_front(3); | ||
697 | d.push_front(844); | ||
698 | int total = 0; | ||
699 | for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } | ||
700 | |||
701 | auto a1 = 6538; | ||
702 | auto a2 = 48573953.4; | ||
703 | auto a3 = "String literal"; | ||
704 | |||
705 | decltype(a2) a4 = 34895.034; | ||
706 | } | ||
707 | { | ||
708 | // Test constexpr | ||
709 | short sa[cxx11test::get_val()] = { 0 }; | ||
710 | } | ||
711 | { | ||
712 | // Test initializer lists | ||
713 | cxx11test::testinit il = { 4323, 435234.23544 }; | ||
714 | } | ||
715 | { | ||
716 | // Test range-based for and lambda | ||
717 | cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; | ||
718 | for (int &x : array) { x += 23; } | ||
719 | std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); | ||
720 | } | ||
721 | { | ||
722 | using cxx11test::sptr; | ||
723 | using cxx11test::wptr; | ||
724 | |||
725 | sptr sp(new std::string("ASCII string")); | ||
726 | wptr wp(sp); | ||
727 | sptr sp2(wp); | ||
728 | } | ||
729 | { | ||
730 | cxx11test::tp tuple("test", 54, 45.53434); | ||
731 | double d = std::get<2>(tuple); | ||
732 | std::string s; | ||
733 | int i; | ||
734 | std::tie(s,i,d) = tuple; | ||
735 | } | ||
736 | { | ||
737 | static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); | ||
738 | std::string testmatch("Test if this string matches"); | ||
739 | bool match = std::regex_search(testmatch, filename_regex); | ||
740 | } | ||
741 | { | ||
742 | cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; | ||
743 | cxx11test::int_array::size_type size = array.size(); | ||
744 | } | ||
745 | { | ||
746 | // Test constructor delegation | ||
747 | cxx11test::delegate d1; | ||
748 | cxx11test::delegate d2(); | ||
749 | cxx11test::delegate d3(45); | ||
750 | } | ||
751 | { | ||
752 | // Test override and final | ||
753 | cxx11test::overridden o1(55464); | ||
754 | } | ||
755 | { | ||
756 | // Test nullptr | ||
757 | char *c = nullptr; | ||
758 | } | ||
759 | { | ||
760 | // Test template brackets | ||
761 | std::vector<std::pair<int,char*>> v1; | ||
762 | } | ||
763 | { | ||
764 | // Unicode literals | ||
765 | char const *utf8 = u8"UTF-8 string \u2500"; | ||
766 | char16_t const *utf16 = u"UTF-8 string \u2500"; | ||
767 | char32_t const *utf32 = U"UTF-32 string \u2500"; | ||
768 | } | ||
769 | ]]) | ||
770 | |||
771 | # _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) | ||
772 | # ------------------------------------------------------------------- | ||
773 | |||
774 | # If the C++ compiler is not in ISO C++98 mode by default, try to add | ||
775 | # an option to output variable CXX to make it so. This macro tries | ||
776 | # various options that select ISO C++98 on some system or another. It | ||
777 | # considers the compiler to be in ISO C++98 mode if it handles basic | ||
778 | # features of the std namespace including: string, containers (list, | ||
779 | # map, set, vector), streams (fstreams, iostreams, stringstreams, | ||
780 | # iomanip), pair, exceptions and algorithms. | ||
781 | |||
782 | |||
783 | AC_DEFUN([_AC_PROG_CXX_CXX98], | ||
784 | [_AC_CXX_STD_TRY([cxx98], | ||
785 | [_AC_CXX_CXX98_TEST_HEADER], | ||
786 | [_AC_CXX_CXX98_TEST_BODY], | ||
787 | dnl Try | ||
788 | dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98) | ||
789 | dnl IBM XL C -qlanglvl=extended | ||
790 | dnl HP aC++ -AA | ||
791 | dnl Intel ICC -std=gnu++98 | ||
792 | dnl Solaris N/A (default) | ||
793 | dnl Tru64 N/A (default, but -std gnu could be used) | ||
794 | dnl with extended modes being tried first. | ||
795 | [[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl | ||
796 | ])# _AC_PROG_CXX_CXX98 | ||
797 | |||
798 | # _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) | ||
799 | # ------------------------------------------------------------------- | ||
800 | # If the C++ compiler is not in ISO CXX11 mode by default, try to add | ||
801 | # an option to output variable CXX to make it so. This macro tries | ||
802 | # various options that select ISO C++11 on some system or another. It | ||
803 | # considers the compiler to be in ISO C++11 mode if it handles all the | ||
804 | # tests from the C++98 checks, plus the following: Language features | ||
805 | # (auto, constexpr, decltype, default/deleted constructors, delegate | ||
806 | # constructors, final, initializer lists, lambda functions, nullptr, | ||
807 | # override, range-based for loops, template brackets without spaces, | ||
808 | # unicode literals) and library features (array, memory (shared_ptr, | ||
809 | # weak_ptr), regex and tuple types). | ||
810 | AC_DEFUN([_AC_PROG_CXX_CXX11], | ||
811 | [_AC_CXX_STD_TRY([cxx11], | ||
812 | [_AC_CXX_CXX11_TEST_HEADER | ||
813 | _AC_CXX_CXX98_TEST_HEADER], | ||
814 | [_AC_CXX_CXX11_TEST_BODY | ||
815 | _AC_CXX_CXX98_TEST_BODY], | ||
816 | dnl Try | ||
817 | dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants] | ||
818 | dnl IBM XL C -qlanglvl=extended0x | ||
819 | dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11) | ||
820 | dnl HP aC++ -AA | ||
821 | dnl Intel ICC -std=c++11 -std=c++0x | ||
822 | dnl Solaris N/A (no support) | ||
823 | dnl Tru64 N/A (no support) | ||
824 | dnl with extended modes being tried first. | ||
825 | [[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl | ||
826 | ])# _AC_PROG_CXX_CXX11 | ||
827 | |||
828 | |||
829 | ])# m4_version_prereq | ||
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4 index 20be01a..dc29717 100644 --- a/gl/m4/stdalign.m4 +++ b/gl/m4/stdalign.m4 | |||
@@ -1,6 +1,6 @@ | |||
1 | # Check for stdalign.h that conforms to C11. | 1 | # Check for alignas and alignof that conform to C23. |
2 | 2 | ||
3 | dnl Copyright 2011-2013 Free Software Foundation, Inc. | 3 | dnl Copyright 2011-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. |
@@ -9,16 +9,23 @@ dnl with or without modifications, as long as this notice is preserved. | |||
9 | 9 | ||
10 | AC_DEFUN([gl_STDALIGN_H], | 10 | AC_DEFUN([gl_STDALIGN_H], |
11 | [ | 11 | [ |
12 | AC_CACHE_CHECK([for working stdalign.h], | 12 | AC_CACHE_CHECK([for alignas and alignof], |
13 | [gl_cv_header_working_stdalign_h], | 13 | [gl_cv_header_working_stdalign_h], |
14 | [AC_COMPILE_IFELSE( | 14 | [gl_save_CFLAGS=$CFLAGS |
15 | for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do | ||
16 | AS_CASE([$gl_working], | ||
17 | [*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"]) | ||
18 | AC_COMPILE_IFELSE( | ||
15 | [AC_LANG_PROGRAM( | 19 | [AC_LANG_PROGRAM( |
16 | [[#include <stdalign.h> | 20 | [[#include <stdint.h> |
21 | #ifdef INCLUDE_STDALIGN_H | ||
22 | #include <stdalign.h> | ||
23 | #endif | ||
17 | #include <stddef.h> | 24 | #include <stddef.h> |
18 | 25 | ||
19 | /* Test that alignof yields a result consistent with offsetof. | 26 | /* Test that alignof yields a result consistent with offsetof. |
20 | This catches GCC bug 52023 | 27 | This catches GCC bug 52023 |
21 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ | 28 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ |
22 | #ifdef __cplusplus | 29 | #ifdef __cplusplus |
23 | template <class t> struct alignof_helper { char a; t b; }; | 30 | template <class t> struct alignof_helper { char a; t b; }; |
24 | # define ao(type) offsetof (alignof_helper<type>, b) | 31 | # define ao(type) offsetof (alignof_helper<type>, b) |
@@ -29,25 +36,103 @@ AC_DEFUN([gl_STDALIGN_H], | |||
29 | char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; | 36 | char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; |
30 | char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; | 37 | char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; |
31 | 38 | ||
32 | /* Test _Alignas only on platforms where gnulib can help. */ | 39 | /* Test alignas only on platforms where gnulib can help. */ |
33 | #if \ | 40 | #if \ |
34 | ((defined __cplusplus && 201103 <= __cplusplus) \ | 41 | ((defined __cplusplus && 201103 <= __cplusplus) \ |
35 | || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \ | 42 | || (__TINYC__ && defined __attribute__) \ |
36 | || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) | 43 | || (defined __APPLE__ && defined __MACH__ \ |
44 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
45 | : __GNUC__) \ | ||
46 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
47 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \ | ||
48 | || 1300 <= _MSC_VER) | ||
37 | struct alignas_test { char c; char alignas (8) alignas_8; }; | 49 | struct alignas_test { char c; char alignas (8) alignas_8; }; |
38 | char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 | 50 | char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 |
39 | ? 1 : -1]; | 51 | ? 1 : -1]; |
40 | #endif | 52 | #endif |
41 | ]])], | 53 | ]])], |
42 | [gl_cv_header_working_stdalign_h=yes], | 54 | [gl_cv_header_working_stdalign_h=$gl_working], |
43 | [gl_cv_header_working_stdalign_h=no])]) | 55 | [gl_cv_header_working_stdalign_h=no]) |
56 | |||
57 | CFLAGS=$gl_save_CFLAGS | ||
58 | test "$gl_cv_header_working_stdalign_h" != no && break | ||
59 | done]) | ||
60 | |||
61 | GL_GENERATE_STDALIGN_H=false | ||
62 | AS_CASE([$gl_cv_header_working_stdalign_h], | ||
63 | [no], | ||
64 | [GL_GENERATE_STDALIGN_H=true], | ||
65 | [yes*keyword*], | ||
66 | [AC_DEFINE([HAVE_C_ALIGNASOF], [1], | ||
67 | [Define to 1 if the alignas and alignof keywords work.])]) | ||
44 | 68 | ||
45 | if test $gl_cv_header_working_stdalign_h = yes; then | 69 | AC_CHECK_HEADERS_ONCE([stdalign.h]) |
46 | STDALIGN_H='' | ||
47 | else | ||
48 | STDALIGN_H='stdalign.h' | ||
49 | fi | ||
50 | 70 | ||
51 | AC_SUBST([STDALIGN_H]) | 71 | dnl The "zz" puts this toward config.h's end, to avoid potential |
52 | AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) | 72 | dnl collisions with other definitions. |
73 | AH_VERBATIM([zzalignas], | ||
74 | [#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof | ||
75 | # if HAVE_STDALIGN_H | ||
76 | # include <stdalign.h> | ||
77 | # else | ||
78 | /* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */ | ||
79 | # ifndef _GL_STDALIGN_H | ||
80 | # define _GL_STDALIGN_H | ||
81 | # undef _Alignas | ||
82 | # undef _Alignof | ||
83 | # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | ||
84 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | ||
85 | && !defined __clang__) \ | ||
86 | || (defined __clang__ && __clang_major__ < 8)) | ||
87 | # ifdef __cplusplus | ||
88 | # if (201103 <= __cplusplus || defined _MSC_VER) | ||
89 | # define _Alignof(type) alignof (type) | ||
90 | # else | ||
91 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | ||
92 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) | ||
93 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
94 | # endif | ||
95 | # else | ||
96 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ | ||
97 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) | ||
98 | # else | ||
99 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) | ||
100 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
101 | # endif | ||
102 | # endif | ||
103 | # endif | ||
104 | # if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) | ||
105 | # define alignof _Alignof | ||
106 | # endif | ||
107 | # define __alignof_is_defined 1 | ||
108 | # if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | ||
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 | ||
122 | # endif | ||
123 | # if ((defined _Alignas \ | ||
124 | && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ | ||
125 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | ||
126 | # define alignas _Alignas | ||
127 | # endif | ||
128 | # if (defined alignas \ | ||
129 | || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) | ||
130 | # define __alignas_is_defined 1 | ||
131 | # endif | ||
132 | # if _GL_STDALIGN_NEEDS_STDDEF | ||
133 | # include <stddef.h> | ||
134 | # endif | ||
135 | # endif /* _GL_STDALIGN_H */ | ||
136 | # endif | ||
137 | #endif]) | ||
53 | ]) | 138 | ]) |
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4 deleted file mode 100644 index 80d5559..0000000 --- a/gl/m4/stdbool.m4 +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | # Check for stdbool.h that conforms to C99. | ||
2 | |||
3 | dnl Copyright (C) 2002-2006, 2009-2013 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 | |||
8 | #serial 5 | ||
9 | |||
10 | # Prepare for substituting <stdbool.h> if it is not supported. | ||
11 | |||
12 | AC_DEFUN([AM_STDBOOL_H], | ||
13 | [ | ||
14 | AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) | ||
15 | |||
16 | # Define two additional variables used in the Makefile substitution. | ||
17 | |||
18 | if test "$ac_cv_header_stdbool_h" = yes; then | ||
19 | STDBOOL_H='' | ||
20 | else | ||
21 | STDBOOL_H='stdbool.h' | ||
22 | fi | ||
23 | AC_SUBST([STDBOOL_H]) | ||
24 | AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) | ||
25 | |||
26 | if test "$ac_cv_type__Bool" = yes; then | ||
27 | HAVE__BOOL=1 | ||
28 | else | ||
29 | HAVE__BOOL=0 | ||
30 | fi | ||
31 | AC_SUBST([HAVE__BOOL]) | ||
32 | ]) | ||
33 | |||
34 | # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. | ||
35 | AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) | ||
36 | |||
37 | # This version of the macro is needed in autoconf <= 2.68. | ||
38 | |||
39 | AC_DEFUN([AC_CHECK_HEADER_STDBOOL], | ||
40 | [AC_CACHE_CHECK([for stdbool.h that conforms to C99], | ||
41 | [ac_cv_header_stdbool_h], | ||
42 | [AC_COMPILE_IFELSE( | ||
43 | [AC_LANG_PROGRAM( | ||
44 | [[ | ||
45 | #include <stdbool.h> | ||
46 | #ifndef bool | ||
47 | "error: bool is not defined" | ||
48 | #endif | ||
49 | #ifndef false | ||
50 | "error: false is not defined" | ||
51 | #endif | ||
52 | #if false | ||
53 | "error: false is not 0" | ||
54 | #endif | ||
55 | #ifndef true | ||
56 | "error: true is not defined" | ||
57 | #endif | ||
58 | #if true != 1 | ||
59 | "error: true is not 1" | ||
60 | #endif | ||
61 | #ifndef __bool_true_false_are_defined | ||
62 | "error: __bool_true_false_are_defined is not defined" | ||
63 | #endif | ||
64 | |||
65 | struct s { _Bool s: 1; _Bool t; } s; | ||
66 | |||
67 | char a[true == 1 ? 1 : -1]; | ||
68 | char b[false == 0 ? 1 : -1]; | ||
69 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; | ||
70 | char d[(bool) 0.5 == true ? 1 : -1]; | ||
71 | /* See body of main program for 'e'. */ | ||
72 | char f[(_Bool) 0.0 == false ? 1 : -1]; | ||
73 | char g[true]; | ||
74 | char h[sizeof (_Bool)]; | ||
75 | char i[sizeof s.t]; | ||
76 | enum { j = false, k = true, l = false * true, m = true * 256 }; | ||
77 | /* The following fails for | ||
78 | HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ | ||
79 | _Bool n[m]; | ||
80 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | ||
81 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; | ||
82 | /* Catch a bug in an HP-UX C compiler. See | ||
83 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
84 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
85 | */ | ||
86 | _Bool q = true; | ||
87 | _Bool *pq = &q; | ||
88 | ]], | ||
89 | [[ | ||
90 | bool e = &s; | ||
91 | *pq |= q; | ||
92 | *pq |= ! q; | ||
93 | /* Refer to every declared value, to avoid compiler optimizations. */ | ||
94 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l | ||
95 | + !m + !n + !o + !p + !q + !pq); | ||
96 | ]])], | ||
97 | [ac_cv_header_stdbool_h=yes], | ||
98 | [ac_cv_header_stdbool_h=no])]) | ||
99 | AC_CHECK_TYPES([_Bool]) | ||
100 | ]) | ||
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 index 5da8ab1..a2322eb 100644 --- a/gl/m4/stddef_h.m4 +++ b/gl/m4/stddef_h.m4 | |||
@@ -1,19 +1,61 @@ | |||
1 | dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. | 1 | # stddef_h.m4 serial 13 |
2 | # stddef_h.m4 serial 4 | 2 | dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. |
3 | dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
7 | 6 | ||
8 | AC_DEFUN([gl_STDDEF_H], | 7 | dnl A placeholder for <stddef.h>, for platforms that have issues. |
8 | |||
9 | AC_DEFUN_ONCE([gl_STDDEF_H], | ||
9 | [ | 10 | [ |
10 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) |
11 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | 12 | AC_REQUIRE([gt_TYPE_WCHAR_T]) |
12 | STDDEF_H= | 13 | |
14 | dnl Persuade OpenBSD <stddef.h> to declare max_align_t. | ||
15 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
16 | |||
17 | GL_GENERATE_STDDEF_H=false | ||
18 | |||
19 | dnl Test whether the type max_align_t exists and whether its alignment | ||
20 | dnl "is as great as is supported by the implementation in all contexts". | ||
21 | AC_CACHE_CHECK([for good max_align_t], | ||
22 | [gl_cv_type_max_align_t], | ||
23 | [AC_COMPILE_IFELSE( | ||
24 | [AC_LANG_PROGRAM( | ||
25 | [[/* On FreeBSD 12.0/x86, max_align_t defined by <stddef.h> has | ||
26 | the correct alignment with the default (wrong) definition of | ||
27 | _Alignof, but a wrong alignment as soon as we activate an | ||
28 | ISO C compliant _Alignof definition. */ | ||
29 | #if ((defined __GNUC__ && 4 <= __GNUC__) || defined __clang__) && !defined __cplusplus | ||
30 | #define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) | ||
31 | #endif | ||
32 | #include <stddef.h> | ||
33 | unsigned int s = sizeof (max_align_t); | ||
34 | #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ | ||
35 | int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; | ||
36 | int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; | ||
37 | #endif | ||
38 | typedef struct { char a; max_align_t b; } max_helper; | ||
39 | typedef struct { char a; long b; } long_helper; | ||
40 | typedef struct { char a; double b; } double_helper; | ||
41 | typedef struct { char a; long double b; } long_double_helper; | ||
42 | int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; | ||
43 | int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; | ||
44 | int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; | ||
45 | ]])], | ||
46 | [gl_cv_type_max_align_t=yes], | ||
47 | [gl_cv_type_max_align_t=no]) | ||
48 | ]) | ||
49 | if test $gl_cv_type_max_align_t = no; then | ||
50 | HAVE_MAX_ALIGN_T=0 | ||
51 | GL_GENERATE_STDDEF_H=true | ||
52 | fi | ||
53 | |||
13 | if test $gt_cv_c_wchar_t = no; then | 54 | if test $gt_cv_c_wchar_t = no; then |
14 | HAVE_WCHAR_T=0 | 55 | HAVE_WCHAR_T=0 |
15 | STDDEF_H=stddef.h | 56 | GL_GENERATE_STDDEF_H=true |
16 | fi | 57 | fi |
58 | |||
17 | AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], | 59 | AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], |
18 | [gl_cv_decl_null_works], | 60 | [gl_cv_decl_null_works], |
19 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> | 61 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> |
@@ -23,25 +65,40 @@ AC_DEFUN([gl_STDDEF_H], | |||
23 | [gl_cv_decl_null_works=no])]) | 65 | [gl_cv_decl_null_works=no])]) |
24 | if test $gl_cv_decl_null_works = no; then | 66 | if test $gl_cv_decl_null_works = no; then |
25 | REPLACE_NULL=1 | 67 | REPLACE_NULL=1 |
26 | STDDEF_H=stddef.h | 68 | GL_GENERATE_STDDEF_H=true |
27 | fi | 69 | fi |
28 | AC_SUBST([STDDEF_H]) | 70 | |
29 | AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) | 71 | if $GL_GENERATE_STDDEF_H; then |
30 | if test -n "$STDDEF_H"; then | ||
31 | gl_NEXT_HEADERS([stddef.h]) | 72 | gl_NEXT_HEADERS([stddef.h]) |
32 | fi | 73 | fi |
33 | ]) | 74 | ]) |
34 | 75 | ||
76 | # gl_STDDEF_MODULE_INDICATOR([modulename]) | ||
77 | # sets the shell variable that indicates the presence of the given module | ||
78 | # to a C preprocessor expression that will evaluate to 1. | ||
79 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
35 | AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], | 80 | AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], |
36 | [ | 81 | [ |
37 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 82 | dnl Ensure to expand the default settings once only. |
38 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) | 83 | gl_STDDEF_H_REQUIRE_DEFAULTS |
39 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 84 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
40 | ]) | 85 | ]) |
41 | 86 | ||
87 | # Initializes the default values for AC_SUBSTed shell variables. | ||
88 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
89 | # outside of macros or in macros that are not AC_REQUIREd. | ||
90 | AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], | ||
91 | [ | ||
92 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [ | ||
93 | ]) | ||
94 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS]) | ||
95 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) | ||
96 | ]) | ||
97 | |||
42 | AC_DEFUN([gl_STDDEF_H_DEFAULTS], | 98 | AC_DEFUN([gl_STDDEF_H_DEFAULTS], |
43 | [ | 99 | [ |
44 | dnl Assume proper GNU behavior unless another module says otherwise. | 100 | dnl Assume proper GNU behavior unless another module says otherwise. |
45 | REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) | 101 | REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) |
102 | HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) | ||
46 | HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) | 103 | HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) |
47 | ]) | 104 | ]) |
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index 27cdcdb..d6961b0 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # stdint.m4 serial 43 | 1 | # stdint.m4 serial 61 |
2 | dnl Copyright (C) 2001-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,25 +7,22 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl From Paul Eggert and Bruno Haible. | 7 | dnl From Paul Eggert and Bruno Haible. |
8 | dnl Test whether <stdint.h> is supported or must be substituted. | 8 | dnl Test whether <stdint.h> is supported or must be substituted. |
9 | 9 | ||
10 | AC_PREREQ([2.61]) | ||
11 | |||
10 | AC_DEFUN_ONCE([gl_STDINT_H], | 12 | AC_DEFUN_ONCE([gl_STDINT_H], |
11 | [ | 13 | [ |
12 | AC_PREREQ([2.59])dnl | 14 | AC_PREREQ([2.59])dnl |
15 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
13 | 16 | ||
14 | dnl Check for long long int and unsigned long long int. | 17 | AC_REQUIRE([gl_LIMITS_H]) |
15 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | 18 | AC_REQUIRE([gt_TYPE_WINT_T]) |
16 | if test $ac_cv_type_long_long_int = yes; then | 19 | |
17 | HAVE_LONG_LONG_INT=1 | 20 | dnl For backward compatibility. Some packages may still be testing these |
18 | else | 21 | dnl macros. |
19 | HAVE_LONG_LONG_INT=0 | 22 | AC_DEFINE([HAVE_LONG_LONG_INT], [1], |
20 | fi | 23 | [Define to 1 if the system has the type 'long long int'.]) |
21 | AC_SUBST([HAVE_LONG_LONG_INT]) | 24 | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], |
22 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | 25 | [Define to 1 if the system has the type 'unsigned long long int'.]) |
23 | if test $ac_cv_type_unsigned_long_long_int = yes; then | ||
24 | HAVE_UNSIGNED_LONG_LONG_INT=1 | ||
25 | else | ||
26 | HAVE_UNSIGNED_LONG_LONG_INT=0 | ||
27 | fi | ||
28 | AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) | ||
29 | 26 | ||
30 | dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. | 27 | dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. |
31 | AC_CHECK_HEADERS_ONCE([wchar.h]) | 28 | AC_CHECK_HEADERS_ONCE([wchar.h]) |
@@ -37,7 +34,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], | |||
37 | AC_SUBST([HAVE_WCHAR_H]) | 34 | AC_SUBST([HAVE_WCHAR_H]) |
38 | 35 | ||
39 | dnl Check for <inttypes.h>. | 36 | dnl Check for <inttypes.h>. |
40 | dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. | 37 | AC_CHECK_HEADERS_ONCE([inttypes.h]) |
41 | if test $ac_cv_header_inttypes_h = yes; then | 38 | if test $ac_cv_header_inttypes_h = yes; then |
42 | HAVE_INTTYPES_H=1 | 39 | HAVE_INTTYPES_H=1 |
43 | else | 40 | else |
@@ -46,7 +43,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], | |||
46 | AC_SUBST([HAVE_INTTYPES_H]) | 43 | AC_SUBST([HAVE_INTTYPES_H]) |
47 | 44 | ||
48 | dnl Check for <sys/types.h>. | 45 | dnl Check for <sys/types.h>. |
49 | dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. | 46 | AC_CHECK_HEADERS_ONCE([sys/types.h]) |
50 | if test $ac_cv_header_sys_types_h = yes; then | 47 | if test $ac_cv_header_sys_types_h = yes; then |
51 | HAVE_SYS_TYPES_H=1 | 48 | HAVE_SYS_TYPES_H=1 |
52 | else | 49 | else |
@@ -70,6 +67,8 @@ AC_DEFUN_ONCE([gl_STDINT_H], | |||
70 | AC_COMPILE_IFELSE([ | 67 | AC_COMPILE_IFELSE([ |
71 | AC_LANG_PROGRAM([[ | 68 | AC_LANG_PROGRAM([[ |
72 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | 69 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
70 | #define __STDC_CONSTANT_MACROS 1 | ||
71 | #define __STDC_LIMIT_MACROS 1 | ||
73 | #include <stdint.h> | 72 | #include <stdint.h> |
74 | /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ | 73 | /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ |
75 | #if !(defined WCHAR_MIN && defined WCHAR_MAX) | 74 | #if !(defined WCHAR_MIN && defined WCHAR_MAX) |
@@ -150,6 +149,15 @@ uintptr_t h = UINTPTR_MAX; | |||
150 | intmax_t i = INTMAX_MAX; | 149 | intmax_t i = INTMAX_MAX; |
151 | uintmax_t j = UINTMAX_MAX; | 150 | uintmax_t j = UINTMAX_MAX; |
152 | 151 | ||
152 | /* Check that SIZE_MAX has the correct type, if possible. */ | ||
153 | #if 201112 <= __STDC_VERSION__ | ||
154 | int k = _Generic (SIZE_MAX, size_t: 0); | ||
155 | #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ | ||
156 | || (0x5110 <= __SUNPRO_C && !__STDC__)) | ||
157 | extern size_t k; | ||
158 | extern __typeof__ (SIZE_MAX) k; | ||
159 | #endif | ||
160 | |||
153 | #include <limits.h> /* for CHAR_BIT */ | 161 | #include <limits.h> /* for CHAR_BIT */ |
154 | #define TYPE_MINIMUM(t) \ | 162 | #define TYPE_MINIMUM(t) \ |
155 | ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) | 163 | ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) |
@@ -162,7 +170,7 @@ struct s { | |||
162 | PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) | 170 | PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) |
163 | && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) | 171 | && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) |
164 | ? 1 : -1; | 172 | ? 1 : -1; |
165 | /* Detect bug in FreeBSD 6.0 / ia64. */ | 173 | /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ |
166 | int check_SIG_ATOMIC: | 174 | int check_SIG_ATOMIC: |
167 | SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) | 175 | SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) |
168 | && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) | 176 | && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) |
@@ -218,6 +226,8 @@ struct s { | |||
218 | AC_RUN_IFELSE([ | 226 | AC_RUN_IFELSE([ |
219 | AC_LANG_PROGRAM([[ | 227 | AC_LANG_PROGRAM([[ |
220 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | 228 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
229 | #define __STDC_CONSTANT_MACROS 1 | ||
230 | #define __STDC_LIMIT_MACROS 1 | ||
221 | #include <stdint.h> | 231 | #include <stdint.h> |
222 | ] | 232 | ] |
223 | gl_STDINT_INCLUDES | 233 | gl_STDINT_INCLUDES |
@@ -272,36 +282,88 @@ static const char *macro_values[] = | |||
272 | ]])], | 282 | ]])], |
273 | [gl_cv_header_working_stdint_h=yes], | 283 | [gl_cv_header_working_stdint_h=yes], |
274 | [], | 284 | [], |
275 | [dnl When cross-compiling, assume it works. | 285 | [case "$host_os" in |
276 | gl_cv_header_working_stdint_h=yes | 286 | # Guess yes on native Windows. |
287 | mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; | ||
288 | # In general, assume it works. | ||
289 | *) gl_cv_header_working_stdint_h="guessing yes" ;; | ||
290 | esac | ||
277 | ]) | 291 | ]) |
278 | ]) | 292 | ]) |
279 | ]) | 293 | ]) |
280 | fi | 294 | fi |
281 | if test "$gl_cv_header_working_stdint_h" = yes; then | ||
282 | STDINT_H= | ||
283 | else | ||
284 | dnl Check for <sys/inttypes.h>, and for | ||
285 | dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). | ||
286 | AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) | ||
287 | if test $ac_cv_header_sys_inttypes_h = yes; then | ||
288 | HAVE_SYS_INTTYPES_H=1 | ||
289 | else | ||
290 | HAVE_SYS_INTTYPES_H=0 | ||
291 | fi | ||
292 | AC_SUBST([HAVE_SYS_INTTYPES_H]) | ||
293 | if test $ac_cv_header_sys_bitypes_h = yes; then | ||
294 | HAVE_SYS_BITYPES_H=1 | ||
295 | else | ||
296 | HAVE_SYS_BITYPES_H=0 | ||
297 | fi | ||
298 | AC_SUBST([HAVE_SYS_BITYPES_H]) | ||
299 | 295 | ||
300 | gl_STDINT_TYPE_PROPERTIES | 296 | HAVE_C99_STDINT_H=0 |
301 | STDINT_H=stdint.h | 297 | HAVE_SYS_BITYPES_H=0 |
302 | fi | 298 | HAVE_SYS_INTTYPES_H=0 |
303 | AC_SUBST([STDINT_H]) | 299 | GL_GENERATE_STDINT_H=true |
304 | AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) | 300 | case "$gl_cv_header_working_stdint_h" in |
301 | *yes) | ||
302 | HAVE_C99_STDINT_H=1 | ||
303 | dnl Now see whether the system <stdint.h> works without | ||
304 | dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. | ||
305 | dnl If not, there would be problems when stdint.h is included from C++. | ||
306 | AC_CACHE_CHECK([whether stdint.h works without ISO C predefines], | ||
307 | [gl_cv_header_stdint_without_STDC_macros], | ||
308 | [gl_cv_header_stdint_without_STDC_macros=no | ||
309 | AC_COMPILE_IFELSE([ | ||
310 | AC_LANG_PROGRAM([[ | ||
311 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | ||
312 | #include <stdint.h> | ||
313 | ] | ||
314 | gl_STDINT_INCLUDES | ||
315 | [ | ||
316 | intmax_t im = INTMAX_MAX; | ||
317 | int32_t i32 = INT32_C (0x7fffffff); | ||
318 | ]])], | ||
319 | [gl_cv_header_stdint_without_STDC_macros=yes]) | ||
320 | ]) | ||
321 | |||
322 | if test $gl_cv_header_stdint_without_STDC_macros = no; then | ||
323 | AC_DEFINE([__STDC_CONSTANT_MACROS], [1], | ||
324 | [Define to 1 if the system <stdint.h> predates C++11.]) | ||
325 | AC_DEFINE([__STDC_LIMIT_MACROS], [1], | ||
326 | [Define to 1 if the system <stdint.h> predates C++11.]) | ||
327 | fi | ||
328 | AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], | ||
329 | [gl_cv_header_stdint_width], | ||
330 | [gl_cv_header_stdint_width=no | ||
331 | AC_COMPILE_IFELSE( | ||
332 | [AC_LANG_PROGRAM([[ | ||
333 | /* Work if build is not clean. */ | ||
334 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 | ||
335 | #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
336 | #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 | ||
337 | #endif | ||
338 | #include <stdint.h> | ||
339 | ]gl_STDINT_INCLUDES[ | ||
340 | int iw = UINTMAX_WIDTH; | ||
341 | ]])], | ||
342 | [gl_cv_header_stdint_width=yes])]) | ||
343 | if test "$gl_cv_header_stdint_width" = yes; then | ||
344 | GL_GENERATE_STDINT_H=false | ||
345 | fi | ||
346 | ;; | ||
347 | *) | ||
348 | dnl Check for <sys/inttypes.h>, and for | ||
349 | dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). | ||
350 | AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) | ||
351 | if test $ac_cv_header_sys_inttypes_h = yes; then | ||
352 | HAVE_SYS_INTTYPES_H=1 | ||
353 | fi | ||
354 | if test $ac_cv_header_sys_bitypes_h = yes; then | ||
355 | HAVE_SYS_BITYPES_H=1 | ||
356 | fi | ||
357 | gl_STDINT_TYPE_PROPERTIES | ||
358 | ;; | ||
359 | esac | ||
360 | |||
361 | dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. | ||
362 | gl_REPLACE_LIMITS_H | ||
363 | |||
364 | AC_SUBST([HAVE_C99_STDINT_H]) | ||
365 | AC_SUBST([HAVE_SYS_BITYPES_H]) | ||
366 | AC_SUBST([HAVE_SYS_INTTYPES_H]) | ||
305 | ]) | 367 | ]) |
306 | 368 | ||
307 | dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) | 369 | dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) |
@@ -429,13 +491,9 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], | |||
429 | dnl gl_STDINT_INCLUDES | 491 | dnl gl_STDINT_INCLUDES |
430 | AC_DEFUN([gl_STDINT_INCLUDES], | 492 | AC_DEFUN([gl_STDINT_INCLUDES], |
431 | [[ | 493 | [[ |
432 | /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
433 | included before <wchar.h>. */ | ||
434 | #include <stddef.h> | 494 | #include <stddef.h> |
435 | #include <signal.h> | 495 | #include <signal.h> |
436 | #if HAVE_WCHAR_H | 496 | #if HAVE_WCHAR_H |
437 | # include <stdio.h> | ||
438 | # include <time.h> | ||
439 | # include <wchar.h> | 497 | # include <wchar.h> |
440 | #endif | 498 | #endif |
441 | ]]) | 499 | ]]) |
@@ -467,18 +525,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], | |||
467 | dnl requirement that wint_t is "unchanged by default argument promotions". | 525 | dnl requirement that wint_t is "unchanged by default argument promotions". |
468 | dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. | 526 | dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. |
469 | dnl Set the variable BITSIZEOF_WINT_T accordingly. | 527 | dnl Set the variable BITSIZEOF_WINT_T accordingly. |
470 | if test $BITSIZEOF_WINT_T -lt 32; then | 528 | if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then |
471 | BITSIZEOF_WINT_T=32 | 529 | BITSIZEOF_WINT_T=32 |
472 | fi | 530 | fi |
473 | ]) | 531 | ]) |
474 | |||
475 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | ||
476 | dnl Remove this when we can assume autoconf >= 2.61. | ||
477 | m4_ifdef([AC_COMPUTE_INT], [], [ | ||
478 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | ||
479 | ]) | ||
480 | |||
481 | # Hey Emacs! | ||
482 | # Local Variables: | ||
483 | # indent-tabs-mode: nil | ||
484 | # End: | ||
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 511ab4e..70349f6 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # stdint_h.m4 serial 9 | 1 | # stdint_h.m4 serial 9 |
2 | dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index ebade06..94271e1 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 | |||
@@ -1,72 +1,71 @@ | |||
1 | # stdio_h.m4 serial 43 | 1 | # stdio_h.m4 serial 59 |
2 | dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_STDIO_H], | 7 | AC_DEFUN_ONCE([gl_STDIO_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
10 | AH_VERBATIM([MINGW_ANSI_STDIO], | ||
11 | [/* Use GNU style printf and scanf. */ | ||
12 | #ifndef __USE_MINGW_ANSI_STDIO | ||
13 | # undef __USE_MINGW_ANSI_STDIO | ||
14 | #endif | ||
15 | ]) | ||
16 | AC_DEFINE([__USE_MINGW_ANSI_STDIO]) | ||
10 | gl_NEXT_HEADERS([stdio.h]) | 17 | gl_NEXT_HEADERS([stdio.h]) |
11 | 18 | ||
12 | dnl No need to create extra modules for these functions. Everyone who uses | 19 | dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and |
13 | dnl <stdio.h> likely needs them. | 20 | dnl inttypes.h behave like gnu instead of system; we must give our |
14 | GNULIB_FSCANF=1 | 21 | dnl printf wrapper the right attribute to match. |
15 | gl_MODULE_INDICATOR([fscanf]) | 22 | AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros], |
16 | GNULIB_SCANF=1 | 23 | [gl_cv_func_printf_attribute_flavor], |
17 | gl_MODULE_INDICATOR([scanf]) | 24 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
18 | GNULIB_FGETC=1 | 25 | #define __STDC_FORMAT_MACROS 1 |
19 | GNULIB_GETC=1 | 26 | #include <stdio.h> |
20 | GNULIB_GETCHAR=1 | 27 | #include <inttypes.h> |
21 | GNULIB_FGETS=1 | 28 | /* For non-mingw systems, compilation will trivially succeed. |
22 | GNULIB_FREAD=1 | 29 | For mingw, compilation will succeed for older mingw (system |
23 | dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" | 30 | printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ |
24 | dnl "expected source file, required through AC_LIBSOURCES, not found". It is | 31 | #if (defined _WIN32 && ! defined __CYGWIN__) && \ |
25 | dnl also an optimization, to avoid performing a configure check whose result | 32 | (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) |
26 | dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING | 33 | extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; |
27 | dnl or GNULIB_NONBLOCKING redundant. | 34 | #endif |
35 | ]])], [gl_cv_func_printf_attribute_flavor=system], | ||
36 | [gl_cv_func_printf_attribute_flavor=gnu])]) | ||
37 | if test "$gl_cv_func_printf_attribute_flavor" = gnu; then | ||
38 | AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1], | ||
39 | [Define to 1 if printf and friends should be labeled with | ||
40 | attribute "__gnu_printf__" instead of "__printf__"]) | ||
41 | fi | ||
42 | |||
43 | 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 | ||
45 | dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. | ||
28 | m4_ifdef([gl_NONBLOCKING_IO], [ | 46 | m4_ifdef([gl_NONBLOCKING_IO], [ |
29 | gl_NONBLOCKING_IO | 47 | gl_NONBLOCKING_IO |
30 | if test $gl_cv_have_nonblocking != yes; then | 48 | if test $gl_cv_have_nonblocking != yes; then |
31 | REPLACE_STDIO_READ_FUNCS=1 | 49 | REPLACE_STDIO_READ_FUNCS=1 |
32 | AC_LIBOBJ([stdio-read]) | ||
33 | fi | 50 | fi |
34 | ]) | 51 | ]) |
35 | 52 | ||
36 | dnl No need to create extra modules for these functions. Everyone who uses | 53 | dnl This ifdef is an optimization, to avoid performing a configure check whose |
37 | dnl <stdio.h> likely needs them. | 54 | dnl result is not used. But it does not make the test of |
38 | GNULIB_FPRINTF=1 | 55 | dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. |
39 | GNULIB_PRINTF=1 | ||
40 | GNULIB_VFPRINTF=1 | ||
41 | GNULIB_VPRINTF=1 | ||
42 | GNULIB_FPUTC=1 | ||
43 | GNULIB_PUTC=1 | ||
44 | GNULIB_PUTCHAR=1 | ||
45 | GNULIB_FPUTS=1 | ||
46 | GNULIB_PUTS=1 | ||
47 | GNULIB_FWRITE=1 | ||
48 | dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" | ||
49 | dnl "expected source file, required through AC_LIBSOURCES, not found". It is | ||
50 | dnl also an optimization, to avoid performing a configure check whose result | ||
51 | dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or | ||
52 | dnl GNULIB_SIGPIPE redundant. | ||
53 | m4_ifdef([gl_SIGNAL_SIGPIPE], [ | 56 | m4_ifdef([gl_SIGNAL_SIGPIPE], [ |
54 | gl_SIGNAL_SIGPIPE | 57 | gl_SIGNAL_SIGPIPE |
55 | if test $gl_cv_header_signal_h_SIGPIPE != yes; then | 58 | if test $gl_cv_header_signal_h_SIGPIPE != yes; then |
56 | REPLACE_STDIO_WRITE_FUNCS=1 | 59 | REPLACE_STDIO_WRITE_FUNCS=1 |
57 | AC_LIBOBJ([stdio-write]) | ||
58 | fi | 60 | fi |
59 | ]) | 61 | ]) |
60 | dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" | 62 | dnl This ifdef is an optimization, to avoid performing a configure check whose |
61 | dnl "expected source file, required through AC_LIBSOURCES, not found". It is | 63 | dnl result is not used. But it does not make the test of |
62 | dnl also an optimization, to avoid performing a configure check whose result | 64 | dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. |
63 | dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING | ||
64 | dnl or GNULIB_NONBLOCKING redundant. | ||
65 | m4_ifdef([gl_NONBLOCKING_IO], [ | 65 | m4_ifdef([gl_NONBLOCKING_IO], [ |
66 | gl_NONBLOCKING_IO | 66 | gl_NONBLOCKING_IO |
67 | if test $gl_cv_have_nonblocking != yes; then | 67 | if test $gl_cv_have_nonblocking != yes; then |
68 | REPLACE_STDIO_WRITE_FUNCS=1 | 68 | REPLACE_STDIO_WRITE_FUNCS=1 |
69 | AC_LIBOBJ([stdio-write]) | ||
70 | fi | 69 | fi |
71 | ]) | 70 | ]) |
72 | 71 | ||
@@ -76,73 +75,104 @@ AC_DEFUN([gl_STDIO_H], | |||
76 | gl_WARN_ON_USE_PREPARE([[#include <stdio.h> | 75 | gl_WARN_ON_USE_PREPARE([[#include <stdio.h> |
77 | ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen | 76 | ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen |
78 | renameat snprintf tmpfile vdprintf vsnprintf]) | 77 | renameat snprintf tmpfile vdprintf vsnprintf]) |
78 | |||
79 | AC_REQUIRE([AC_C_RESTRICT]) | ||
80 | |||
81 | AC_CHECK_DECLS_ONCE([fcloseall]) | ||
82 | if test $ac_cv_have_decl_fcloseall = no; then | ||
83 | HAVE_DECL_FCLOSEALL=0 | ||
84 | fi | ||
79 | ]) | 85 | ]) |
80 | 86 | ||
87 | # gl_STDIO_MODULE_INDICATOR([modulename]) | ||
88 | # sets the shell variable that indicates the presence of the given module | ||
89 | # to a C preprocessor expression that will evaluate to 1. | ||
90 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
81 | AC_DEFUN([gl_STDIO_MODULE_INDICATOR], | 91 | AC_DEFUN([gl_STDIO_MODULE_INDICATOR], |
82 | [ | 92 | [ |
83 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 93 | dnl Ensure to expand the default settings once only. |
84 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | 94 | gl_STDIO_H_REQUIRE_DEFAULTS |
85 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 95 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
86 | dnl Define it also as a C macro, for the benefit of the unit tests. | 96 | dnl Define it also as a C macro, for the benefit of the unit tests. |
87 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 97 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
88 | ]) | 98 | ]) |
89 | 99 | ||
100 | # Initializes the default values for AC_SUBSTed shell variables. | ||
101 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
102 | # outside of macros or in macros that are not AC_REQUIREd. | ||
103 | AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], | ||
104 | [ | ||
105 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ | ||
106 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) | ||
107 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) | ||
108 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) | ||
109 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) | ||
110 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC]) | ||
111 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS]) | ||
112 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN]) | ||
113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN_GNU]) | ||
114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF]) | ||
115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX]) | ||
116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE]) | ||
117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC]) | ||
118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS]) | ||
119 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD]) | ||
120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN]) | ||
121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF]) | ||
122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK]) | ||
123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO]) | ||
124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) | ||
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) | ||
126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) | ||
127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) | ||
128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) | ||
129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) | ||
130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) | ||
131 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) | ||
132 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) | ||
133 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) | ||
134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) | ||
135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) | ||
136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF]) | ||
137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX]) | ||
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC]) | ||
139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR]) | ||
140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS]) | ||
141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE]) | ||
142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME]) | ||
143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) | ||
144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) | ||
145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) | ||
146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) | ||
147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) | ||
148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) | ||
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) | ||
150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) | ||
151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) | ||
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) | ||
153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) | ||
154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) | ||
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) | ||
156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) | ||
157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) | ||
158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) | ||
159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) | ||
160 | dnl Support Microsoft deprecated alias function names by default. | ||
161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) | ||
162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) | ||
163 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1]) | ||
164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1]) | ||
165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1]) | ||
166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1]) | ||
167 | ]) | ||
168 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS]) | ||
169 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
170 | ]) | ||
171 | |||
90 | AC_DEFUN([gl_STDIO_H_DEFAULTS], | 172 | AC_DEFUN([gl_STDIO_H_DEFAULTS], |
91 | [ | 173 | [ |
92 | GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) | ||
93 | GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) | ||
94 | GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN]) | ||
95 | GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) | ||
96 | GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) | ||
97 | GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) | ||
98 | GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) | ||
99 | GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) | ||
100 | GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) | ||
101 | GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) | ||
102 | GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) | ||
103 | GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) | ||
104 | GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) | ||
105 | GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) | ||
106 | GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) | ||
107 | GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) | ||
108 | GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) | ||
109 | GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) | ||
110 | GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) | ||
111 | GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) | ||
112 | GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) | ||
113 | GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) | ||
114 | GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) | ||
115 | GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) | ||
116 | GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) | ||
117 | GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) | ||
118 | GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) | ||
119 | GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) | ||
120 | GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) | ||
121 | GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) | ||
122 | GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) | ||
123 | GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) | ||
124 | GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) | ||
125 | GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) | ||
126 | GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) | ||
127 | GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) | ||
128 | GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) | ||
129 | GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) | ||
130 | GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) | ||
131 | GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) | ||
132 | GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) | ||
133 | GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) | ||
134 | GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) | ||
135 | GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) | ||
136 | GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) | ||
137 | GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) | ||
138 | GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) | ||
139 | GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) | ||
140 | GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) | ||
141 | GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) | ||
142 | GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) | ||
143 | GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) | ||
144 | GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) | ||
145 | dnl Assume proper GNU behavior unless another module says otherwise. | 174 | dnl Assume proper GNU behavior unless another module says otherwise. |
175 | HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL]) | ||
146 | HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) | 176 | HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) |
147 | HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) | 177 | HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) |
148 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) | 178 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) |
@@ -164,6 +194,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], | |||
164 | REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) | 194 | REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) |
165 | REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) | 195 | REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) |
166 | REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) | 196 | REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) |
197 | REPLACE_FOPEN_FOR_FOPEN_GNU=0; AC_SUBST([REPLACE_FOPEN_FOR_FOPEN_GNU]) | ||
167 | REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) | 198 | REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) |
168 | REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) | 199 | REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) |
169 | REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) | 200 | REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) |
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index 2027ab3..e96be22 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 | |||
@@ -1,10 +1,10 @@ | |||
1 | # stdlib_h.m4 serial 42 | 1 | # stdlib_h.m4 serial 66 |
2 | dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_STDLIB_H], | 7 | AC_DEFUN_ONCE([gl_STDLIB_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
10 | gl_NEXT_HEADERS([stdlib.h]) | 10 | gl_NEXT_HEADERS([stdlib.h]) |
@@ -14,104 +14,187 @@ AC_DEFUN([gl_STDLIB_H], | |||
14 | dnl guaranteed by C89. | 14 | dnl guaranteed by C89. |
15 | gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> | 15 | gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> |
16 | #if HAVE_SYS_LOADAVG_H | 16 | #if HAVE_SYS_LOADAVG_H |
17 | /* OpenIndiana has a bug: <sys/time.h> must be included before | ||
18 | <sys/loadavg.h>. */ | ||
19 | # include <sys/time.h> | ||
17 | # include <sys/loadavg.h> | 20 | # include <sys/loadavg.h> |
18 | #endif | 21 | #endif |
19 | #if HAVE_RANDOM_H | 22 | #if HAVE_RANDOM_H |
20 | # include <random.h> | 23 | # include <random.h> |
21 | #endif | 24 | #endif |
22 | ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt | 25 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free |
23 | initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps | 26 | getloadavg getsubopt grantpt |
24 | posix_openpt ptsname ptsname_r random random_r realpath rpmatch | 27 | initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps |
25 | secure_getenv setenv setstate setstate_r srandom srandom_r | 28 | posix_memalign posix_openpt ptsname ptsname_r qsort_r |
26 | strtod strtoll strtoull unlockpt unsetenv]) | 29 | random random_r reallocarray realpath rpmatch secure_getenv setenv |
30 | setstate setstate_r srandom srandom_r | ||
31 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) | ||
32 | |||
33 | AC_REQUIRE([AC_C_RESTRICT]) | ||
34 | |||
35 | AC_CHECK_DECLS_ONCE([ecvt]) | ||
36 | if test $ac_cv_have_decl_ecvt = no; then | ||
37 | HAVE_DECL_ECVT=0 | ||
38 | fi | ||
39 | AC_CHECK_DECLS_ONCE([fcvt]) | ||
40 | if test $ac_cv_have_decl_fcvt = no; then | ||
41 | HAVE_DECL_FCVT=0 | ||
42 | fi | ||
43 | AC_CHECK_DECLS_ONCE([gcvt]) | ||
44 | if test $ac_cv_have_decl_gcvt = no; then | ||
45 | HAVE_DECL_GCVT=0 | ||
46 | fi | ||
27 | ]) | 47 | ]) |
28 | 48 | ||
49 | # gl_STDLIB_MODULE_INDICATOR([modulename]) | ||
50 | # sets the shell variable that indicates the presence of the given module | ||
51 | # to a C preprocessor expression that will evaluate to 1. | ||
52 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
29 | AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], | 53 | AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], |
30 | [ | 54 | [ |
31 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 55 | dnl Ensure to expand the default settings once only. |
32 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 56 | gl_STDLIB_H_REQUIRE_DEFAULTS |
33 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 57 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
34 | dnl Define it also as a C macro, for the benefit of the unit tests. | 58 | dnl Define it also as a C macro, for the benefit of the unit tests. |
35 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 59 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
36 | ]) | 60 | ]) |
37 | 61 | ||
62 | # Initializes the default values for AC_SUBSTed shell variables. | ||
63 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
64 | # outside of macros or in macros that are not AC_REQUIREd. | ||
65 | AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | ||
66 | [ | ||
67 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ | ||
68 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) | ||
69 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) | ||
70 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) | ||
71 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) | ||
72 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX]) | ||
73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) | ||
74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) | ||
75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) | ||
76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) | ||
77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) | ||
78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) | ||
79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) | ||
80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) | ||
81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) | ||
82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) | ||
83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS]) | ||
84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP]) | ||
85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS]) | ||
86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN]) | ||
87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT]) | ||
88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME]) | ||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) | ||
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) | ||
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) | ||
92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) | ||
93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) | ||
94 | 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]) | ||
97 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) | ||
98 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) | ||
99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) | ||
100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) | ||
101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) | ||
102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) | ||
103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) | ||
104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) | ||
105 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL]) | ||
106 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL]) | ||
107 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX]) | ||
108 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT]) | ||
109 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV]) | ||
110 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB]) | ||
111 | dnl Support Microsoft deprecated alias function names by default. | ||
112 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1]) | ||
113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1]) | ||
114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1]) | ||
115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1]) | ||
116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1]) | ||
117 | ]) | ||
118 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS]) | ||
119 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
120 | ]) | ||
121 | |||
38 | AC_DEFUN([gl_STDLIB_H_DEFAULTS], | 122 | AC_DEFUN([gl_STDLIB_H_DEFAULTS], |
39 | [ | 123 | [ |
40 | GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) | ||
41 | GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) | ||
42 | GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) | ||
43 | GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) | ||
44 | GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) | ||
45 | GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) | ||
46 | GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) | ||
47 | GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) | ||
48 | GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) | ||
49 | GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) | ||
50 | GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) | ||
51 | GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) | ||
52 | GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) | ||
53 | GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) | ||
54 | GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) | ||
55 | GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) | ||
56 | GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) | ||
57 | GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) | ||
58 | GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) | ||
59 | GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) | ||
60 | GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) | ||
61 | GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) | ||
62 | GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) | ||
63 | GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) | ||
64 | GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) | ||
65 | GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) | ||
66 | GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) | ||
67 | GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) | ||
68 | GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) | ||
69 | GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) | ||
70 | GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) | ||
71 | GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) | ||
72 | dnl Assume proper GNU behavior unless another module says otherwise. | 124 | dnl Assume proper GNU behavior unless another module says otherwise. |
73 | HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) | 125 | HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) |
126 | HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC]) | ||
74 | HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) | 127 | HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) |
75 | HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) | 128 | HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) |
129 | HAVE_DECL_ECVT=1; AC_SUBST([HAVE_DECL_ECVT]) | ||
130 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) | ||
131 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) | ||
76 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) | 132 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) |
77 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) | 133 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) |
78 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) | 134 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) |
135 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) | ||
136 | HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE]) | ||
137 | HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC]) | ||
79 | HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) | 138 | HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) |
80 | HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) | 139 | HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) |
81 | HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) | 140 | HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) |
82 | HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) | 141 | HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) |
83 | HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) | 142 | HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) |
143 | HAVE_POSIX_MEMALIGN=1; AC_SUBST([HAVE_POSIX_MEMALIGN]) | ||
84 | HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) | 144 | HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) |
85 | HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) | 145 | HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) |
86 | HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) | 146 | HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) |
147 | HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R]) | ||
87 | HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) | 148 | HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) |
88 | HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) | 149 | HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) |
89 | HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) | 150 | HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) |
151 | HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY]) | ||
90 | HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) | 152 | HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) |
91 | HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) | 153 | HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) |
92 | HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) | 154 | HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) |
93 | HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) | 155 | HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) |
94 | HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) | 156 | HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) |
157 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) | ||
158 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) | ||
95 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) | 159 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) |
160 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) | ||
161 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) | ||
96 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) | 162 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) |
163 | HAVE_STRTOUL=1; AC_SUBST([HAVE_STRTOUL]) | ||
97 | HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) | 164 | HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) |
98 | HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) | 165 | HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) |
99 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) | 166 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) |
100 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) | 167 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) |
101 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) | 168 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) |
102 | REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) | 169 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) |
170 | 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]) | ||
103 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) | 172 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) |
104 | REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) | 173 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) |
174 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) | ||
175 | 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]) | ||
105 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) | 177 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) |
106 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) | 178 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) |
179 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) | ||
107 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) | 180 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) |
108 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) | 181 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) |
109 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) | 182 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) |
183 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) | ||
184 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) | ||
110 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) | 185 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) |
111 | REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) | 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]) | ||
188 | REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) | ||
112 | REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) | 189 | REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) |
113 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) | 190 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) |
191 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) | ||
114 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) | 192 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) |
193 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) | ||
194 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) | ||
195 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) | ||
196 | REPLACE_STRTOUL=0; AC_SUBST([REPLACE_STRTOUL]) | ||
197 | REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) | ||
115 | REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) | 198 | REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) |
116 | REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) | 199 | REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) |
117 | ]) | 200 | ]) |
diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4 index 22bf57c..3cf740d 100644 --- a/gl/m4/strcase.m4 +++ b/gl/m4/strcase.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # strcase.m4 serial 11 | 1 | # strcase.m4 serial 12 |
2 | dnl Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,7 +12,7 @@ AC_DEFUN([gl_STRCASE], | |||
12 | 12 | ||
13 | AC_DEFUN([gl_FUNC_STRCASECMP], | 13 | AC_DEFUN([gl_FUNC_STRCASECMP], |
14 | [ | 14 | [ |
15 | AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) | 15 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
16 | AC_CHECK_FUNCS([strcasecmp]) | 16 | AC_CHECK_FUNCS([strcasecmp]) |
17 | if test $ac_cv_func_strcasecmp = no; then | 17 | if test $ac_cv_func_strcasecmp = no; then |
18 | HAVE_STRCASECMP=0 | 18 | HAVE_STRCASECMP=0 |
@@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_STRCASECMP], | |||
21 | 21 | ||
22 | AC_DEFUN([gl_FUNC_STRNCASECMP], | 22 | AC_DEFUN([gl_FUNC_STRNCASECMP], |
23 | [ | 23 | [ |
24 | AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) | 24 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
25 | AC_CHECK_FUNCS([strncasecmp]) | 25 | AC_CHECK_FUNCS([strncasecmp]) |
26 | if test $ac_cv_func_strncasecmp = yes; then | 26 | if test $ac_cv_func_strncasecmp = yes; then |
27 | HAVE_STRNCASECMP=1 | 27 | HAVE_STRNCASECMP=1 |
diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4 index 8681a6a..971e0b2 100644 --- a/gl/m4/strcasestr.m4 +++ b/gl/m4/strcasestr.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # strcasestr.m4 serial 21 | 1 | # strcasestr.m4 serial 28 |
2 | dnl Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005, 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl Check that strcasestr is present and works. | 7 | dnl Check that strcasestr is present and works. |
8 | AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], | 8 | AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], |
9 | [ | 9 | [ |
10 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
11 | 11 | ||
12 | dnl Persuade glibc <string.h> to declare strcasestr(). | 12 | dnl Persuade glibc <string.h> to declare strcasestr(). |
13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
@@ -17,28 +17,38 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], | |||
17 | if test $ac_cv_func_strcasestr = no; then | 17 | if test $ac_cv_func_strcasestr = no; then |
18 | HAVE_STRCASESTR=0 | 18 | HAVE_STRCASESTR=0 |
19 | else | 19 | else |
20 | if test "$gl_cv_func_memchr_works" != yes; then | 20 | if test $REPLACE_MEMCHR = 1; then |
21 | REPLACE_STRCASESTR=1 | 21 | REPLACE_STRCASESTR=1 |
22 | else | 22 | else |
23 | dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. | 23 | dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 |
24 | dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. | ||
24 | AC_CACHE_CHECK([whether strcasestr works], | 25 | AC_CACHE_CHECK([whether strcasestr works], |
25 | [gl_cv_func_strcasestr_works_always], | 26 | [gl_cv_func_strcasestr_works_always], |
26 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | 27 | [AC_RUN_IFELSE( |
27 | #include <string.h> /* for strcasestr */ | 28 | [AC_LANG_PROGRAM([[ |
29 | #include <string.h> /* for __GNU_LIBRARY__, strcasestr */ | ||
30 | #ifdef __GNU_LIBRARY__ | ||
31 | #include <features.h> | ||
32 | #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 | ||
33 | Unlucky user | ||
34 | #endif | ||
35 | #endif | ||
28 | #define P "_EF_BF_BD" | 36 | #define P "_EF_BF_BD" |
29 | #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P | 37 | #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P |
30 | #define NEEDLE P P P P P | 38 | #define NEEDLE P P P P P |
31 | ]], [[return !!strcasestr (HAYSTACK, NEEDLE); | 39 | ]], |
32 | ]])], | 40 | [[return !!strcasestr (HAYSTACK, NEEDLE); |
33 | [gl_cv_func_strcasestr_works_always=yes], | 41 | ]])], |
34 | [gl_cv_func_strcasestr_works_always=no], | 42 | [gl_cv_func_strcasestr_works_always=yes], |
35 | [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not | 43 | [gl_cv_func_strcasestr_works_always=no], |
36 | dnl affected, since it uses different source code for strcasestr | 44 | [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not |
37 | dnl than glibc. | 45 | dnl affected, since it uses different source code for strcasestr |
38 | dnl Assume that it works on all other platforms, even if it is not | 46 | dnl than glibc. |
39 | dnl linear. | 47 | dnl Assume that it works on all other platforms, even if it is not |
40 | AC_EGREP_CPP([Lucky user], | 48 | dnl linear. |
41 | [ | 49 | AC_EGREP_CPP([Lucky user], |
50 | [ | ||
51 | #include <string.h> /* for __GNU_LIBRARY__ */ | ||
42 | #ifdef __GNU_LIBRARY__ | 52 | #ifdef __GNU_LIBRARY__ |
43 | #include <features.h> | 53 | #include <features.h> |
44 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ | 54 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ |
@@ -53,10 +63,10 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], | |||
53 | #else | 63 | #else |
54 | Lucky user | 64 | Lucky user |
55 | #endif | 65 | #endif |
56 | ], | 66 | ], |
57 | [gl_cv_func_strcasestr_works_always="guessing yes"], | 67 | [gl_cv_func_strcasestr_works_always="guessing yes"], |
58 | [gl_cv_func_strcasestr_works_always="guessing no"]) | 68 | [gl_cv_func_strcasestr_works_always="$gl_cross_guess_normal"]) |
59 | ]) | 69 | ]) |
60 | ]) | 70 | ]) |
61 | case "$gl_cv_func_strcasestr_works_always" in | 71 | case "$gl_cv_func_strcasestr_works_always" in |
62 | *yes) ;; | 72 | *yes) ;; |
@@ -80,7 +90,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR], | |||
80 | #include <string.h> /* for strcasestr */ | 90 | #include <string.h> /* for strcasestr */ |
81 | #include <stdlib.h> /* for malloc */ | 91 | #include <stdlib.h> /* for malloc */ |
82 | #include <unistd.h> /* for alarm */ | 92 | #include <unistd.h> /* for alarm */ |
83 | static void quit (int sig) { exit (sig + 128); } | 93 | static void quit (int sig) { _exit (sig + 128); } |
84 | ]], [[ | 94 | ]], [[ |
85 | int result = 0; | 95 | int result = 0; |
86 | size_t m = 1000000; | 96 | size_t m = 1000000; |
@@ -102,6 +112,9 @@ static void quit (int sig) { exit (sig + 128); } | |||
102 | if (!strcasestr (haystack, needle)) | 112 | if (!strcasestr (haystack, needle)) |
103 | result |= 1; | 113 | result |= 1; |
104 | } | 114 | } |
115 | /* Free allocated memory, in case some sanitizer is watching. */ | ||
116 | free (haystack); | ||
117 | free (needle); | ||
105 | return result; | 118 | return result; |
106 | ]])], | 119 | ]])], |
107 | [gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no], | 120 | [gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no], |
@@ -124,7 +137,7 @@ static void quit (int sig) { exit (sig + 128); } | |||
124 | #endif | 137 | #endif |
125 | ], | 138 | ], |
126 | [gl_cv_func_strcasestr_linear="guessing yes"], | 139 | [gl_cv_func_strcasestr_linear="guessing yes"], |
127 | [gl_cv_func_strcasestr_linear="guessing no"]) | 140 | [gl_cv_func_strcasestr_linear="$gl_cross_guess_normal"]) |
128 | ]) | 141 | ]) |
129 | ]) | 142 | ]) |
130 | case "$gl_cv_func_strcasestr_linear" in | 143 | case "$gl_cv_func_strcasestr_linear" in |
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 index 3989844..8879eb0 100644 --- a/gl/m4/strerror.m4 +++ b/gl/m4/strerror.m4 | |||
@@ -1,19 +1,19 @@ | |||
1 | # strerror.m4 serial 17 | 1 | # strerror.m4 serial 23 |
2 | dnl Copyright (C) 2002, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_FUNC_STRERROR], | 7 | AC_DEFUN([gl_FUNC_STRERROR], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
10 | AC_REQUIRE([gl_HEADER_ERRNO_H]) | 10 | AC_REQUIRE([gl_HEADER_ERRNO_H]) |
11 | AC_REQUIRE([gl_FUNC_STRERROR_0]) | 11 | AC_REQUIRE([gl_FUNC_STRERROR_0]) |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
13 | m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ | 13 | m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ |
14 | AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) | 14 | AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) |
15 | ]) | 15 | ]) |
16 | if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then | 16 | if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then |
17 | AC_CACHE_CHECK([for working strerror function], | 17 | AC_CACHE_CHECK([for working strerror function], |
18 | [gl_cv_func_working_strerror], | 18 | [gl_cv_func_working_strerror], |
19 | [AC_RUN_IFELSE( | 19 | [AC_RUN_IFELSE( |
@@ -24,10 +24,12 @@ AC_DEFUN([gl_FUNC_STRERROR], | |||
24 | [gl_cv_func_working_strerror=yes], | 24 | [gl_cv_func_working_strerror=yes], |
25 | [gl_cv_func_working_strerror=no], | 25 | [gl_cv_func_working_strerror=no], |
26 | [case "$host_os" in | 26 | [case "$host_os" in |
27 | # Guess yes on glibc systems. | 27 | # Guess yes on glibc systems. |
28 | *-gnu*) gl_cv_func_working_strerror="guessing yes" ;; | 28 | *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; |
29 | # If we don't know, assume the worst. | 29 | # Guess yes on musl systems. |
30 | *) gl_cv_func_working_strerror="guessing no" ;; | 30 | *-musl*) gl_cv_func_working_strerror="guessing yes" ;; |
31 | # If we don't know, obey --enable-cross-guesses. | ||
32 | *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; | ||
31 | esac | 33 | esac |
32 | ]) | 34 | ]) |
33 | ]) | 35 | ]) |
@@ -78,10 +80,14 @@ AC_DEFUN([gl_FUNC_STRERROR_0], | |||
78 | [gl_cv_func_strerror_0_works=yes], | 80 | [gl_cv_func_strerror_0_works=yes], |
79 | [gl_cv_func_strerror_0_works=no], | 81 | [gl_cv_func_strerror_0_works=no], |
80 | [case "$host_os" in | 82 | [case "$host_os" in |
81 | # Guess yes on glibc systems. | 83 | # Guess yes on glibc systems. |
82 | *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; | 84 | *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; |
83 | # If we don't know, assume the worst. | 85 | # Guess yes on musl systems. |
84 | *) gl_cv_func_strerror_0_works="guessing no" ;; | 86 | *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; |
87 | # Guess yes on native Windows. | ||
88 | mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; | ||
89 | # If we don't know, obey --enable-cross-guesses. | ||
90 | *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; | ||
85 | esac | 91 | esac |
86 | ]) | 92 | ]) |
87 | ]) | 93 | ]) |
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index cc5fbbb..5da3cc2 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 | |||
@@ -1,25 +1,19 @@ | |||
1 | # Configure a GNU-like replacement for <string.h>. | 1 | # Configure a GNU-like replacement for <string.h>. |
2 | 2 | ||
3 | # Copyright (C) 2007-2013 Free Software Foundation, Inc. | 3 | # Copyright (C) 2007-2023 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 4 | # This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 5 | # gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 6 | # with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # serial 21 | 8 | # serial 35 |
9 | 9 | ||
10 | # Written by Paul Eggert. | 10 | # Written by Paul Eggert. |
11 | 11 | ||
12 | AC_DEFUN([gl_HEADER_STRING_H], | 12 | AC_DEFUN_ONCE([gl_STRING_H], |
13 | [ | 13 | [ |
14 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | 14 | dnl Ensure to expand the default settings once only, before all statements |
15 | dnl once only, before all statements that occur in other macros. | 15 | dnl that occur in other macros. |
16 | AC_REQUIRE([gl_HEADER_STRING_H_BODY]) | 16 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
17 | ]) | ||
18 | |||
19 | AC_DEFUN([gl_HEADER_STRING_H_BODY], | ||
20 | [ | ||
21 | AC_REQUIRE([AC_C_RESTRICT]) | ||
22 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | ||
23 | gl_NEXT_HEADERS([string.h]) | 17 | gl_NEXT_HEADERS([string.h]) |
24 | 18 | ||
25 | dnl Check for declarations of anything we want to poison if the | 19 | dnl Check for declarations of anything we want to poison if the |
@@ -27,66 +21,95 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], | |||
27 | dnl guaranteed by C89. | 21 | dnl guaranteed by C89. |
28 | gl_WARN_ON_USE_PREPARE([[#include <string.h> | 22 | gl_WARN_ON_USE_PREPARE([[#include <string.h> |
29 | ]], | 23 | ]], |
30 | [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul | 24 | [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit |
25 | rawmemchr stpcpy stpncpy strchrnul | ||
31 | strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r | 26 | strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r |
32 | strerror_r strsignal strverscmp]) | 27 | strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) |
28 | |||
29 | AC_REQUIRE([AC_C_RESTRICT]) | ||
33 | ]) | 30 | ]) |
34 | 31 | ||
32 | # gl_STRING_MODULE_INDICATOR([modulename]) | ||
33 | # sets the shell variable that indicates the presence of the given module | ||
34 | # to a C preprocessor expression that will evaluate to 1. | ||
35 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
35 | AC_DEFUN([gl_STRING_MODULE_INDICATOR], | 36 | AC_DEFUN([gl_STRING_MODULE_INDICATOR], |
36 | [ | 37 | [ |
37 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 38 | dnl Ensure to expand the default settings once only. |
38 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | 39 | gl_STRING_H_REQUIRE_DEFAULTS |
39 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 40 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
40 | dnl Define it also as a C macro, for the benefit of the unit tests. | 41 | dnl Define it also as a C macro, for the benefit of the unit tests. |
41 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 42 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
42 | ]) | 43 | ]) |
43 | 44 | ||
44 | AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], | 45 | # Initializes the default values for AC_SUBSTed shell variables. |
46 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
47 | # outside of macros or in macros that are not AC_REQUIREd. | ||
48 | AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], | ||
45 | [ | 49 | [ |
46 | GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) | 50 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [ |
47 | GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) | 51 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO]) |
48 | GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) | 52 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL]) |
49 | GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) | 53 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL]) |
50 | GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) | 54 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR]) |
51 | GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) | 55 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) |
52 | GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) | 56 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) |
53 | GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) | 57 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) |
54 | GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) | 58 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMSET_EXPLICIT]) |
55 | GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) | 59 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) |
56 | GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) | 60 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) |
57 | GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) | 61 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) |
58 | GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) | 62 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) |
59 | GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) | 63 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) |
60 | GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) | 64 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) |
61 | GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) | 65 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) |
62 | GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) | 66 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) |
63 | GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) | 67 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) |
64 | GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) | 68 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP]) |
65 | GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) | 69 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) |
66 | GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) | 70 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) |
67 | GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) | 71 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) |
68 | GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) | 72 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) |
69 | GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) | 73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) |
70 | GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) | 74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) |
71 | GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) | 75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR]) |
72 | GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) | 76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR]) |
73 | GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) | 77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP]) |
74 | GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) | 78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP]) |
75 | GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) | 79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP]) |
76 | GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) | 80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR]) |
77 | GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) | 81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN]) |
78 | GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) | 82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK]) |
79 | GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) | 83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) |
80 | GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) | 84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) |
81 | GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) | 85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) |
82 | GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) | 86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) |
83 | HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) | 87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) |
88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) | ||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) | ||
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) | ||
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL]) | ||
92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP]) | ||
93 | dnl Support Microsoft deprecated alias function names by default. | ||
94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1]) | ||
95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1]) | ||
96 | ]) | ||
97 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS]) | ||
98 | dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized. | ||
99 | gl_STDLIB_H_REQUIRE_DEFAULTS | ||
100 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) | ||
101 | ]) | ||
102 | |||
103 | AC_DEFUN([gl_STRING_H_DEFAULTS], | ||
104 | [ | ||
105 | HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) | ||
84 | dnl Assume proper GNU behavior unless another module says otherwise. | 106 | dnl Assume proper GNU behavior unless another module says otherwise. |
107 | HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) | ||
85 | HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) | 108 | HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) |
86 | HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) | 109 | HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) |
87 | HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) | ||
88 | HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) | 110 | HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) |
89 | HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) | 111 | HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) |
112 | HAVE_MEMSET_EXPLICIT=1; AC_SUBST([HAVE_MEMSET_EXPLICIT]) | ||
90 | HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) | 113 | HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) |
91 | HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) | 114 | HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) |
92 | HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) | 115 | HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) |
@@ -100,21 +123,26 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], | |||
100 | HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) | 123 | HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) |
101 | HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) | 124 | HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) |
102 | HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) | 125 | HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) |
126 | HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) | ||
127 | HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) | ||
128 | HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) | ||
103 | HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) | 129 | HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) |
104 | HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) | 130 | HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) |
131 | REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) | ||
105 | REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) | 132 | REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) |
106 | REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) | 133 | REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) |
107 | REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) | 134 | REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) |
135 | REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) | ||
108 | REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) | 136 | REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) |
137 | REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) | ||
138 | REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) | ||
139 | REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) | ||
109 | REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) | 140 | REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) |
110 | REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) | 141 | REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) |
111 | REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) | 142 | REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) |
112 | REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) | 143 | REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) |
113 | REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) | 144 | REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) |
114 | REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) | 145 | REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) |
115 | REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) | ||
116 | REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) | ||
117 | REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) | 146 | REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) |
118 | REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) | ||
119 | UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) | 147 | UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) |
120 | ]) | 148 | ]) |
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4 index 76ef242..4c41221 100644 --- a/gl/m4/strings_h.m4 +++ b/gl/m4/strings_h.m4 | |||
@@ -1,21 +1,16 @@ | |||
1 | # Configure a replacement for <strings.h>. | 1 | # Configure a replacement for <strings.h>. |
2 | # serial 6 | 2 | # serial 9 |
3 | 3 | ||
4 | # Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. | 4 | # Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
7 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
8 | 8 | ||
9 | AC_DEFUN([gl_HEADER_STRINGS_H], | 9 | AC_DEFUN_ONCE([gl_STRINGS_H], |
10 | [ | 10 | [ |
11 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | 11 | dnl Ensure to expand the default settings once only, before all statements |
12 | dnl once only, before all statements that occur in other macros. | 12 | dnl that occur in other macros. |
13 | AC_REQUIRE([gl_HEADER_STRINGS_H_BODY]) | 13 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
14 | ]) | ||
15 | |||
16 | AC_DEFUN([gl_HEADER_STRINGS_H_BODY], | ||
17 | [ | ||
18 | AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) | ||
19 | 14 | ||
20 | gl_CHECK_NEXT_HEADERS([strings.h]) | 15 | gl_CHECK_NEXT_HEADERS([strings.h]) |
21 | if test $ac_cv_header_strings_h = yes; then | 16 | if test $ac_cv_header_strings_h = yes; then |
@@ -35,16 +30,31 @@ AC_DEFUN([gl_HEADER_STRINGS_H_BODY], | |||
35 | ]], [ffs strcasecmp strncasecmp]) | 30 | ]], [ffs strcasecmp strncasecmp]) |
36 | ]) | 31 | ]) |
37 | 32 | ||
33 | # gl_STRINGS_MODULE_INDICATOR([modulename]) | ||
34 | # sets the shell variable that indicates the presence of the given module | ||
35 | # to a C preprocessor expression that will evaluate to 1. | ||
36 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
38 | AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], | 37 | AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], |
39 | [ | 38 | [ |
40 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 39 | dnl Ensure to expand the default settings once only. |
41 | AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) | 40 | gl_STRINGS_H_REQUIRE_DEFAULTS |
42 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 41 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
43 | ]) | 42 | ]) |
44 | 43 | ||
45 | AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS], | 44 | # Initializes the default values for AC_SUBSTed shell variables. |
45 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
46 | # outside of macros or in macros that are not AC_REQUIREd. | ||
47 | AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS], | ||
48 | [ | ||
49 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ | ||
50 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) | ||
51 | ]) | ||
52 | m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) | ||
53 | AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) | ||
54 | ]) | ||
55 | |||
56 | AC_DEFUN([gl_STRINGS_H_DEFAULTS], | ||
46 | [ | 57 | [ |
47 | GNULIB_FFS=0; AC_SUBST([GNULIB_FFS]) | ||
48 | dnl Assume proper GNU behavior unless another module says otherwise. | 58 | dnl Assume proper GNU behavior unless another module says otherwise. |
49 | HAVE_FFS=1; AC_SUBST([HAVE_FFS]) | 59 | HAVE_FFS=1; AC_SUBST([HAVE_FFS]) |
50 | HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) | 60 | HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) |
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4 deleted file mode 100644 index a1f8274..0000000 --- a/gl/m4/strndup.m4 +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | # strndup.m4 serial 21 | ||
2 | dnl Copyright (C) 2002-2003, 2005-2013 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_FUNC_STRNDUP], | ||
8 | [ | ||
9 | dnl Persuade glibc <string.h> to declare strndup(). | ||
10 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
11 | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
13 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | ||
14 | AC_CHECK_DECLS_ONCE([strndup]) | ||
15 | AC_CHECK_FUNCS_ONCE([strndup]) | ||
16 | if test $ac_cv_have_decl_strndup = no; then | ||
17 | HAVE_DECL_STRNDUP=0 | ||
18 | fi | ||
19 | |||
20 | if test $ac_cv_func_strndup = yes; then | ||
21 | HAVE_STRNDUP=1 | ||
22 | # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. | ||
23 | AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], | ||
24 | [AC_RUN_IFELSE([ | ||
25 | AC_LANG_PROGRAM([[#include <string.h> | ||
26 | #include <stdlib.h>]], [[ | ||
27 | #if !HAVE_DECL_STRNDUP | ||
28 | extern | ||
29 | #ifdef __cplusplus | ||
30 | "C" | ||
31 | #endif | ||
32 | char *strndup (const char *, size_t); | ||
33 | #endif | ||
34 | char *s; | ||
35 | s = strndup ("some longer string", 15); | ||
36 | free (s); | ||
37 | s = strndup ("shorter string", 13); | ||
38 | return s[13] != '\0';]])], | ||
39 | [gl_cv_func_strndup_works=yes], | ||
40 | [gl_cv_func_strndup_works=no], | ||
41 | [ | ||
42 | changequote(,)dnl | ||
43 | case $host_os in | ||
44 | aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";; | ||
45 | *) gl_cv_func_strndup_works="guessing yes";; | ||
46 | esac | ||
47 | changequote([,])dnl | ||
48 | ])]) | ||
49 | case $gl_cv_func_strndup_works in | ||
50 | *no) REPLACE_STRNDUP=1 ;; | ||
51 | esac | ||
52 | else | ||
53 | HAVE_STRNDUP=0 | ||
54 | fi | ||
55 | ]) | ||
diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4 deleted file mode 100644 index eae82b7..0000000 --- a/gl/m4/strnlen.m4 +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | # strnlen.m4 serial 13 | ||
2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, | ||
3 | dnl 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 | |||
8 | AC_DEFUN([gl_FUNC_STRNLEN], | ||
9 | [ | ||
10 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | ||
11 | |||
12 | dnl Persuade glibc <string.h> to declare strnlen(). | ||
13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
14 | |||
15 | AC_CHECK_DECLS_ONCE([strnlen]) | ||
16 | if test $ac_cv_have_decl_strnlen = no; then | ||
17 | HAVE_DECL_STRNLEN=0 | ||
18 | else | ||
19 | m4_pushdef([AC_LIBOBJ], [:]) | ||
20 | dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). | ||
21 | AC_FUNC_STRNLEN | ||
22 | m4_popdef([AC_LIBOBJ]) | ||
23 | if test $ac_cv_func_strnlen_working = no; then | ||
24 | REPLACE_STRNLEN=1 | ||
25 | fi | ||
26 | fi | ||
27 | ]) | ||
28 | |||
29 | # Prerequisites of lib/strnlen.c. | ||
30 | AC_DEFUN([gl_PREREQ_STRNLEN], [:]) | ||
diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4 index 825fdb8..e0da09a 100644 --- a/gl/m4/strsep.m4 +++ b/gl/m4/strsep.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # strsep.m4 serial 10 | 1 | # strsep.m4 serial 11 |
2 | dnl Copyright (C) 2002-2004, 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_STRSEP], | |||
12 | dnl The strsep() declaration in lib/string.in.h uses 'restrict'. | 12 | dnl The strsep() declaration in lib/string.in.h uses 'restrict'. |
13 | AC_REQUIRE([AC_C_RESTRICT]) | 13 | AC_REQUIRE([AC_C_RESTRICT]) |
14 | 14 | ||
15 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | 15 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
16 | AC_CHECK_FUNCS([strsep]) | 16 | AC_CHECK_FUNCS([strsep]) |
17 | if test $ac_cv_func_strsep = no; then | 17 | if test $ac_cv_func_strsep = no; then |
18 | HAVE_STRSEP=0 | 18 | HAVE_STRSEP=0 |
diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4 index c486bdb..7de203a 100644 --- a/gl/m4/strstr.m4 +++ b/gl/m4/strstr.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # strstr.m4 serial 16 | 1 | # strstr.m4 serial 24 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,30 +7,40 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl Check that strstr works. | 7 | dnl Check that strstr works. |
8 | AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], | 8 | AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], |
9 | [ | 9 | [ |
10 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | 10 | AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
11 | AC_REQUIRE([gl_FUNC_MEMCHR]) | 11 | AC_REQUIRE([gl_FUNC_MEMCHR]) |
12 | if test "$gl_cv_func_memchr_works" != yes; then | 12 | if test $REPLACE_MEMCHR = 1; then |
13 | REPLACE_STRSTR=1 | 13 | REPLACE_STRSTR=1 |
14 | else | 14 | else |
15 | dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. | 15 | dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 |
16 | dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. | ||
16 | AC_CACHE_CHECK([whether strstr works], | 17 | AC_CACHE_CHECK([whether strstr works], |
17 | [gl_cv_func_strstr_works_always], | 18 | [gl_cv_func_strstr_works_always], |
18 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | 19 | [AC_RUN_IFELSE( |
19 | #include <string.h> /* for strstr */ | 20 | [AC_LANG_PROGRAM([[ |
21 | #include <string.h> /* for __GNU_LIBRARY__, strstr */ | ||
22 | #ifdef __GNU_LIBRARY__ | ||
23 | #include <features.h> | ||
24 | #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 | ||
25 | Unlucky user | ||
26 | #endif | ||
27 | #endif | ||
20 | #define P "_EF_BF_BD" | 28 | #define P "_EF_BF_BD" |
21 | #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P | 29 | #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P |
22 | #define NEEDLE P P P P P | 30 | #define NEEDLE P P P P P |
23 | ]], [[return !!strstr (HAYSTACK, NEEDLE); | 31 | ]], |
24 | ]])], | 32 | [[return !!strstr (HAYSTACK, NEEDLE); |
25 | [gl_cv_func_strstr_works_always=yes], | 33 | ]])], |
26 | [gl_cv_func_strstr_works_always=no], | 34 | [gl_cv_func_strstr_works_always=yes], |
27 | [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not | 35 | [gl_cv_func_strstr_works_always=no], |
28 | dnl affected, since it uses different source code for strstr than | 36 | [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not |
29 | dnl glibc. | 37 | dnl affected, since it uses different source code for strstr than |
30 | dnl Assume that it works on all other platforms, even if it is not | 38 | dnl glibc. |
31 | dnl linear. | 39 | dnl Assume that it works on all other platforms, even if it is not |
32 | AC_EGREP_CPP([Lucky user], | 40 | dnl linear. |
33 | [ | 41 | AC_EGREP_CPP([Lucky user], |
42 | [ | ||
43 | #include <string.h> /* for __GNU_LIBRARY__ */ | ||
34 | #ifdef __GNU_LIBRARY__ | 44 | #ifdef __GNU_LIBRARY__ |
35 | #include <features.h> | 45 | #include <features.h> |
36 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ | 46 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ |
@@ -45,10 +55,10 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], | |||
45 | #else | 55 | #else |
46 | Lucky user | 56 | Lucky user |
47 | #endif | 57 | #endif |
48 | ], | 58 | ], |
49 | [gl_cv_func_strstr_works_always="guessing yes"], | 59 | [gl_cv_func_strstr_works_always="guessing yes"], |
50 | [gl_cv_func_strstr_works_always="guessing no"]) | 60 | [gl_cv_func_strstr_works_always="$gl_cross_guess_normal"]) |
51 | ]) | 61 | ]) |
52 | ]) | 62 | ]) |
53 | case "$gl_cv_func_strstr_works_always" in | 63 | case "$gl_cv_func_strstr_works_always" in |
54 | *yes) ;; | 64 | *yes) ;; |
@@ -67,11 +77,17 @@ AC_DEFUN([gl_FUNC_STRSTR], | |||
67 | AC_CACHE_CHECK([whether strstr works in linear time], | 77 | AC_CACHE_CHECK([whether strstr works in linear time], |
68 | [gl_cv_func_strstr_linear], | 78 | [gl_cv_func_strstr_linear], |
69 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | 79 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
80 | #ifdef __MVS__ | ||
81 | /* z/OS does not deliver signals while strstr() is running (thanks to | ||
82 | restrictions on its LE runtime), which prevents us from limiting the | ||
83 | running time of this test. */ | ||
84 | # error "This test does not work properly on z/OS" | ||
85 | #endif | ||
70 | #include <signal.h> /* for signal */ | 86 | #include <signal.h> /* for signal */ |
71 | #include <string.h> /* for strstr */ | 87 | #include <string.h> /* for strstr */ |
72 | #include <stdlib.h> /* for malloc */ | 88 | #include <stdlib.h> /* for malloc */ |
73 | #include <unistd.h> /* for alarm */ | 89 | #include <unistd.h> /* for alarm */ |
74 | static void quit (int sig) { exit (sig + 128); } | 90 | static void quit (int sig) { _exit (sig + 128); } |
75 | ]], [[ | 91 | ]], [[ |
76 | int result = 0; | 92 | int result = 0; |
77 | size_t m = 1000000; | 93 | size_t m = 1000000; |
@@ -93,6 +109,9 @@ static void quit (int sig) { exit (sig + 128); } | |||
93 | if (!strstr (haystack, needle)) | 109 | if (!strstr (haystack, needle)) |
94 | result |= 1; | 110 | result |= 1; |
95 | } | 111 | } |
112 | /* Free allocated memory, in case some sanitizer is watching. */ | ||
113 | free (haystack); | ||
114 | free (needle); | ||
96 | return result; | 115 | return result; |
97 | ]])], | 116 | ]])], |
98 | [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], | 117 | [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], |
@@ -117,7 +136,7 @@ static void quit (int sig) { exit (sig + 128); } | |||
117 | #endif | 136 | #endif |
118 | ], | 137 | ], |
119 | [gl_cv_func_strstr_linear="guessing yes"], | 138 | [gl_cv_func_strstr_linear="guessing yes"], |
120 | [gl_cv_func_strstr_linear="guessing no"]) | 139 | [gl_cv_func_strstr_linear="$gl_cross_guess_normal"]) |
121 | ]) | 140 | ]) |
122 | ]) | 141 | ]) |
123 | case "$gl_cv_func_strstr_linear" in | 142 | case "$gl_cv_func_strstr_linear" in |
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 9486377..98a1041 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 | |||
@@ -1,12 +1,12 @@ | |||
1 | # sys_socket_h.m4 serial 23 | 1 | # sys_socket_h.m4 serial 29 |
2 | dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Simon Josefsson. | 7 | dnl From Simon Josefsson. |
8 | 8 | ||
9 | AC_DEFUN([gl_HEADER_SYS_SOCKET], | 9 | AC_DEFUN_ONCE([gl_SYS_SOCKET_H], |
10 | [ | 10 | [ |
11 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) |
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
@@ -22,6 +22,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
22 | ;; | 22 | ;; |
23 | esac | 23 | esac |
24 | 24 | ||
25 | GL_GENERATE_SYS_SOCKET_H=false | ||
25 | AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], | 26 | AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], |
26 | [gl_cv_header_sys_socket_h_selfcontained], | 27 | [gl_cv_header_sys_socket_h_selfcontained], |
27 | [ | 28 | [ |
@@ -44,7 +45,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
44 | [gl_cv_header_sys_socket_h_shut=no]) | 45 | [gl_cv_header_sys_socket_h_shut=no]) |
45 | ]) | 46 | ]) |
46 | if test $gl_cv_header_sys_socket_h_shut = no; then | 47 | if test $gl_cv_header_sys_socket_h_shut = no; then |
47 | SYS_SOCKET_H='sys/socket.h' | 48 | GL_GENERATE_SYS_SOCKET_H=true |
48 | fi | 49 | fi |
49 | fi | 50 | fi |
50 | fi | 51 | fi |
@@ -83,7 +84,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
83 | fi | 84 | fi |
84 | if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ | 85 | if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ |
85 | || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then | 86 | || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then |
86 | SYS_SOCKET_H='sys/socket.h' | 87 | GL_GENERATE_SYS_SOCKET_H=true |
87 | fi | 88 | fi |
88 | gl_PREREQ_SYS_H_WINSOCK2 | 89 | gl_PREREQ_SYS_H_WINSOCK2 |
89 | 90 | ||
@@ -95,6 +96,8 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
95 | #include <sys/socket.h> | 96 | #include <sys/socket.h> |
96 | ]], [socket connect accept bind getpeername getsockname getsockopt | 97 | ]], [socket connect accept bind getpeername getsockname getsockopt |
97 | listen recv send recvfrom sendto setsockopt shutdown accept4]) | 98 | listen recv send recvfrom sendto setsockopt shutdown accept4]) |
99 | |||
100 | AC_REQUIRE([AC_C_RESTRICT]) | ||
98 | ]) | 101 | ]) |
99 | 102 | ||
100 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | 103 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], |
@@ -104,17 +107,11 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | |||
104 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | 107 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) |
105 | if test $ac_cv_header_sys_socket_h = yes; then | 108 | if test $ac_cv_header_sys_socket_h = yes; then |
106 | HAVE_SYS_SOCKET_H=1 | 109 | HAVE_SYS_SOCKET_H=1 |
107 | HAVE_WS2TCPIP_H=0 | ||
108 | else | 110 | else |
109 | HAVE_SYS_SOCKET_H=0 | 111 | HAVE_SYS_SOCKET_H=0 |
110 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
111 | HAVE_WS2TCPIP_H=1 | ||
112 | else | ||
113 | HAVE_WS2TCPIP_H=0 | ||
114 | fi | ||
115 | fi | 112 | fi |
116 | AC_SUBST([HAVE_SYS_SOCKET_H]) | 113 | AC_SUBST([HAVE_SYS_SOCKET_H]) |
117 | AC_SUBST([HAVE_WS2TCPIP_H]) | 114 | gl_PREREQ_SYS_H_WS2TCPIP |
118 | ]) | 115 | ]) |
119 | 116 | ||
120 | # Common prerequisites of the <sys/socket.h> replacement and of the | 117 | # Common prerequisites of the <sys/socket.h> replacement and of the |
@@ -142,32 +139,65 @@ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], | |||
142 | AC_SUBST([HAVE_WINSOCK2_H]) | 139 | AC_SUBST([HAVE_WINSOCK2_H]) |
143 | ]) | 140 | ]) |
144 | 141 | ||
142 | # Common prerequisites of the <sys/socket.h> replacement and of the | ||
143 | # <arpa/inet.h> replacement. | ||
144 | # Sets and substitutes HAVE_WS2TCPIP_H. | ||
145 | AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], | ||
146 | [ | ||
147 | AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) | ||
148 | if test $ac_cv_header_sys_socket_h = yes; then | ||
149 | HAVE_WS2TCPIP_H=0 | ||
150 | else | ||
151 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
152 | HAVE_WS2TCPIP_H=1 | ||
153 | else | ||
154 | HAVE_WS2TCPIP_H=0 | ||
155 | fi | ||
156 | fi | ||
157 | AC_SUBST([HAVE_WS2TCPIP_H]) | ||
158 | ]) | ||
159 | |||
160 | # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) | ||
161 | # sets the shell variable that indicates the presence of the given module | ||
162 | # to a C preprocessor expression that will evaluate to 1. | ||
163 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
145 | AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], | 164 | AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], |
146 | [ | 165 | [ |
147 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 166 | dnl Ensure to expand the default settings once only. |
148 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | 167 | gl_SYS_SOCKET_H_REQUIRE_DEFAULTS |
149 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 168 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
150 | dnl Define it also as a C macro, for the benefit of the unit tests. | 169 | dnl Define it also as a C macro, for the benefit of the unit tests. |
151 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 170 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
152 | ]) | 171 | ]) |
153 | 172 | ||
173 | # Initializes the default values for AC_SUBSTed shell variables. | ||
174 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
175 | # outside of macros or in macros that are not AC_REQUIREd. | ||
176 | AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], | ||
177 | [ | ||
178 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ | ||
179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) | ||
180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) | ||
181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) | ||
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) | ||
183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) | ||
184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) | ||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) | ||
186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) | ||
187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) | ||
188 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) | ||
189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) | ||
190 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) | ||
191 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) | ||
192 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) | ||
193 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) | ||
194 | ]) | ||
195 | m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) | ||
196 | AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) | ||
197 | ]) | ||
198 | |||
154 | AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], | 199 | AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], |
155 | [ | 200 | [ |
156 | GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) | ||
157 | GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) | ||
158 | GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) | ||
159 | GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) | ||
160 | GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) | ||
161 | GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) | ||
162 | GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) | ||
163 | GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) | ||
164 | GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) | ||
165 | GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) | ||
166 | GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) | ||
167 | GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) | ||
168 | GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) | ||
169 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) | ||
170 | GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) | ||
171 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) | 201 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) |
172 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; | 202 | HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; |
173 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) | 203 | AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) |
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 new file mode 100644 index 0000000..ca57398 --- /dev/null +++ b/gl/m4/sys_stat_h.m4 | |||
@@ -0,0 +1,129 @@ | |||
1 | # sys_stat_h.m4 serial 42 -*- Autoconf -*- | ||
2 | dnl Copyright (C) 2006-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 Eric Blake. | ||
8 | dnl Provide a GNU-like <sys/stat.h>. | ||
9 | |||
10 | AC_DEFUN_ONCE([gl_SYS_STAT_H], | ||
11 | [ | ||
12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
13 | |||
14 | dnl Check for broken stat macros. | ||
15 | AC_REQUIRE([AC_HEADER_STAT]) | ||
16 | |||
17 | gl_CHECK_NEXT_HEADERS([sys/stat.h]) | ||
18 | |||
19 | dnl Ensure the type mode_t gets defined. | ||
20 | AC_REQUIRE([AC_TYPE_MODE_T]) | ||
21 | |||
22 | dnl Whether to enable precise timestamps in 'struct stat'. | ||
23 | m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [ | ||
24 | AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC]) | ||
25 | ], [ | ||
26 | WINDOWS_STAT_TIMESPEC=0 | ||
27 | ]) | ||
28 | AC_SUBST([WINDOWS_STAT_TIMESPEC]) | ||
29 | |||
30 | dnl Whether to ensure that struct stat.st_size is 64-bit wide. | ||
31 | m4_ifdef([gl_LARGEFILE], [ | ||
32 | AC_REQUIRE([gl_LARGEFILE]) | ||
33 | ], [ | ||
34 | WINDOWS_64_BIT_ST_SIZE=0 | ||
35 | ]) | ||
36 | AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) | ||
37 | |||
38 | dnl Define types that are supposed to be defined in <sys/types.h> or | ||
39 | dnl <sys/stat.h>. | ||
40 | AC_CHECK_TYPE([nlink_t], [], | ||
41 | [AC_DEFINE([nlink_t], [int], | ||
42 | [Define to the type of st_nlink in struct stat, or a supertype.])], | ||
43 | [#include <sys/types.h> | ||
44 | #include <sys/stat.h>]) | ||
45 | |||
46 | dnl Check for declarations of anything we want to poison if the | ||
47 | dnl corresponding gnulib module is not in use. | ||
48 | gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> | ||
49 | ]], [chmod fchmodat fstat fstatat futimens getumask lchmod lstat | ||
50 | mkdirat mkfifo mkfifoat mknod mknodat stat utimensat]) | ||
51 | |||
52 | AC_REQUIRE([AC_C_RESTRICT]) | ||
53 | ]) | ||
54 | |||
55 | # gl_SYS_STAT_MODULE_INDICATOR([modulename]) | ||
56 | # sets the shell variable that indicates the presence of the given module | ||
57 | # to a C preprocessor expression that will evaluate to 1. | ||
58 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
59 | AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], | ||
60 | [ | ||
61 | dnl Ensure to expand the default settings once only. | ||
62 | gl_SYS_STAT_H_REQUIRE_DEFAULTS | ||
63 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
64 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
65 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
66 | ]) | ||
67 | |||
68 | # Initializes the default values for AC_SUBSTed shell variables. | ||
69 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
70 | # outside of macros or in macros that are not AC_REQUIREd. | ||
71 | AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS], | ||
72 | [ | ||
73 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ | ||
74 | gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR | ||
75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHMOD]) | ||
76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) | ||
77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) | ||
78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) | ||
79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS]) | ||
80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK]) | ||
81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD]) | ||
82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT]) | ||
83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR]) | ||
84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT]) | ||
85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO]) | ||
86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT]) | ||
87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD]) | ||
88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT]) | ||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT]) | ||
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT]) | ||
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT]) | ||
92 | dnl Support Microsoft deprecated alias function names by default. | ||
93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1]) | ||
94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1]) | ||
95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1]) | ||
96 | ]) | ||
97 | m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS]) | ||
98 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
99 | ]) | ||
100 | |||
101 | AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], | ||
102 | [ | ||
103 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
104 | HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) | ||
105 | HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) | ||
106 | HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) | ||
107 | HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK]) | ||
108 | HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) | ||
109 | HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) | ||
110 | HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) | ||
111 | HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) | ||
112 | HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) | ||
113 | HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) | ||
114 | HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) | ||
115 | HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) | ||
116 | REPLACE_CHMOD=0; AC_SUBST([REPLACE_CHMOD]) | ||
117 | REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT]) | ||
118 | REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) | ||
119 | REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) | ||
120 | REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) | ||
121 | REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) | ||
122 | REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) | ||
123 | REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) | ||
124 | REPLACE_MKFIFOAT=0; AC_SUBST([REPLACE_MKFIFOAT]) | ||
125 | REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) | ||
126 | REPLACE_MKNODAT=0; AC_SUBST([REPLACE_MKNODAT]) | ||
127 | REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) | ||
128 | REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) | ||
129 | ]) | ||
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4 index d15c1b3..627671f 100644 --- a/gl/m4/sys_types_h.m4 +++ b/gl/m4/sys_types_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # sys_types_h.m4 serial 5 | 1 | # sys_types_h.m4 serial 13 |
2 | dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,6 +7,10 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | AC_DEFUN_ONCE([gl_SYS_TYPES_H], | 7 | AC_DEFUN_ONCE([gl_SYS_TYPES_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) |
10 | |||
11 | dnl Use sane struct stat types in OpenVMS 8.2 and later. | ||
12 | AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) | ||
13 | |||
10 | gl_NEXT_HEADERS([sys/types.h]) | 14 | gl_NEXT_HEADERS([sys/types.h]) |
11 | 15 | ||
12 | dnl Ensure the type pid_t gets defined. | 16 | dnl Ensure the type pid_t gets defined. |
@@ -17,8 +21,50 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], | |||
17 | 21 | ||
18 | dnl Whether to override the 'off_t' type. | 22 | dnl Whether to override the 'off_t' type. |
19 | AC_REQUIRE([gl_TYPE_OFF_T]) | 23 | AC_REQUIRE([gl_TYPE_OFF_T]) |
24 | |||
25 | dnl Whether to override the 'dev_t' and 'ino_t' types. | ||
26 | m4_ifdef([gl_WINDOWS_STAT_INODES], [ | ||
27 | AC_REQUIRE([gl_WINDOWS_STAT_INODES]) | ||
28 | ], [ | ||
29 | WINDOWS_STAT_INODES=0 | ||
30 | ]) | ||
31 | AC_SUBST([WINDOWS_STAT_INODES]) | ||
32 | ]) | ||
33 | |||
34 | # Initializes the default values for AC_SUBSTed shell variables. | ||
35 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
36 | # outside of macros or in macros that are not AC_REQUIREd. | ||
37 | AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], | ||
38 | [ | ||
39 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ | ||
40 | ]) | ||
41 | m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) | ||
42 | AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) | ||
20 | ]) | 43 | ]) |
21 | 44 | ||
22 | AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], | 45 | AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], |
23 | [ | 46 | [ |
24 | ]) | 47 | ]) |
48 | |||
49 | # This works around a buggy version in autoconf <= 2.69. | ||
50 | # See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html> | ||
51 | # The 2.70 version isn't quoted properly, so override it too. | ||
52 | |||
53 | m4_version_prereq([2.70.1], [], [ | ||
54 | |||
55 | m4_undefine([AC_HEADER_MAJOR]) | ||
56 | AC_DEFUN([AC_HEADER_MAJOR], | ||
57 | [AC_CHECK_HEADERS_ONCE([sys/types.h]) | ||
58 | AC_CHECK_HEADER([sys/mkdev.h], | ||
59 | [AC_DEFINE([MAJOR_IN_MKDEV], [1], | ||
60 | [Define to 1 if `major', `minor', and `makedev' are | ||
61 | declared in <mkdev.h>.])]) | ||
62 | if test $ac_cv_header_sys_mkdev_h = no; then | ||
63 | AC_CHECK_HEADER([sys/sysmacros.h], | ||
64 | [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], | ||
65 | [Define to 1 if `major', `minor', and `makedev' | ||
66 | are declared in <sysmacros.h>.])]) | ||
67 | fi | ||
68 | ])# AC_HEADER_MAJOR | ||
69 | |||
70 | ]) | ||
diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4 index c75cbbd..93a65d2 100644 --- a/gl/m4/sys_uio_h.m4 +++ b/gl/m4/sys_uio_h.m4 | |||
@@ -1,10 +1,10 @@ | |||
1 | # sys_uio_h.m4 serial 1 | 1 | # sys_uio_h.m4 serial 3 |
2 | dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_HEADER_SYS_UIO], | 7 | AC_DEFUN_ONCE([gl_SYS_UIO_H], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) |
10 | dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK. | 10 | dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK. |
@@ -17,15 +17,30 @@ AC_DEFUN([gl_HEADER_SYS_UIO], | |||
17 | AC_SUBST([HAVE_SYS_UIO_H]) | 17 | AC_SUBST([HAVE_SYS_UIO_H]) |
18 | ]) | 18 | ]) |
19 | 19 | ||
20 | # gl_SYS_UIO_MODULE_INDICATOR([modulename]) | ||
21 | # sets the shell variable that indicates the presence of the given module | ||
22 | # to a C preprocessor expression that will evaluate to 1. | ||
23 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
20 | AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR], | 24 | AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR], |
21 | [ | 25 | [ |
22 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 26 | dnl Ensure to expand the default settings once only. |
23 | AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) | 27 | gl_SYS_UIO_H_REQUIRE_DEFAULTS |
24 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 28 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
25 | dnl Define it also as a C macro, for the benefit of the unit tests. | 29 | dnl Define it also as a C macro, for the benefit of the unit tests. |
26 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 30 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
27 | ]) | 31 | ]) |
28 | 32 | ||
33 | # Initializes the default values for AC_SUBSTed shell variables. | ||
34 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
35 | # outside of macros or in macros that are not AC_REQUIREd. | ||
36 | AC_DEFUN([gl_SYS_UIO_H_REQUIRE_DEFAULTS], | ||
37 | [ | ||
38 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS], [ | ||
39 | ]) | ||
40 | m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS]) | ||
41 | AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) | ||
42 | ]) | ||
43 | |||
29 | AC_DEFUN([gl_SYS_UIO_H_DEFAULTS], | 44 | AC_DEFUN([gl_SYS_UIO_H_DEFAULTS], |
30 | [ | 45 | [ |
31 | ]) | 46 | ]) |
diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4 index 26bdeb5..b536b04 100644 --- a/gl/m4/threadlib.m4 +++ b/gl/m4/threadlib.m4 | |||
@@ -1,11 +1,390 @@ | |||
1 | # threadlib.m4 serial 10 (gettext-0.18.2) | 1 | # threadlib.m4 serial 32a |
2 | dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
8 | 8 | ||
9 | AC_PREREQ([2.60]) | ||
10 | |||
11 | dnl The general structure of the multithreading modules in gnulib is that we | ||
12 | dnl have three set of modules: | ||
13 | dnl | ||
14 | dnl * POSIX API: | ||
15 | dnl pthread, which combines | ||
16 | dnl pthread-h | ||
17 | dnl pthread-thread | ||
18 | dnl pthread-once | ||
19 | dnl pthread-mutex | ||
20 | dnl pthread-rwlock | ||
21 | dnl pthread-cond | ||
22 | dnl pthread-tss | ||
23 | dnl pthread-spin | ||
24 | dnl sched_yield | ||
25 | dnl | ||
26 | dnl * ISO C API: | ||
27 | dnl threads, which combines | ||
28 | dnl threads-h | ||
29 | dnl thrd | ||
30 | dnl mtx | ||
31 | dnl cnd | ||
32 | dnl tss | ||
33 | dnl | ||
34 | dnl * Gnulib API, with an implementation that can be chosen at configure | ||
35 | dnl time through the option --enable-threads=... | ||
36 | dnl thread | ||
37 | dnl lock | ||
38 | dnl cond | ||
39 | dnl tls | ||
40 | dnl yield | ||
41 | dnl | ||
42 | dnl They are independent, except for the fact that | ||
43 | dnl - the implementation of the ISO C API may use the POSIX (or some other | ||
44 | dnl platform dependent) API, | ||
45 | dnl - the implementation of the Gnulib API may use the POSIX or ISO C or | ||
46 | dnl some other platform dependent API, depending on the --enable-threads | ||
47 | dnl option. | ||
48 | dnl | ||
49 | dnl This file contains macros for all of these APIs! | ||
50 | |||
51 | dnl ============================================================================ | ||
52 | dnl Macros for all thread APIs | ||
53 | |||
54 | AC_DEFUN([gl_ANYTHREADLIB_EARLY], | ||
55 | [ | ||
56 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
57 | if test -z "$gl_anythreadlib_early_done"; then | ||
58 | case "$host_os" in | ||
59 | osf*) | ||
60 | # On OSF/1, the compiler needs the flag -D_REENTRANT so that it | ||
61 | # 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, | ||
63 | # 2. putting a flag into CPPFLAGS that has an effect on the linker | ||
64 | # causes the AC_LINK_IFELSE test below to succeed unexpectedly, | ||
65 | # leading to wrong values of LIBTHREAD and LTLIBTHREAD. | ||
66 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" | ||
67 | ;; | ||
68 | esac | ||
69 | # Some systems optimize for single-threaded programs by default, and | ||
70 | # need special flags to disable these optimizations. For example, the | ||
71 | # definition of 'errno' in <errno.h>. | ||
72 | case "$host_os" in | ||
73 | aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; | ||
74 | solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; | ||
75 | esac | ||
76 | gl_anythreadlib_early_done=done | ||
77 | fi | ||
78 | ]) | ||
79 | |||
80 | dnl Checks whether the compiler and linker support weak declarations of symbols. | ||
81 | |||
82 | AC_DEFUN([gl_WEAK_SYMBOLS], | ||
83 | [ | ||
84 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
85 | AC_CACHE_CHECK([whether imported symbols can be declared weak], | ||
86 | [gl_cv_have_weak], | ||
87 | [case "$host_os" in | ||
88 | cygwin*) | ||
89 | dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but | ||
90 | dnl programs that use pthread_in_use() with weak symbol references | ||
91 | dnl crash miserably at runtime. | ||
92 | gl_cv_have_weak="guessing no" | ||
93 | ;; | ||
94 | *) | ||
95 | gl_cv_have_weak=no | ||
96 | dnl First, test whether the compiler accepts it syntactically. | ||
97 | AC_LINK_IFELSE( | ||
98 | [AC_LANG_PROGRAM( | ||
99 | [[extern void xyzzy (); | ||
100 | #pragma weak xyzzy]], | ||
101 | [[xyzzy();]])], | ||
102 | [gl_cv_have_weak=maybe]) | ||
103 | if test $gl_cv_have_weak = maybe; then | ||
104 | 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. | ||
106 | AC_RUN_IFELSE( | ||
107 | [AC_LANG_SOURCE([[ | ||
108 | #include <stdio.h> | ||
109 | #pragma weak fputs | ||
110 | int main () | ||
111 | { | ||
112 | return (fputs == NULL); | ||
113 | }]])], | ||
114 | [gl_cv_have_weak=yes], | ||
115 | [gl_cv_have_weak=no], | ||
116 | [dnl When cross-compiling, assume that only ELF platforms support | ||
117 | dnl weak symbols. | ||
118 | AC_EGREP_CPP([Extensible Linking Format], | ||
119 | [#ifdef __ELF__ | ||
120 | Extensible Linking Format | ||
121 | #endif | ||
122 | ], | ||
123 | [gl_cv_have_weak="guessing yes"], | ||
124 | [gl_cv_have_weak="guessing no"]) | ||
125 | ]) | ||
126 | fi | ||
127 | ;; | ||
128 | esac | ||
129 | dnl But when linking statically, weak symbols don't work. | ||
130 | case " $LDFLAGS " in | ||
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 symbol and linking against a shared library that has a dependency on | ||
135 | dnl the shared library that defines the symbol. | ||
136 | case "$gl_cv_have_weak" in | ||
137 | *yes) | ||
138 | case "$host_os" in | ||
139 | freebsd* | dragonfly* | midnightbsd*) | ||
140 | : > conftest1.c | ||
141 | $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 | ||
142 | cat <<EOF > conftest2.c | ||
143 | #include <pthread.h> | ||
144 | #pragma weak pthread_mutexattr_gettype | ||
145 | int main () | ||
146 | { | ||
147 | return (pthread_mutexattr_gettype != NULL); | ||
148 | } | ||
149 | EOF | ||
150 | $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ | ||
151 | || gl_cv_have_weak=no | ||
152 | rm -f conftest1.c libempty.so conftest2.c conftest | ||
153 | ;; | ||
154 | esac | ||
155 | ;; | ||
156 | esac | ||
157 | ]) | ||
158 | case "$gl_cv_have_weak" in | ||
159 | *yes) | ||
160 | AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], | ||
161 | [Define to 1 if the compiler and linker support weak declarations of symbols.]) | ||
162 | ;; | ||
163 | esac | ||
164 | ]) | ||
165 | |||
166 | dnl ============================================================================ | ||
167 | dnl Macros for the POSIX API | ||
168 | |||
169 | dnl gl_PTHREADLIB | ||
170 | dnl ------------- | ||
171 | dnl Tests for the libraries needs for using the POSIX threads API. | ||
172 | dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile. | ||
173 | dnl Sets the variable LIBPMULTITHREAD, for programs that really need | ||
174 | dnl multithread functionality. The difference between LIBPTHREAD and | ||
175 | dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically | ||
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 | ||
178 | dnl sched_yield() function. | ||
179 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for | ||
180 | dnl multithread-safe programs. | ||
181 | dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX | ||
182 | dnl threads API is available. | ||
183 | |||
184 | dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. | ||
185 | |||
186 | AC_DEFUN([gl_PTHREADLIB_BODY], | ||
187 | [ | ||
188 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) | ||
189 | if test -z "$gl_pthreadlib_body_done"; then | ||
190 | gl_pthread_api=no | ||
191 | LIBPTHREAD= | ||
192 | LIBPMULTITHREAD= | ||
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. | ||
195 | AC_CHECK_HEADER([pthread.h], | ||
196 | [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) | ||
197 | if test "$gl_have_pthread_h" = yes; then | ||
198 | # Other possible tests: | ||
199 | # -lpthreads (FSU threads, PCthreads) | ||
200 | # -lgthreads | ||
201 | # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist | ||
202 | # in libc. IRIX 6.5 has the first one in both libc and libpthread, but | ||
203 | # the second one only in libpthread, and lock.c needs it. | ||
204 | # | ||
205 | # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 | ||
206 | # needs -pthread for some reason. See: | ||
207 | # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html | ||
208 | save_LIBS=$LIBS | ||
209 | for gl_pthread in '' '-pthread'; do | ||
210 | LIBS="$LIBS $gl_pthread" | ||
211 | AC_LINK_IFELSE( | ||
212 | [AC_LANG_PROGRAM( | ||
213 | [[#include <pthread.h> | ||
214 | pthread_mutex_t m; | ||
215 | pthread_mutexattr_t ma; | ||
216 | ]], | ||
217 | [[pthread_mutex_lock (&m); | ||
218 | pthread_mutexattr_init (&ma);]])], | ||
219 | [gl_pthread_api=yes | ||
220 | LIBPTHREAD=$gl_pthread | ||
221 | LIBPMULTITHREAD=$gl_pthread]) | ||
222 | LIBS=$save_LIBS | ||
223 | test $gl_pthread_api = yes && break | ||
224 | done | ||
225 | echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD | ||
226 | echo "$as_me:__oline__: LIBPTHREAD=$LIBPTHREAD" >&AS_MESSAGE_LOG_FD | ||
227 | |||
228 | gl_pthread_in_glibc=no | ||
229 | # On Linux with glibc >= 2.34, libc contains the fully functional | ||
230 | # pthread functions. | ||
231 | case "$host_os" in | ||
232 | linux*) | ||
233 | AC_EGREP_CPP([Lucky user], | ||
234 | [#include <features.h> | ||
235 | #ifdef __GNU_LIBRARY__ | ||
236 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) | ||
237 | Lucky user | ||
238 | #endif | ||
239 | #endif | ||
240 | ], | ||
241 | [gl_pthread_in_glibc=yes], | ||
242 | []) | ||
243 | ;; | ||
244 | esac | ||
245 | echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD | ||
246 | |||
247 | # Test for libpthread by looking for pthread_kill. (Not pthread_self, | ||
248 | # since it is defined as a macro on OSF/1.) | ||
249 | if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then | ||
250 | # The program links fine without libpthread. But it may actually | ||
251 | # need to link with libpthread in order to create multiple threads. | ||
252 | AC_CHECK_LIB([pthread], [pthread_kill], | ||
253 | [if test $gl_pthread_in_glibc = yes; then | ||
254 | LIBPMULTITHREAD= | ||
255 | else | ||
256 | LIBPMULTITHREAD=-lpthread | ||
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 | ||
259 | # thread: pthread_create from libc will fail, whereas | ||
260 | # pthread_create will actually create a thread. | ||
261 | # On Solaris 10 or newer, this test is no longer needed, because | ||
262 | # libc contains the fully functional pthread functions. | ||
263 | case "$host_os" in | ||
264 | changequote(,)dnl | ||
265 | solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) | ||
266 | changequote([,])dnl | ||
267 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], | ||
268 | [Define if the pthread_in_use() detection is hard.]) | ||
269 | esac | ||
270 | fi | ||
271 | ]) | ||
272 | elif test $gl_pthread_api != yes; then | ||
273 | # Some library is needed. Try libpthread and libc_r. | ||
274 | AC_CHECK_LIB([pthread], [pthread_kill], | ||
275 | [gl_pthread_api=yes | ||
276 | LIBPTHREAD=-lpthread | ||
277 | LIBPMULTITHREAD=-lpthread]) | ||
278 | if test $gl_pthread_api != yes; then | ||
279 | # For FreeBSD 4. | ||
280 | AC_CHECK_LIB([c_r], [pthread_kill], | ||
281 | [gl_pthread_api=yes | ||
282 | LIBPTHREAD=-lc_r | ||
283 | LIBPMULTITHREAD=-lc_r]) | ||
284 | fi | ||
285 | fi | ||
286 | echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD | ||
287 | fi | ||
288 | AC_MSG_CHECKING([whether POSIX threads API is available]) | ||
289 | AC_MSG_RESULT([$gl_pthread_api]) | ||
290 | AC_SUBST([LIBPTHREAD]) | ||
291 | AC_SUBST([LIBPMULTITHREAD]) | ||
292 | if test $gl_pthread_api = yes; then | ||
293 | AC_DEFINE([HAVE_PTHREAD_API], [1], | ||
294 | [Define if you have the <pthread.h> header and the POSIX threads API.]) | ||
295 | fi | ||
296 | |||
297 | dnl On some systems, sched_yield is in librt, rather than in libpthread. | ||
298 | AC_LINK_IFELSE( | ||
299 | [AC_LANG_PROGRAM( | ||
300 | [[#include <sched.h>]], | ||
301 | [[sched_yield ();]])], | ||
302 | [LIB_SCHED_YIELD= | ||
303 | ], | ||
304 | [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], | ||
306 | [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])]) | ||
308 | ]) | ||
309 | AC_SUBST([LIB_SCHED_YIELD]) | ||
310 | |||
311 | gl_pthreadlib_body_done=done | ||
312 | fi | ||
313 | ]) | ||
314 | |||
315 | AC_DEFUN([gl_PTHREADLIB], | ||
316 | [ | ||
317 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) | ||
318 | gl_PTHREADLIB_BODY | ||
319 | ]) | ||
320 | |||
321 | dnl ============================================================================ | ||
322 | dnl Macros for the ISO C API | ||
323 | |||
324 | dnl gl_STDTHREADLIB | ||
325 | dnl --------------- | ||
326 | dnl Tests for the libraries needs for using the ISO C threads API. | ||
327 | dnl Sets the variable LIBSTDTHREAD to the linker options for use in a Makefile. | ||
328 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for | ||
329 | dnl multithread-safe programs. | ||
330 | dnl Defines the C macro HAVE_THREADS_H if (at least parts of) the ISO C threads | ||
331 | dnl API is available. | ||
332 | |||
333 | dnl The guts of gl_STDTHREADLIB. Needs to be expanded only once. | ||
334 | |||
335 | AC_DEFUN([gl_STDTHREADLIB_BODY], | ||
336 | [ | ||
337 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) | ||
338 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
339 | if test -z "$gl_stdthreadlib_body_done"; then | ||
340 | AC_CHECK_HEADERS_ONCE([threads.h]) | ||
341 | |||
342 | case "$host_os" in | ||
343 | mingw*) | ||
344 | LIBSTDTHREAD= | ||
345 | ;; | ||
346 | *) | ||
347 | gl_PTHREADLIB_BODY | ||
348 | if test $ac_cv_header_threads_h = yes; then | ||
349 | dnl glibc >= 2.29 has thrd_create in libpthread. | ||
350 | dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends | ||
351 | 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 | ||
353 | dnl libc. | ||
354 | AC_CHECK_FUNCS([thrd_create]) | ||
355 | if test $ac_cv_func_thrd_create = yes; then | ||
356 | LIBSTDTHREAD= | ||
357 | else | ||
358 | AC_CHECK_LIB([stdthreads], [thrd_create], [ | ||
359 | LIBSTDTHREAD='-lstdthreads -lpthread' | ||
360 | ], [ | ||
361 | dnl Guess that thrd_create is in libpthread. | ||
362 | LIBSTDTHREAD="$LIBPMULTITHREAD" | ||
363 | ]) | ||
364 | fi | ||
365 | else | ||
366 | dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. | ||
367 | LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" | ||
368 | fi | ||
369 | ;; | ||
370 | esac | ||
371 | AC_SUBST([LIBSTDTHREAD]) | ||
372 | |||
373 | AC_MSG_CHECKING([whether ISO C threads API is available]) | ||
374 | AC_MSG_RESULT([$ac_cv_header_threads_h]) | ||
375 | gl_stdthreadlib_body_done=done | ||
376 | fi | ||
377 | ]) | ||
378 | |||
379 | AC_DEFUN([gl_STDTHREADLIB], | ||
380 | [ | ||
381 | AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) | ||
382 | gl_STDTHREADLIB_BODY | ||
383 | ]) | ||
384 | |||
385 | dnl ============================================================================ | ||
386 | dnl Macros for the Gnulib API | ||
387 | |||
9 | dnl gl_THREADLIB | 388 | dnl gl_THREADLIB |
10 | dnl ------------ | 389 | dnl ------------ |
11 | dnl Tests for a multithreading library to be used. | 390 | dnl Tests for a multithreading library to be used. |
@@ -14,17 +393,25 @@ dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the | |||
14 | dnl default is 'no', otherwise it is system dependent. In both cases, the user | 393 | dnl default is 'no', otherwise it is system dependent. In both cases, the user |
15 | dnl can change the choice through the options --enable-threads=choice or | 394 | dnl can change the choice through the options --enable-threads=choice or |
16 | dnl --disable-threads. | 395 | dnl --disable-threads. |
17 | dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, | 396 | dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, |
18 | dnl USE_PTH_THREADS, USE_WINDOWS_THREADS | 397 | dnl USE_ISOC_AND_POSIX_THREADS, USE_WINDOWS_THREADS. |
398 | dnl The choice --enable-threads=isoc+posix is available only on platforms that | ||
399 | dnl have both the ISO C and the POSIX threads APIs. It has the effect of using | ||
400 | dnl the ISO C API for most things and the POSIX API only for creating and | ||
401 | dnl controlling threads (because there is no equivalent to pthread_atfork in | ||
402 | dnl the ISO C API). | ||
19 | dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use | 403 | dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use |
20 | dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with | 404 | dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with |
21 | dnl libtool). | 405 | dnl libtool). |
22 | dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for | 406 | dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for |
23 | dnl programs that really need multithread functionality. The difference | 407 | dnl programs that really need multithread functionality. The difference |
24 | dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak | 408 | dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak |
25 | dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread". | 409 | dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not. |
26 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for | 410 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for |
27 | dnl multithread-safe programs. | 411 | dnl multithread-safe programs. |
412 | dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the | ||
413 | dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the | ||
414 | dnl same value. Only system libraries are needed. | ||
28 | 415 | ||
29 | AC_DEFUN([gl_THREADLIB_EARLY], | 416 | AC_DEFUN([gl_THREADLIB_EARLY], |
30 | [ | 417 | [ |
@@ -43,18 +430,15 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], | |||
43 | 430 | ||
44 | AC_REQUIRE([AC_CANONICAL_HOST]) | 431 | AC_REQUIRE([AC_CANONICAL_HOST]) |
45 | dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. | 432 | dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. |
46 | dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes | 433 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
47 | dnl AC_GNU_SOURCE. | ||
48 | m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], | ||
49 | [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], | ||
50 | [AC_REQUIRE([AC_GNU_SOURCE])]) | ||
51 | dnl Check for multithreading. | 434 | dnl Check for multithreading. |
52 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], | 435 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], |
53 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], | 436 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], |
54 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) | 437 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) |
438 | m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) | ||
55 | AC_ARG_ENABLE([threads], | 439 | AC_ARG_ENABLE([threads], |
56 | AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ | 440 | AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ |
57 | AC_HELP_STRING([--disable-threads], [build without multithread safety])]), | 441 | AS_HELP_STRING([--disable-threads], [build without multithread safety])]), |
58 | [gl_use_threads=$enableval], | 442 | [gl_use_threads=$enableval], |
59 | [if test -n "$gl_use_threads_default"; then | 443 | [if test -n "$gl_use_threads_default"; then |
60 | gl_use_threads="$gl_use_threads_default" | 444 | gl_use_threads="$gl_use_threads_default" |
@@ -64,41 +448,35 @@ changequote(,)dnl | |||
64 | dnl Disable multithreading by default on OSF/1, because it interferes | 448 | dnl Disable multithreading by default on OSF/1, because it interferes |
65 | dnl with fork()/exec(): When msgexec is linked with -lpthread, its | 449 | dnl with fork()/exec(): When msgexec is linked with -lpthread, its |
66 | dnl child process gets an endless segmentation fault inside execvp(). | 450 | dnl child process gets an endless segmentation fault inside execvp(). |
451 | osf*) gl_use_threads=no ;; | ||
67 | dnl Disable multithreading by default on Cygwin 1.5.x, because it has | 452 | dnl Disable multithreading by default on Cygwin 1.5.x, because it has |
68 | dnl bugs that lead to endless loops or crashes. See | 453 | dnl bugs that lead to endless loops or crashes. See |
69 | dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>. | 454 | dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. |
70 | osf*) gl_use_threads=no ;; | ||
71 | cygwin*) | 455 | cygwin*) |
72 | case `uname -r` in | 456 | case `uname -r` in |
73 | 1.[0-5].*) gl_use_threads=no ;; | 457 | 1.[0-5].*) gl_use_threads=no ;; |
74 | *) gl_use_threads=yes ;; | 458 | *) gl_use_threads=yes ;; |
75 | esac | 459 | esac |
76 | ;; | 460 | ;; |
461 | dnl Obey gl_AVOID_WINPTHREAD on mingw. | ||
462 | mingw*) | ||
463 | case "$gl_use_winpthreads_default" in | ||
464 | yes) gl_use_threads=posix ;; | ||
465 | no) gl_use_threads=windows ;; | ||
466 | *) gl_use_threads=yes ;; | ||
467 | esac | ||
468 | ;; | ||
77 | *) gl_use_threads=yes ;; | 469 | *) gl_use_threads=yes ;; |
78 | esac | 470 | esac |
79 | changequote([,])dnl | 471 | changequote([,])dnl |
80 | fi | 472 | fi |
81 | ]) | 473 | ]) |
82 | if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then | 474 | if test "$gl_use_threads" = yes \ |
83 | # For using <pthread.h>: | 475 | || test "$gl_use_threads" = isoc \ |
84 | case "$host_os" in | 476 | || test "$gl_use_threads" = posix \ |
85 | osf*) | 477 | || test "$gl_use_threads" = isoc+posix; then |
86 | # On OSF/1, the compiler needs the flag -D_REENTRANT so that it | 478 | # For using <threads.h> or <pthread.h>: |
87 | # groks <pthread.h>. cc also understands the flag -pthread, but | 479 | gl_ANYTHREADLIB_EARLY |
88 | # we don't use it because 1. gcc-2.95 doesn't understand -pthread, | ||
89 | # 2. putting a flag into CPPFLAGS that has an effect on the linker | ||
90 | # causes the AC_LINK_IFELSE test below to succeed unexpectedly, | ||
91 | # leading to wrong values of LIBTHREAD and LTLIBTHREAD. | ||
92 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" | ||
93 | ;; | ||
94 | esac | ||
95 | # Some systems optimize for single-threaded programs by default, and | ||
96 | # need special flags to disable these optimizations. For example, the | ||
97 | # definition of 'errno' in <errno.h>. | ||
98 | case "$host_os" in | ||
99 | aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; | ||
100 | solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; | ||
101 | esac | ||
102 | fi | 480 | fi |
103 | ]) | 481 | ]) |
104 | 482 | ||
@@ -114,168 +492,69 @@ AC_DEFUN([gl_THREADLIB_BODY], | |||
114 | LTLIBMULTITHREAD= | 492 | LTLIBMULTITHREAD= |
115 | if test "$gl_use_threads" != no; then | 493 | if test "$gl_use_threads" != no; then |
116 | dnl Check whether the compiler and linker support weak declarations. | 494 | dnl Check whether the compiler and linker support weak declarations. |
117 | AC_CACHE_CHECK([whether imported symbols can be declared weak], | 495 | gl_WEAK_SYMBOLS |
118 | [gl_cv_have_weak], | 496 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then |
119 | [gl_cv_have_weak=no | 497 | dnl If we use weak symbols to implement pthread_in_use / pth_in_use / |
120 | dnl First, test whether the compiler accepts it syntactically. | 498 | dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create |
121 | AC_LINK_IFELSE( | 499 | dnl facility is in use. |
122 | [AC_LANG_PROGRAM( | 500 | AC_CHECK_HEADERS_ONCE([threads.h]) |
123 | [[extern void xyzzy (); | 501 | : |
124 | #pragma weak xyzzy]], | 502 | fi |
125 | [[xyzzy();]])], | 503 | if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then |
126 | [gl_cv_have_weak=maybe]) | 504 | AC_CHECK_HEADERS_ONCE([threads.h]) |
127 | if test $gl_cv_have_weak = maybe; then | 505 | gl_have_isoc_threads="$ac_cv_header_threads_h" |
128 | dnl Second, test whether it actually works. On Cygwin 1.7.2, with | 506 | fi |
129 | dnl gcc 4.3, symbols declared weak always evaluate to the address 0. | 507 | if test "$gl_use_threads" = yes \ |
130 | AC_RUN_IFELSE( | 508 | || test "$gl_use_threads" = posix \ |
131 | [AC_LANG_SOURCE([[ | 509 | || test "$gl_use_threads" = isoc+posix; then |
132 | #include <stdio.h> | 510 | gl_PTHREADLIB_BODY |
133 | #pragma weak fputs | 511 | LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD |
134 | int main () | 512 | LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD |
135 | { | 513 | if test $gl_pthread_api = yes; then |
136 | return (fputs == NULL); | 514 | if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then |
137 | }]])], | 515 | gl_threads_api='isoc+posix' |
138 | [gl_cv_have_weak=yes], | 516 | AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], |
139 | [gl_cv_have_weak=no], | 517 | [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) |
140 | [dnl When cross-compiling, assume that only ELF platforms support | 518 | LIBTHREAD= LTLIBTHREAD= |
141 | dnl weak symbols. | ||
142 | AC_EGREP_CPP([Extensible Linking Format], | ||
143 | [#ifdef __ELF__ | ||
144 | Extensible Linking Format | ||
145 | #endif | ||
146 | ], | ||
147 | [gl_cv_have_weak="guessing yes"], | ||
148 | [gl_cv_have_weak="guessing no"]) | ||
149 | ]) | ||
150 | fi | ||
151 | ]) | ||
152 | if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then | ||
153 | # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that | ||
154 | # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. | ||
155 | AC_CHECK_HEADER([pthread.h], | ||
156 | [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) | ||
157 | if test "$gl_have_pthread_h" = yes; then | ||
158 | # Other possible tests: | ||
159 | # -lpthreads (FSU threads, PCthreads) | ||
160 | # -lgthreads | ||
161 | gl_have_pthread= | ||
162 | # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist | ||
163 | # in libc. IRIX 6.5 has the first one in both libc and libpthread, but | ||
164 | # the second one only in libpthread, and lock.c needs it. | ||
165 | AC_LINK_IFELSE( | ||
166 | [AC_LANG_PROGRAM( | ||
167 | [[#include <pthread.h>]], | ||
168 | [[pthread_mutex_lock((pthread_mutex_t*)0); | ||
169 | pthread_mutexattr_init((pthread_mutexattr_t*)0);]])], | ||
170 | [gl_have_pthread=yes]) | ||
171 | # Test for libpthread by looking for pthread_kill. (Not pthread_self, | ||
172 | # since it is defined as a macro on OSF/1.) | ||
173 | if test -n "$gl_have_pthread"; then | ||
174 | # The program links fine without libpthread. But it may actually | ||
175 | # need to link with libpthread in order to create multiple threads. | ||
176 | AC_CHECK_LIB([pthread], [pthread_kill], | ||
177 | [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread | ||
178 | # On Solaris and HP-UX, most pthread functions exist also in libc. | ||
179 | # Therefore pthread_in_use() needs to actually try to create a | ||
180 | # thread: pthread_create from libc will fail, whereas | ||
181 | # pthread_create will actually create a thread. | ||
182 | case "$host_os" in | ||
183 | solaris* | hpux*) | ||
184 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], | ||
185 | [Define if the pthread_in_use() detection is hard.]) | ||
186 | esac | ||
187 | ]) | ||
188 | else | 519 | else |
189 | # Some library is needed. Try libpthread and libc_r. | ||
190 | AC_CHECK_LIB([pthread], [pthread_kill], | ||
191 | [gl_have_pthread=yes | ||
192 | LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread | ||
193 | LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) | ||
194 | if test -z "$gl_have_pthread"; then | ||
195 | # For FreeBSD 4. | ||
196 | AC_CHECK_LIB([c_r], [pthread_kill], | ||
197 | [gl_have_pthread=yes | ||
198 | LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r | ||
199 | LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) | ||
200 | fi | ||
201 | fi | ||
202 | if test -n "$gl_have_pthread"; then | ||
203 | gl_threads_api=posix | 520 | gl_threads_api=posix |
204 | AC_DEFINE([USE_POSIX_THREADS], [1], | 521 | AC_DEFINE([USE_POSIX_THREADS], [1], |
205 | [Define if the POSIX multithreading library can be used.]) | 522 | [Define if the POSIX multithreading library can be used.]) |
206 | if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then | 523 | if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then |
524 | AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], | ||
525 | [Define if references to the POSIX multithreading library are satisfied by libc.]) | ||
526 | else | ||
207 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | 527 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then |
208 | AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], | 528 | AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], |
209 | [Define if references to the POSIX multithreading library should be made weak.]) | 529 | [Define if references to the POSIX multithreading library should be made weak.]) |
210 | LIBTHREAD= | 530 | LIBTHREAD= LTLIBTHREAD= |
211 | LTLIBTHREAD= | 531 | else |
532 | case "$host_os" in | ||
533 | freebsd* | dragonfly* | midnightbsd*) | ||
534 | if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then | ||
535 | dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() | ||
536 | dnl etc. will succeed, we need a runtime test. | ||
537 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], | ||
538 | [Define if the pthread_in_use() detection is hard.]) | ||
539 | fi | ||
540 | ;; | ||
541 | esac | ||
212 | fi | 542 | fi |
213 | fi | 543 | fi |
214 | fi | 544 | fi |
215 | fi | 545 | fi |
216 | fi | 546 | fi |
217 | if test -z "$gl_have_pthread"; then | 547 | if test $gl_threads_api = none; then |
218 | if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then | 548 | if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then |
219 | gl_have_solaristhread= | 549 | gl_STDTHREADLIB_BODY |
220 | gl_save_LIBS="$LIBS" | 550 | LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD |
221 | LIBS="$LIBS -lthread" | 551 | LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD |
222 | AC_LINK_IFELSE( | 552 | gl_threads_api=isoc |
223 | [AC_LANG_PROGRAM( | 553 | AC_DEFINE([USE_ISOC_THREADS], [1], |
224 | [[ | 554 | [Define if the ISO C multithreading library can be used.]) |
225 | #include <thread.h> | ||
226 | #include <synch.h> | ||
227 | ]], | ||
228 | [[thr_self();]])], | ||
229 | [gl_have_solaristhread=yes]) | ||
230 | LIBS="$gl_save_LIBS" | ||
231 | if test -n "$gl_have_solaristhread"; then | ||
232 | gl_threads_api=solaris | ||
233 | LIBTHREAD=-lthread | ||
234 | LTLIBTHREAD=-lthread | ||
235 | LIBMULTITHREAD="$LIBTHREAD" | ||
236 | LTLIBMULTITHREAD="$LTLIBTHREAD" | ||
237 | AC_DEFINE([USE_SOLARIS_THREADS], [1], | ||
238 | [Define if the old Solaris multithreading library can be used.]) | ||
239 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | ||
240 | AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], | ||
241 | [Define if references to the old Solaris multithreading library should be made weak.]) | ||
242 | LIBTHREAD= | ||
243 | LTLIBTHREAD= | ||
244 | fi | ||
245 | fi | ||
246 | fi | 555 | fi |
247 | fi | 556 | fi |
248 | if test "$gl_use_threads" = pth; then | 557 | if test $gl_threads_api = none; then |
249 | gl_save_CPPFLAGS="$CPPFLAGS" | ||
250 | AC_LIB_LINKFLAGS([pth]) | ||
251 | gl_have_pth= | ||
252 | gl_save_LIBS="$LIBS" | ||
253 | LIBS="$LIBS $LIBPTH" | ||
254 | AC_LINK_IFELSE( | ||
255 | [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])], | ||
256 | [gl_have_pth=yes]) | ||
257 | LIBS="$gl_save_LIBS" | ||
258 | if test -n "$gl_have_pth"; then | ||
259 | gl_threads_api=pth | ||
260 | LIBTHREAD="$LIBPTH" | ||
261 | LTLIBTHREAD="$LTLIBPTH" | ||
262 | LIBMULTITHREAD="$LIBTHREAD" | ||
263 | LTLIBMULTITHREAD="$LTLIBTHREAD" | ||
264 | AC_DEFINE([USE_PTH_THREADS], [1], | ||
265 | [Define if the GNU Pth multithreading library can be used.]) | ||
266 | if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then | ||
267 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | ||
268 | AC_DEFINE([USE_PTH_THREADS_WEAK], [1], | ||
269 | [Define if references to the GNU Pth multithreading library should be made weak.]) | ||
270 | LIBTHREAD= | ||
271 | LTLIBTHREAD= | ||
272 | fi | ||
273 | fi | ||
274 | else | ||
275 | CPPFLAGS="$gl_save_CPPFLAGS" | ||
276 | fi | ||
277 | fi | ||
278 | if test -z "$gl_have_pthread"; then | ||
279 | case "$gl_use_threads" in | 558 | case "$gl_use_threads" in |
280 | yes | windows | win32) # The 'win32' is for backward compatibility. | 559 | yes | windows | win32) # The 'win32' is for backward compatibility. |
281 | if { case "$host_os" in | 560 | if { case "$host_os" in |
@@ -317,6 +596,21 @@ AC_DEFUN([gl_DISABLE_THREADS], [ | |||
317 | ]) | 596 | ]) |
318 | 597 | ||
319 | 598 | ||
599 | dnl gl_AVOID_WINPTHREAD | ||
600 | dnl ------------------- | ||
601 | dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the | ||
602 | dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. | ||
603 | dnl The user can still override it at installation time, by using the | ||
604 | dnl configure option '--enable-threads'. | ||
605 | |||
606 | AC_DEFUN([gl_AVOID_WINPTHREAD], [ | ||
607 | m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) | ||
608 | ]) | ||
609 | |||
610 | |||
611 | dnl ============================================================================ | ||
612 | |||
613 | |||
320 | dnl Survey of platforms: | 614 | dnl Survey of platforms: |
321 | dnl | 615 | dnl |
322 | dnl Platform Available Compiler Supports test-lock | 616 | dnl Platform Available Compiler Supports test-lock |
@@ -324,7 +618,11 @@ dnl flavours option weak result | |||
324 | dnl --------------- --------- --------- -------- --------- | 618 | dnl --------------- --------- --------- -------- --------- |
325 | dnl Linux 2.4/glibc posix -lpthread Y OK | 619 | dnl Linux 2.4/glibc posix -lpthread Y OK |
326 | dnl | 620 | dnl |
327 | dnl GNU Hurd/glibc posix | 621 | dnl Linux/glibc 2.34 posix Y OK |
622 | dnl | ||
623 | dnl GNU Hurd/glibc posix -lpthread Y OK | ||
624 | dnl | ||
625 | dnl Ubuntu 14.04 posix -pthread Y OK | ||
328 | dnl | 626 | dnl |
329 | dnl FreeBSD 5.3 posix -lc_r Y | 627 | dnl FreeBSD 5.3 posix -lc_r Y |
330 | dnl posix -lkse ? Y | 628 | dnl posix -lkse ? Y |
@@ -344,7 +642,6 @@ dnl | |||
344 | dnl Mac OS X 10.[123] posix -lpthread Y OK | 642 | dnl Mac OS X 10.[123] posix -lpthread Y OK |
345 | dnl | 643 | dnl |
346 | dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK | 644 | dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK |
347 | dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK | ||
348 | dnl | 645 | dnl |
349 | dnl HP-UX 11 posix -lpthread N (cc) OK | 646 | dnl HP-UX 11 posix -lpthread N (cc) OK |
350 | dnl Y (gcc) | 647 | dnl Y (gcc) |
@@ -358,8 +655,6 @@ dnl -lpthread (gcc) Y | |||
358 | dnl | 655 | dnl |
359 | dnl Cygwin posix -lpthread Y OK | 656 | dnl Cygwin posix -lpthread Y OK |
360 | dnl | 657 | dnl |
361 | dnl Any of the above pth -lpth 0.0 | ||
362 | dnl | ||
363 | dnl Mingw windows N OK | 658 | dnl Mingw windows N OK |
364 | dnl | 659 | dnl |
365 | dnl BeOS 5 -- | 660 | dnl BeOS 5 -- |
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index 3b83900..f6bf3a4 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 | |||
@@ -1,8 +1,8 @@ | |||
1 | # Configure a more-standard replacement for <time.h>. | 1 | # Configure a more-standard replacement for <time.h>. |
2 | 2 | ||
3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc. | 3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc. |
4 | 4 | ||
5 | # serial 7 | 5 | # serial 20 |
6 | 6 | ||
7 | # This file is free software; the Free Software Foundation | 7 | # This file is free software; the Free Software Foundation |
8 | # gives unlimited permission to copy and/or distribute it, | 8 | # gives unlimited permission to copy and/or distribute it, |
@@ -10,23 +10,42 @@ | |||
10 | 10 | ||
11 | # Written by Paul Eggert and Jim Meyering. | 11 | # Written by Paul Eggert and Jim Meyering. |
12 | 12 | ||
13 | AC_DEFUN([gl_HEADER_TIME_H], | 13 | AC_DEFUN_ONCE([gl_TIME_H], |
14 | [ | 14 | [ |
15 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | 15 | dnl Ensure to expand the default settings once only, before all statements |
16 | dnl once only, before all statements that occur in other macros. | 16 | dnl that occur in other macros. |
17 | AC_REQUIRE([gl_HEADER_TIME_H_BODY]) | 17 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) |
18 | ]) | ||
19 | 18 | ||
20 | AC_DEFUN([gl_HEADER_TIME_H_BODY], | ||
21 | [ | ||
22 | AC_REQUIRE([AC_C_RESTRICT]) | ||
23 | AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) | ||
24 | gl_NEXT_HEADERS([time.h]) | 19 | gl_NEXT_HEADERS([time.h]) |
25 | AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) | 20 | AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) |
21 | |||
22 | dnl Check for declarations of anything we want to poison if the | ||
23 | dnl corresponding gnulib module is not in use. | ||
24 | gl_WARN_ON_USE_PREPARE([[ | ||
25 | #include <time.h> | ||
26 | ]], [asctime_r ctime_r]) | ||
27 | |||
28 | AC_REQUIRE([AC_C_RESTRICT]) | ||
29 | |||
30 | AC_CACHE_CHECK([for TIME_UTC in <time.h>], | ||
31 | [gl_cv_time_h_has_TIME_UTC], | ||
32 | [AC_COMPILE_IFELSE( | ||
33 | [AC_LANG_PROGRAM( | ||
34 | [[#include <time.h> | ||
35 | ]], | ||
36 | [[static int x = TIME_UTC; x++;]])], | ||
37 | [gl_cv_time_h_has_TIME_UTC=yes], | ||
38 | [gl_cv_time_h_has_TIME_UTC=no])]) | ||
39 | if test $gl_cv_time_h_has_TIME_UTC = yes; then | ||
40 | TIME_H_DEFINES_TIME_UTC=1 | ||
41 | else | ||
42 | TIME_H_DEFINES_TIME_UTC=0 | ||
43 | fi | ||
44 | AC_SUBST([TIME_H_DEFINES_TIME_UTC]) | ||
26 | ]) | 45 | ]) |
27 | 46 | ||
28 | dnl Check whether 'struct timespec' is declared | 47 | dnl Check whether 'struct timespec' is declared |
29 | dnl in time.h, sys/time.h, or pthread.h. | 48 | dnl in time.h, sys/time.h, pthread.h, or unistd.h. |
30 | 49 | ||
31 | AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], | 50 | AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], |
32 | [ | 51 | [ |
@@ -44,6 +63,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], | |||
44 | TIME_H_DEFINES_STRUCT_TIMESPEC=0 | 63 | TIME_H_DEFINES_STRUCT_TIMESPEC=0 |
45 | SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 | 64 | SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 |
46 | PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 | 65 | PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 |
66 | UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 | ||
47 | if test $gl_cv_sys_struct_timespec_in_time_h = yes; then | 67 | if test $gl_cv_sys_struct_timespec_in_time_h = yes; then |
48 | TIME_H_DEFINES_STRUCT_TIMESPEC=1 | 68 | TIME_H_DEFINES_STRUCT_TIMESPEC=1 |
49 | else | 69 | else |
@@ -70,40 +90,94 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], | |||
70 | [gl_cv_sys_struct_timespec_in_pthread_h=no])]) | 90 | [gl_cv_sys_struct_timespec_in_pthread_h=no])]) |
71 | if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then | 91 | if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then |
72 | PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 | 92 | PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 |
93 | else | ||
94 | AC_CACHE_CHECK([for struct timespec in <unistd.h>], | ||
95 | [gl_cv_sys_struct_timespec_in_unistd_h], | ||
96 | [AC_COMPILE_IFELSE( | ||
97 | [AC_LANG_PROGRAM( | ||
98 | [[#include <unistd.h> | ||
99 | ]], | ||
100 | [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], | ||
101 | [gl_cv_sys_struct_timespec_in_unistd_h=yes], | ||
102 | [gl_cv_sys_struct_timespec_in_unistd_h=no])]) | ||
103 | if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then | ||
104 | UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 | ||
105 | fi | ||
73 | fi | 106 | fi |
74 | fi | 107 | fi |
75 | fi | 108 | fi |
76 | AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) | 109 | AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) |
77 | AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) | 110 | AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) |
78 | AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) | 111 | AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) |
112 | AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) | ||
79 | ]) | 113 | ]) |
80 | 114 | ||
115 | # gl_TIME_MODULE_INDICATOR([modulename]) | ||
116 | # sets the shell variable that indicates the presence of the given module | ||
117 | # to a C preprocessor expression that will evaluate to 1. | ||
118 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
81 | AC_DEFUN([gl_TIME_MODULE_INDICATOR], | 119 | AC_DEFUN([gl_TIME_MODULE_INDICATOR], |
82 | [ | 120 | [ |
83 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 121 | dnl Ensure to expand the default settings once only. |
84 | AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) | 122 | gl_TIME_H_REQUIRE_DEFAULTS |
85 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 123 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
86 | dnl Define it also as a C macro, for the benefit of the unit tests. | 124 | dnl Define it also as a C macro, for the benefit of the unit tests. |
87 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 125 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
88 | ]) | 126 | ]) |
89 | 127 | ||
90 | AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], | 128 | # Initializes the default values for AC_SUBSTed shell variables. |
129 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
130 | # outside of macros or in macros that are not AC_REQUIREd. | ||
131 | AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], | ||
132 | [ | ||
133 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [ | ||
134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME]) | ||
135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME]) | ||
136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME]) | ||
137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) | ||
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) | ||
139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) | ||
140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) | ||
141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) | ||
142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) | ||
143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) | ||
144 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) | ||
145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) | ||
146 | dnl Support Microsoft deprecated alias function names by default. | ||
147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) | ||
148 | ]) | ||
149 | m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS]) | ||
150 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) | ||
151 | ]) | ||
152 | |||
153 | AC_DEFUN([gl_TIME_H_DEFAULTS], | ||
91 | [ | 154 | [ |
92 | GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) | ||
93 | GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) | ||
94 | GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) | ||
95 | GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) | ||
96 | GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) | ||
97 | dnl Assume proper GNU behavior unless another module says otherwise. | 155 | dnl Assume proper GNU behavior unless another module says otherwise. |
98 | HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) | 156 | HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) |
99 | HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) | 157 | HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) |
100 | HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) | 158 | HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) |
101 | HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) | 159 | HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) |
160 | HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) | ||
161 | HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) | ||
162 | dnl Even GNU libc does not have timezone_t yet. | ||
163 | HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) | ||
102 | dnl If another module says to replace or to not replace, do that. | 164 | dnl If another module says to replace or to not replace, do that. |
103 | dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; | 165 | dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; |
104 | dnl this lets maintainers check for portability. | 166 | dnl this lets maintainers check for portability. |
167 | REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) | ||
105 | REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) | 168 | REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) |
106 | REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) | 169 | REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) |
107 | REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) | 170 | REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) |
171 | REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) | ||
108 | REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) | 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]) | ||
182 | REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) | ||
109 | ]) | 183 | ]) |
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4 index c388a83..adce438 100644 --- a/gl/m4/time_r.m4 +++ b/gl/m4/time_r.m4 | |||
@@ -1,6 +1,6 @@ | |||
1 | dnl Reentrant time functions: localtime_r, gmtime_r. | 1 | dnl Reentrant time functions: localtime_r, gmtime_r. |
2 | 2 | ||
3 | dnl Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2003, 2006-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. |
@@ -12,12 +12,20 @@ AC_DEFUN([gl_TIME_R], | |||
12 | dnl Persuade glibc and Solaris <time.h> to declare localtime_r. | 12 | dnl Persuade glibc and Solaris <time.h> to declare localtime_r. |
13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
14 | 14 | ||
15 | AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) | 15 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) |
16 | AC_REQUIRE([AC_C_RESTRICT]) | 16 | AC_REQUIRE([AC_C_RESTRICT]) |
17 | 17 | ||
18 | dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is | 18 | dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is |
19 | dnl not defined. | 19 | dnl not defined. |
20 | AC_CHECK_DECLS([localtime_r], [], [], [[#include <time.h>]]) | 20 | AC_CHECK_DECLS([localtime_r], [], [], |
21 | [[/* mingw's <time.h> provides the functions asctime_r, ctime_r, | ||
22 | gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has | ||
23 | been included before. */ | ||
24 | #if defined __MINGW32__ | ||
25 | # include <unistd.h> | ||
26 | #endif | ||
27 | #include <time.h> | ||
28 | ]]) | ||
21 | if test $ac_cv_have_decl_localtime_r = no; then | 29 | if test $ac_cv_have_decl_localtime_r = no; then |
22 | HAVE_DECL_LOCALTIME_R=0 | 30 | HAVE_DECL_LOCALTIME_R=0 |
23 | fi | 31 | fi |
@@ -29,7 +37,14 @@ AC_DEFUN([gl_TIME_R], | |||
29 | [gl_cv_time_r_posix], | 37 | [gl_cv_time_r_posix], |
30 | [AC_COMPILE_IFELSE( | 38 | [AC_COMPILE_IFELSE( |
31 | [AC_LANG_PROGRAM( | 39 | [AC_LANG_PROGRAM( |
32 | [[#include <time.h>]], | 40 | [[/* mingw's <time.h> provides the functions asctime_r, ctime_r, |
41 | gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has | ||
42 | been included before. */ | ||
43 | #if defined __MINGW32__ | ||
44 | # include <unistd.h> | ||
45 | #endif | ||
46 | #include <time.h> | ||
47 | ]], | ||
33 | [[/* We don't need to append 'restrict's to the argument types, | 48 | [[/* We don't need to append 'restrict's to the argument types, |
34 | even though the POSIX signature has the 'restrict's, | 49 | even though the POSIX signature has the 'restrict's, |
35 | since C99 says they can't affect type compatibility. */ | 50 | since C99 says they can't affect type compatibility. */ |
@@ -49,6 +64,32 @@ AC_DEFUN([gl_TIME_R], | |||
49 | fi | 64 | fi |
50 | else | 65 | else |
51 | HAVE_LOCALTIME_R=0 | 66 | HAVE_LOCALTIME_R=0 |
67 | dnl On mingw, localtime_r() is defined as an inline function; use through a | ||
68 | dnl direct function call works but the use as a function pointer leads to a | ||
69 | dnl link error. | ||
70 | AC_CACHE_CHECK([whether localtime_r exists as an inline function], | ||
71 | [gl_cv_func_localtime_r_inline], | ||
72 | [AC_LINK_IFELSE( | ||
73 | [AC_LANG_PROGRAM( | ||
74 | [[/* mingw's <time.h> provides the functions asctime_r, ctime_r, | ||
75 | gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has | ||
76 | been included before. */ | ||
77 | #if defined __MINGW32__ | ||
78 | # include <unistd.h> | ||
79 | #endif | ||
80 | #include <time.h> | ||
81 | ]], | ||
82 | [[time_t a; | ||
83 | struct tm r; | ||
84 | localtime_r (&a, &r); | ||
85 | ]]) | ||
86 | ], | ||
87 | [gl_cv_func_localtime_r_inline=yes], | ||
88 | [gl_cv_func_localtime_r_inline=no]) | ||
89 | ]) | ||
90 | if test $gl_cv_func_localtime_r_inline = yes; then | ||
91 | REPLACE_LOCALTIME_R=1 | ||
92 | fi | ||
52 | fi | 93 | fi |
53 | ]) | 94 | ]) |
54 | 95 | ||
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4 index 997953c..6079f1a 100644 --- a/gl/m4/timegm.m4 +++ b/gl/m4/timegm.m4 | |||
@@ -1,17 +1,17 @@ | |||
1 | # timegm.m4 serial 11 | 1 | # timegm.m4 serial 13 |
2 | dnl Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_FUNC_TIMEGM], | 7 | AC_DEFUN([gl_FUNC_TIMEGM], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_TIME_H_DEFAULTS]) |
10 | AC_REQUIRE([gl_FUNC_MKTIME]) | 10 | AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) |
11 | REPLACE_TIMEGM=0 | 11 | REPLACE_TIMEGM=0 |
12 | AC_CHECK_FUNCS_ONCE([timegm]) | 12 | AC_CHECK_FUNCS_ONCE([timegm]) |
13 | if test $ac_cv_func_timegm = yes; then | 13 | if test $ac_cv_func_timegm = yes; then |
14 | if test $gl_cv_func_working_mktime = no; then | 14 | if test "$gl_cv_func_working_mktime" != yes; then |
15 | # Assume that timegm is buggy if mktime is. | 15 | # Assume that timegm is buggy if mktime is. |
16 | REPLACE_TIMEGM=1 | 16 | REPLACE_TIMEGM=1 |
17 | fi | 17 | fi |
diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4 deleted file mode 100644 index c6ff800..0000000 --- a/gl/m4/uintmax_t.m4 +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | # uintmax_t.m4 serial 12 | ||
2 | dnl Copyright (C) 1997-2004, 2007-2013 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 Paul Eggert. | ||
8 | |||
9 | AC_PREREQ([2.13]) | ||
10 | |||
11 | # Define uintmax_t to 'unsigned long' or 'unsigned long long' | ||
12 | # if it is not already defined in <stdint.h> or <inttypes.h>. | ||
13 | |||
14 | AC_DEFUN([gl_AC_TYPE_UINTMAX_T], | ||
15 | [ | ||
16 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
17 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
18 | if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then | ||
19 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | ||
20 | test $ac_cv_type_unsigned_long_long_int = yes \ | ||
21 | && ac_type='unsigned long long' \ | ||
22 | || ac_type='unsigned long' | ||
23 | AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], | ||
24 | [Define to unsigned long or unsigned long long | ||
25 | if <stdint.h> and <inttypes.h> don't define.]) | ||
26 | else | ||
27 | AC_DEFINE([HAVE_UINTMAX_T], [1], | ||
28 | [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
29 | fi | ||
30 | ]) | ||
diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 new file mode 100644 index 0000000..8977a34 --- /dev/null +++ b/gl/m4/ungetc.m4 | |||
@@ -0,0 +1,73 @@ | |||
1 | # ungetc.m4 serial 10 | ||
2 | dnl Copyright (C) 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_ONCE([gl_FUNC_UNGETC_WORKS], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_PROG_CC]) | ||
10 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
11 | |||
12 | AC_CACHE_CHECK([whether ungetc works on arbitrary bytes], | ||
13 | [gl_cv_func_ungetc_works], | ||
14 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
15 | #include <stdio.h> | ||
16 | ]], [[FILE *f; | ||
17 | if (!(f = fopen ("conftest.tmp", "w+"))) | ||
18 | return 1; | ||
19 | if (fputs ("abc", f) < 0) | ||
20 | { fclose (f); return 2; } | ||
21 | rewind (f); | ||
22 | if (fgetc (f) != 'a') | ||
23 | { fclose (f); return 3; } | ||
24 | if (fgetc (f) != 'b') | ||
25 | { fclose (f); return 4; } | ||
26 | if (ungetc ('d', f) != 'd') | ||
27 | { fclose (f); return 5; } | ||
28 | if (ftell (f) != 1) | ||
29 | { fclose (f); return 6; } | ||
30 | if (fgetc (f) != 'd') | ||
31 | { fclose (f); return 7; } | ||
32 | if (ftell (f) != 2) | ||
33 | { fclose (f); return 8; } | ||
34 | if (fseek (f, 0, SEEK_CUR) != 0) | ||
35 | { fclose (f); return 9; } | ||
36 | if (ftell (f) != 2) | ||
37 | { fclose (f); return 10; } | ||
38 | if (fgetc (f) != 'c') | ||
39 | { fclose (f); return 11; } | ||
40 | fclose (f); | ||
41 | remove ("conftest.tmp"); | ||
42 | ]])], | ||
43 | [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], | ||
44 | [case "$host_os" in | ||
45 | # Guess yes on glibc systems. | ||
46 | *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; | ||
47 | # Guess yes on musl systems. | ||
48 | *-musl*) gl_cv_func_ungetc_works="guessing yes" ;; | ||
49 | # Guess yes on bionic systems. | ||
50 | *-android*) gl_cv_func_ungetc_works="guessing yes" ;; | ||
51 | # Guess yes on native Windows. | ||
52 | mingw*) gl_cv_func_ungetc_works="guessing yes" ;; | ||
53 | # If we don't know, obey --enable-cross-guesses. | ||
54 | *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; | ||
55 | esac | ||
56 | ]) | ||
57 | ]) | ||
58 | gl_ftello_broken_after_ungetc=no | ||
59 | case "$gl_cv_func_ungetc_works" in | ||
60 | *yes) ;; | ||
61 | *) | ||
62 | dnl On macOS >= 10.15, where the above program fails with exit code 6, | ||
63 | dnl we fix it through an ftello override. | ||
64 | case "$host_os" in | ||
65 | darwin*) gl_ftello_broken_after_ungetc=yes ;; | ||
66 | *) | ||
67 | AC_DEFINE([FUNC_UNGETC_BROKEN], [1], | ||
68 | [Define to 1 if ungetc is broken when used on arbitrary bytes.]) | ||
69 | ;; | ||
70 | esac | ||
71 | ;; | ||
72 | esac | ||
73 | ]) | ||
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index 32dcfa5..f438402 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 | |||
@@ -1,15 +1,15 @@ | |||
1 | # unistd_h.m4 serial 66 | 1 | # unistd_h.m4 serial 90 |
2 | dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl Written by Simon Josefsson, Bruno Haible. | 7 | dnl Written by Simon Josefsson, Bruno Haible. |
8 | 8 | ||
9 | AC_DEFUN([gl_UNISTD_H], | 9 | AC_DEFUN_ONCE([gl_UNISTD_H], |
10 | [ | 10 | [ |
11 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | 11 | dnl Ensure to expand the default settings once only, before all statements |
12 | dnl once only, before all statements that occur in other macros. | 12 | dnl that occur in other macros. |
13 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | 13 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
14 | 14 | ||
15 | gl_CHECK_NEXT_HEADERS([unistd.h]) | 15 | gl_CHECK_NEXT_HEADERS([unistd.h]) |
@@ -37,150 +37,234 @@ AC_DEFUN([gl_UNISTD_H], | |||
37 | # include <fcntl.h> | 37 | # include <fcntl.h> |
38 | # include <stdio.h> | 38 | # include <stdio.h> |
39 | # include <stdlib.h> | 39 | # include <stdlib.h> |
40 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 40 | # if defined _WIN32 && ! defined __CYGWIN__ |
41 | # include <io.h> | 41 | # include <io.h> |
42 | # endif | 42 | # endif |
43 | #endif | 43 | #endif |
44 | ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat | 44 | ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess |
45 | fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups | 45 | execl execle execlp execv execve execvp execvpe |
46 | gethostname getlogin getlogin_r getpagesize | 46 | faccessat fchdir |
47 | fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize | ||
48 | getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass | ||
47 | getusershell setusershell endusershell | 49 | getusershell setusershell endusershell |
48 | group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite | 50 | group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite |
49 | readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r | 51 | readlink readlinkat rmdir sethostname sleep symlink symlinkat |
50 | unlink unlinkat usleep]) | 52 | truncate ttyname_r unlink unlinkat usleep]) |
53 | |||
54 | AC_REQUIRE([AC_C_RESTRICT]) | ||
55 | |||
56 | AC_CHECK_DECLS_ONCE([execvpe]) | ||
57 | if test $ac_cv_have_decl_execvpe = no; then | ||
58 | HAVE_DECL_EXECVPE=0 | ||
59 | fi | ||
51 | ]) | 60 | ]) |
52 | 61 | ||
62 | # gl_UNISTD_MODULE_INDICATOR([modulename]) | ||
63 | # sets the shell variable that indicates the presence of the given module | ||
64 | # to a C preprocessor expression that will evaluate to 1. | ||
65 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
53 | AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], | 66 | AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], |
54 | [ | 67 | [ |
55 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 68 | dnl Ensure to expand the default settings once only. |
56 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | 69 | gl_UNISTD_H_REQUIRE_DEFAULTS |
57 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 70 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
58 | dnl Define it also as a C macro, for the benefit of the unit tests. | 71 | dnl Define it also as a C macro, for the benefit of the unit tests. |
59 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 72 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
60 | ]) | 73 | ]) |
61 | 74 | ||
75 | # Initializes the default values for AC_SUBSTed shell variables. | ||
76 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
77 | # outside of macros or in macros that are not AC_REQUIREd. | ||
78 | AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS], | ||
79 | [ | ||
80 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [ | ||
81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS]) | ||
82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR]) | ||
83 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN]) | ||
84 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE]) | ||
85 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE]) | ||
86 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP]) | ||
87 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2]) | ||
88 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3]) | ||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON]) | ||
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS]) | ||
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL]) | ||
92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE]) | ||
93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP]) | ||
94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV]) | ||
95 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE]) | ||
96 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP]) | ||
97 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE]) | ||
98 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT]) | ||
99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR]) | ||
100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT]) | ||
101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC]) | ||
102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC]) | ||
103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE]) | ||
104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD]) | ||
105 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME]) | ||
106 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE]) | ||
107 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY]) | ||
108 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS]) | ||
109 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME]) | ||
110 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN]) | ||
111 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R]) | ||
112 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX]) | ||
113 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE]) | ||
114 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS]) | ||
115 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS_GNU]) | ||
116 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL]) | ||
117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER]) | ||
118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY]) | ||
119 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN]) | ||
120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK]) | ||
121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT]) | ||
122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK]) | ||
123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE]) | ||
124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2]) | ||
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD]) | ||
126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE]) | ||
127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ]) | ||
128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK]) | ||
129 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT]) | ||
130 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR]) | ||
131 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME]) | ||
132 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP]) | ||
133 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK]) | ||
134 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT]) | ||
135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE]) | ||
136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R]) | ||
137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT]) | ||
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING]) | ||
139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE]) | ||
140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK]) | ||
141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT]) | ||
142 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP]) | ||
143 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE]) | ||
144 | dnl Support Microsoft deprecated alias function names by default. | ||
145 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1]) | ||
146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1]) | ||
147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1]) | ||
148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1]) | ||
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1]) | ||
150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1]) | ||
151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1]) | ||
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1]) | ||
153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1]) | ||
154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1]) | ||
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1]) | ||
156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1]) | ||
157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1]) | ||
158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1]) | ||
159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1]) | ||
160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1]) | ||
161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1]) | ||
162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1]) | ||
163 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1]) | ||
164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1]) | ||
165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1]) | ||
166 | ]) | ||
167 | m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS]) | ||
168 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
169 | ]) | ||
170 | |||
62 | AC_DEFUN([gl_UNISTD_H_DEFAULTS], | 171 | AC_DEFUN([gl_UNISTD_H_DEFAULTS], |
63 | [ | 172 | [ |
64 | GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) | ||
65 | GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) | ||
66 | GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) | ||
67 | GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) | ||
68 | GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) | ||
69 | GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) | ||
70 | GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) | ||
71 | GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) | ||
72 | GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) | ||
73 | GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) | ||
74 | GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) | ||
75 | GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) | ||
76 | GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) | ||
77 | GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) | ||
78 | GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) | ||
79 | GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) | ||
80 | GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) | ||
81 | GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) | ||
82 | GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) | ||
83 | GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) | ||
84 | GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) | ||
85 | GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) | ||
86 | GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) | ||
87 | GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) | ||
88 | GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) | ||
89 | GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) | ||
90 | GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) | ||
91 | GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) | ||
92 | GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) | ||
93 | GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) | ||
94 | GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) | ||
95 | GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) | ||
96 | GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) | ||
97 | GNULIB_READ=0; AC_SUBST([GNULIB_READ]) | ||
98 | GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) | ||
99 | GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) | ||
100 | GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) | ||
101 | GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME]) | ||
102 | GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) | ||
103 | GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) | ||
104 | GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) | ||
105 | GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) | ||
106 | GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) | ||
107 | GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) | ||
108 | GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) | ||
109 | GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) | ||
110 | GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) | ||
111 | GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) | ||
112 | dnl Assume proper GNU behavior unless another module says otherwise. | 173 | dnl Assume proper GNU behavior unless another module says otherwise. |
113 | HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) | 174 | HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) |
114 | HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) | 175 | HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) |
115 | HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) | 176 | HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) |
116 | HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) | 177 | HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) |
117 | HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) | 178 | HAVE_EXECVPE=1; AC_SUBST([HAVE_EXECVPE]) |
118 | HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) | 179 | HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) |
119 | HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) | 180 | HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) |
120 | HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) | 181 | HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) |
121 | HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) | 182 | HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) |
122 | HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) | 183 | HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) |
123 | HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) | 184 | HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) |
124 | HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) | 185 | HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) |
125 | HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) | 186 | HAVE_GETENTROPY=1; AC_SUBST([HAVE_GETENTROPY]) |
126 | HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) | 187 | HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) |
127 | HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) | 188 | HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) |
128 | HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) | 189 | HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) |
129 | HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) | 190 | HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) |
130 | HAVE_LINK=1; AC_SUBST([HAVE_LINK]) | 191 | HAVE_GETPASS=1; AC_SUBST([HAVE_GETPASS]) |
131 | HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) | 192 | HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) |
132 | HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) | 193 | HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) |
133 | HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) | 194 | HAVE_LINK=1; AC_SUBST([HAVE_LINK]) |
134 | HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) | 195 | HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) |
135 | HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) | 196 | HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) |
136 | HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) | 197 | HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) |
137 | HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) | 198 | HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) |
138 | HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) | 199 | HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) |
139 | HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) | 200 | HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) |
140 | HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) | 201 | HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) |
141 | HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) | 202 | HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) |
142 | HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) | 203 | HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) |
143 | HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) | 204 | HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) |
144 | HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) | 205 | HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) |
145 | HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) | 206 | HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) |
146 | HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) | 207 | HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) |
147 | HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) | 208 | HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) |
148 | HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) | 209 | HAVE_DECL_EXECVPE=1; AC_SUBST([HAVE_DECL_EXECVPE]) |
149 | HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) | 210 | HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) |
150 | HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) | 211 | HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) |
151 | HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) | 212 | HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) |
152 | HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) | 213 | HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) |
153 | HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) | 214 | HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) |
154 | HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) | 215 | HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) |
155 | REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) | 216 | HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) |
156 | REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) | 217 | HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) |
157 | REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) | 218 | HAVE_DECL_TRUNCATE=1; AC_SUBST([HAVE_DECL_TRUNCATE]) |
158 | REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) | 219 | HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) |
159 | REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) | 220 | HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) |
160 | REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) | 221 | HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) |
161 | REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) | 222 | REPLACE_ACCESS=0; AC_SUBST([REPLACE_ACCESS]) |
162 | REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) | 223 | REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) |
163 | REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) | 224 | REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) |
164 | REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) | 225 | REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE]) |
165 | REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) | 226 | REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) |
166 | REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) | 227 | REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) |
167 | REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) | 228 | REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) |
168 | REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) | 229 | REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) |
169 | REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) | 230 | REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) |
170 | REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) | 231 | REPLACE_EXECV=0; AC_SUBST([REPLACE_EXECV]) |
171 | REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) | 232 | REPLACE_EXECVE=0; AC_SUBST([REPLACE_EXECVE]) |
172 | REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) | 233 | REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) |
173 | REPLACE_READ=0; AC_SUBST([REPLACE_READ]) | 234 | REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) |
174 | REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) | 235 | REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) |
175 | REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) | 236 | REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) |
176 | REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) | 237 | REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) |
177 | REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) | 238 | REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) |
178 | REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) | 239 | REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) |
179 | REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) | 240 | REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) |
180 | REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) | 241 | REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) |
181 | REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) | 242 | REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) |
182 | REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) | 243 | REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) |
183 | UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) | 244 | REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) |
245 | REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) | ||
246 | REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) | ||
247 | REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) | ||
248 | REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) | ||
249 | REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) | ||
250 | REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) | ||
251 | REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) | ||
252 | REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) | ||
253 | REPLACE_READ=0; AC_SUBST([REPLACE_READ]) | ||
254 | REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) | ||
255 | REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) | ||
256 | REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) | ||
257 | REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) | ||
258 | REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) | ||
259 | REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) | ||
260 | REPLACE_TRUNCATE=0; AC_SUBST([REPLACE_TRUNCATE]) | ||
261 | REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) | ||
262 | REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) | ||
263 | REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) | ||
264 | REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) | ||
265 | REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) | ||
266 | UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H]) | ||
267 | UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) | ||
184 | UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; | 268 | UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; |
185 | AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) | 269 | AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) |
186 | ]) | 270 | ]) |
diff --git a/gl/m4/unlocked-io.m4 b/gl/m4/unlocked-io.m4 new file mode 100644 index 0000000..407c0ba --- /dev/null +++ b/gl/m4/unlocked-io.m4 | |||
@@ -0,0 +1,36 @@ | |||
1 | # unlocked-io.m4 serial 16 | ||
2 | |||
3 | # Copyright (C) 1998-2006, 2009-2023 Free Software Foundation, Inc. | ||
4 | # | ||
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 | dnl From Jim Meyering. | ||
10 | dnl | ||
11 | dnl See if the glibc *_unlocked I/O macros or functions are available. | ||
12 | dnl Use only those *_unlocked macros or functions that are declared | ||
13 | dnl (because some of them were declared in Solaris 2.5.1 but were removed | ||
14 | dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run | ||
15 | dnl on Solaris 2.6). | ||
16 | |||
17 | AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], | ||
18 | [ | ||
19 | dnl Persuade glibc and Solaris <stdio.h> to declare | ||
20 | dnl fgets_unlocked(), fputs_unlocked() etc. | ||
21 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
22 | |||
23 | AC_CHECK_DECLS_ONCE([clearerr_unlocked]) | ||
24 | AC_CHECK_DECLS_ONCE([feof_unlocked]) | ||
25 | AC_CHECK_DECLS_ONCE([ferror_unlocked]) | ||
26 | AC_CHECK_DECLS_ONCE([fflush_unlocked]) | ||
27 | AC_CHECK_DECLS_ONCE([fgets_unlocked]) | ||
28 | AC_CHECK_DECLS_ONCE([fputc_unlocked]) | ||
29 | AC_CHECK_DECLS_ONCE([fputs_unlocked]) | ||
30 | AC_CHECK_DECLS_ONCE([fread_unlocked]) | ||
31 | AC_CHECK_DECLS_ONCE([fwrite_unlocked]) | ||
32 | AC_CHECK_DECLS_ONCE([getc_unlocked]) | ||
33 | AC_CHECK_DECLS_ONCE([getchar_unlocked]) | ||
34 | AC_CHECK_DECLS_ONCE([putc_unlocked]) | ||
35 | AC_CHECK_DECLS_ONCE([putchar_unlocked]) | ||
36 | ]) | ||
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4 new file mode 100644 index 0000000..fd6230c --- /dev/null +++ b/gl/m4/vararrays.m4 | |||
@@ -0,0 +1,72 @@ | |||
1 | # Check for variable-length arrays. | ||
2 | |||
3 | # serial 6 | ||
4 | |||
5 | # From Paul Eggert | ||
6 | |||
7 | # Copyright (C) 2001, 2009-2023 Free Software Foundation, Inc. | ||
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 | m4_version_prereq([2.70], [], [ | ||
13 | |||
14 | # AC_C_VARARRAYS | ||
15 | # -------------- | ||
16 | # Check whether the C compiler supports variable-length arrays. | ||
17 | AC_DEFUN([AC_C_VARARRAYS], | ||
18 | [ | ||
19 | AC_CACHE_CHECK([for variable-length arrays], | ||
20 | ac_cv_c_vararrays, | ||
21 | [AC_EGREP_CPP([defined], | ||
22 | [#ifdef __STDC_NO_VLA__ | ||
23 | defined | ||
24 | #endif | ||
25 | ], | ||
26 | [ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'], | ||
27 | [AC_COMPILE_IFELSE( | ||
28 | [AC_LANG_PROGRAM( | ||
29 | [[/* Test for VLA support. This test is partly inspired | ||
30 | from examples in the C standard. Use at least two VLA | ||
31 | functions to detect the GCC 3.4.3 bug described in: | ||
32 | https://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00014.html | ||
33 | */ | ||
34 | #ifdef __STDC_NO_VLA__ | ||
35 | syntax error; | ||
36 | #else | ||
37 | extern int n; | ||
38 | int B[100]; | ||
39 | int fvla (int m, int C[m][m]); | ||
40 | |||
41 | int | ||
42 | simple (int count, int all[static count]) | ||
43 | { | ||
44 | return all[count - 1]; | ||
45 | } | ||
46 | |||
47 | int | ||
48 | fvla (int m, int C[m][m]) | ||
49 | { | ||
50 | typedef int VLA[m][m]; | ||
51 | VLA x; | ||
52 | int D[m]; | ||
53 | static int (*q)[m] = &B; | ||
54 | int (*s)[n] = q; | ||
55 | return C && &x[0][0] == &D[0] && &D[0] == s[0]; | ||
56 | } | ||
57 | #endif | ||
58 | ]])], | ||
59 | [ac_cv_c_vararrays=yes], | ||
60 | [ac_cv_c_vararrays=no])])]) | ||
61 | if test "$ac_cv_c_vararrays" = yes; then | ||
62 | dnl This is for compatibility with Autoconf 2.61-2.69. | ||
63 | AC_DEFINE([HAVE_C_VARARRAYS], 1, | ||
64 | [Define to 1 if C supports variable-length arrays.]) | ||
65 | elif test "$ac_cv_c_vararrays" = no; then | ||
66 | AC_DEFINE([__STDC_NO_VLA__], 1, | ||
67 | [Define to 1 if C does not support variable-length arrays, and | ||
68 | if the compiler does not already define this.]) | ||
69 | fi | ||
70 | ]) | ||
71 | |||
72 | ]) | ||
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index d730e43..6361c84 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # vasnprintf.m4 serial 36 | 1 | # vasnprintf.m4 serial 38 |
2 | dnl Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -32,7 +32,6 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], | |||
32 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. | 32 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. |
33 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | 33 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], |
34 | [ | 34 | [ |
35 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | ||
36 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | 35 | AC_REQUIRE([gt_TYPE_WCHAR_T]) |
37 | AC_REQUIRE([gt_TYPE_WINT_T]) | 36 | AC_REQUIRE([gt_TYPE_WINT_T]) |
38 | ]) | 37 | ]) |
@@ -41,7 +40,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | |||
41 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | 40 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], |
42 | [ | 41 | [ |
43 | AC_REQUIRE([gl_FEATURES_H]) | 42 | AC_REQUIRE([gl_FEATURES_H]) |
44 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | ||
45 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | 43 | AC_REQUIRE([gt_TYPE_WCHAR_T]) |
46 | AC_REQUIRE([gt_TYPE_WINT_T]) | 44 | AC_REQUIRE([gt_TYPE_WINT_T]) |
47 | AC_REQUIRE([AC_TYPE_SIZE_T]) | 45 | AC_REQUIRE([AC_TYPE_SIZE_T]) |
@@ -56,7 +54,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | |||
56 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | 54 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], |
57 | [ | 55 | [ |
58 | AC_REQUIRE([AC_FUNC_ALLOCA]) | 56 | AC_REQUIRE([AC_FUNC_ALLOCA]) |
59 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | ||
60 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | 57 | AC_REQUIRE([gt_TYPE_WCHAR_T]) |
61 | AC_REQUIRE([gt_TYPE_WINT_T]) | 58 | AC_REQUIRE([gt_TYPE_WINT_T]) |
62 | AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) | 59 | AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) |
@@ -77,6 +74,16 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | |||
77 | if the buffer had been large enough.]) | 74 | if the buffer had been large enough.]) |
78 | ;; | 75 | ;; |
79 | esac | 76 | esac |
77 | dnl Additionally, the use of %n can be eliminated by assuming that snprintf | ||
78 | dnl always produces NUL-terminated strings (no truncation). | ||
79 | AC_REQUIRE([gl_SNPRINTF_TRUNCATION_C99]) | ||
80 | case "$gl_cv_func_snprintf_truncation_c99" in | ||
81 | *yes) | ||
82 | AC_DEFINE([HAVE_SNPRINTF_TRUNCATION_C99], [1], | ||
83 | [Define if the string produced by the snprintf function is always NUL | ||
84 | terminated.]) | ||
85 | ;; | ||
86 | esac | ||
80 | ]) | 87 | ]) |
81 | 88 | ||
82 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' | 89 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' |
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index c214ff1..6e6156a 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # vasprintf.m4 serial 6 | 1 | # vasprintf.m4 serial 6 |
2 | dnl Copyright (C) 2002-2003, 2006-2007, 2009-2013 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2003, 2006-2007, 2009-2023 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl 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, |
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4 index 6cbd7e5..f0468e8 100644 --- a/gl/m4/visibility.m4 +++ b/gl/m4/visibility.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # visibility.m4 serial 5 (gettext-0.18.2) | 1 | # visibility.m4 serial 8 |
2 | dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -29,42 +29,47 @@ AC_DEFUN([gl_VISIBILITY], | |||
29 | dnl First, check whether -Werror can be added to the command line, or | 29 | dnl First, check whether -Werror can be added to the command line, or |
30 | dnl whether it leads to an error because of some other option that the | 30 | dnl whether it leads to an error because of some other option that the |
31 | dnl user has put into $CC $CFLAGS $CPPFLAGS. | 31 | dnl user has put into $CC $CFLAGS $CPPFLAGS. |
32 | AC_MSG_CHECKING([whether the -Werror option is usable]) | 32 | AC_CACHE_CHECK([whether the -Werror option is usable], |
33 | AC_CACHE_VAL([gl_cv_cc_vis_werror], [ | 33 | [gl_cv_cc_vis_werror], |
34 | gl_save_CFLAGS="$CFLAGS" | 34 | [gl_save_CFLAGS="$CFLAGS" |
35 | CFLAGS="$CFLAGS -Werror" | 35 | CFLAGS="$CFLAGS -Werror" |
36 | AC_COMPILE_IFELSE( | 36 | AC_COMPILE_IFELSE( |
37 | [AC_LANG_PROGRAM([[]], [[]])], | 37 | [AC_LANG_PROGRAM([[]], [[]])], |
38 | [gl_cv_cc_vis_werror=yes], | 38 | [gl_cv_cc_vis_werror=yes], |
39 | [gl_cv_cc_vis_werror=no]) | 39 | [gl_cv_cc_vis_werror=no]) |
40 | CFLAGS="$gl_save_CFLAGS"]) | 40 | CFLAGS="$gl_save_CFLAGS" |
41 | AC_MSG_RESULT([$gl_cv_cc_vis_werror]) | 41 | ]) |
42 | dnl Now check whether visibility declarations are supported. | 42 | dnl Now check whether visibility declarations are supported. |
43 | AC_MSG_CHECKING([for simple visibility declarations]) | 43 | AC_CACHE_CHECK([for simple visibility declarations], |
44 | AC_CACHE_VAL([gl_cv_cc_visibility], [ | 44 | [gl_cv_cc_visibility], |
45 | gl_save_CFLAGS="$CFLAGS" | 45 | [gl_save_CFLAGS="$CFLAGS" |
46 | CFLAGS="$CFLAGS -fvisibility=hidden" | 46 | CFLAGS="$CFLAGS -fvisibility=hidden" |
47 | dnl We use the option -Werror and a function dummyfunc, because on some | 47 | 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 | 48 | dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning |
49 | dnl "visibility attribute not supported in this configuration; ignored" | 49 | dnl "visibility attribute not supported in this configuration; ignored" |
50 | dnl at the first function definition in every compilation unit, and we | 50 | dnl at the first function definition in every compilation unit, and we |
51 | dnl don't want to use the option in this case. | 51 | dnl don't want to use the option in this case. |
52 | if test $gl_cv_cc_vis_werror = yes; then | 52 | if test $gl_cv_cc_vis_werror = yes; then |
53 | CFLAGS="$CFLAGS -Werror" | 53 | CFLAGS="$CFLAGS -Werror" |
54 | fi | 54 | fi |
55 | AC_COMPILE_IFELSE( | 55 | AC_COMPILE_IFELSE( |
56 | [AC_LANG_PROGRAM( | 56 | [AC_LANG_PROGRAM( |
57 | [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; | 57 | [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; |
58 | extern __attribute__((__visibility__("default"))) int exportedvar; | 58 | extern __attribute__((__visibility__("default"))) int exportedvar; |
59 | extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); | 59 | extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); |
60 | extern __attribute__((__visibility__("default"))) int exportedfunc (void); | 60 | extern __attribute__((__visibility__("default"))) int exportedfunc (void); |
61 | void dummyfunc (void) {} | 61 | void dummyfunc (void); |
62 | ]], | 62 | int hiddenvar; |
63 | [[]])], | 63 | int exportedvar; |
64 | [gl_cv_cc_visibility=yes], | 64 | int hiddenfunc (void) { return 51; } |
65 | [gl_cv_cc_visibility=no]) | 65 | int exportedfunc (void) { return 1225736919; } |
66 | CFLAGS="$gl_save_CFLAGS"]) | 66 | void dummyfunc (void) {} |
67 | AC_MSG_RESULT([$gl_cv_cc_visibility]) | 67 | ]], |
68 | [[]])], | ||
69 | [gl_cv_cc_visibility=yes], | ||
70 | [gl_cv_cc_visibility=no]) | ||
71 | CFLAGS="$gl_save_CFLAGS" | ||
72 | ]) | ||
68 | if test $gl_cv_cc_visibility = yes; then | 73 | if test $gl_cv_cc_visibility = yes; then |
69 | CFLAG_VISIBILITY="-fvisibility=hidden" | 74 | CFLAG_VISIBILITY="-fvisibility=hidden" |
70 | HAVE_VISIBILITY=1 | 75 | HAVE_VISIBILITY=1 |
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index 4900764..7fbb11c 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # vsnprintf.m4 serial 6 | 1 | # vsnprintf.m4 serial 7 |
2 | dnl Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -46,6 +46,14 @@ AC_DEFUN([gl_REPLACE_VSNPRINTF], | |||
46 | AC_LIBOBJ([vsnprintf]) | 46 | AC_LIBOBJ([vsnprintf]) |
47 | if test $ac_cv_func_vsnprintf = yes; then | 47 | if test $ac_cv_func_vsnprintf = yes; then |
48 | REPLACE_VSNPRINTF=1 | 48 | REPLACE_VSNPRINTF=1 |
49 | else | ||
50 | AC_CHECK_DECLS_ONCE([vsnprintf]) | ||
51 | if test $ac_cv_have_decl_vsnprintf = yes; then | ||
52 | dnl If the function is declared but does not appear to exist, it may be | ||
53 | dnl defined as an inline function. In order to avoid a conflict, we have | ||
54 | dnl to define rpl_vsnprintf, not vsnprintf. | ||
55 | REPLACE_VSNPRINTF=1 | ||
56 | fi | ||
49 | fi | 57 | fi |
50 | gl_PREREQ_VSNPRINTF | 58 | gl_PREREQ_VSNPRINTF |
51 | ]) | 59 | ]) |
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 index e43beeb..10649c5 100644 --- a/gl/m4/warn-on-use.m4 +++ b/gl/m4/warn-on-use.m4 | |||
@@ -1,11 +1,13 @@ | |||
1 | # warn-on-use.m4 serial 5 | 1 | # warn-on-use.m4 serial 10 |
2 | dnl Copyright (C) 2010-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) | 7 | # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) |
8 | # --------------------------------------- | 8 | # --------------------------------------- |
9 | # If the module 'posixcheck' is in use: | ||
10 | # | ||
9 | # For each whitespace-separated element in the list of NAMES, define | 11 | # For each whitespace-separated element in the list of NAMES, define |
10 | # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES | 12 | # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES |
11 | # even after being undefined as a macro. | 13 | # even after being undefined as a macro. |
@@ -23,25 +25,38 @@ dnl with or without modifications, as long as this notice is preserved. | |||
23 | # needing gl_WARN_ON_USE_PREPARE. | 25 | # needing gl_WARN_ON_USE_PREPARE. |
24 | AC_DEFUN([gl_WARN_ON_USE_PREPARE], | 26 | AC_DEFUN([gl_WARN_ON_USE_PREPARE], |
25 | [ | 27 | [ |
26 | m4_foreach_w([gl_decl], [$2], | 28 | m4_ifdef([gl_POSIXCHECK], |
27 | [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), | 29 | [m4_foreach_w([gl_decl], [$2], |
28 | [Define to 1 if ]m4_defn([gl_decl])[ is declared even after | 30 | [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), |
29 | undefining macros.])])dnl | 31 | [Define to 1 if ]m4_defn([gl_decl])[ is declared even after |
30 | dnl FIXME: gl_Symbol must be used unquoted until we can assume | 32 | undefining macros.])])dnl |
31 | dnl autoconf 2.64 or newer. | 33 | for gl_func in m4_flatten([$2]); do |
32 | for gl_func in m4_flatten([$2]); do | 34 | AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl |
33 | AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl | 35 | dnl As a workaround to implicit built-in function declarations in |
34 | AC_CACHE_CHECK([whether $gl_func is declared without a macro], | 36 | dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead |
35 | gl_Symbol, | 37 | dnl of ac_compile. If, for whatever reason, the override of AC_PROG_CC |
36 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], | 38 | dnl in zzgnulib.m4 is inactive, use the original ac_compile. |
37 | [@%:@undef $gl_func | 39 | ac_save_ac_compile="$ac_compile" |
38 | (void) $gl_func;])], | 40 | if test -n "$ac_compile_for_check_decl"; then |
39 | [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) | 41 | ac_compile="$ac_compile_for_check_decl" |
40 | AS_VAR_IF(gl_Symbol, [yes], | 42 | fi |
41 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) | 43 | AC_CACHE_CHECK([whether $gl_func is declared without a macro], |
42 | dnl shortcut - if the raw declaration exists, then set a cache | 44 | [gl_Symbol], |
43 | dnl variable to allow skipping any later AC_CHECK_DECL efforts | 45 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], |
44 | eval ac_cv_have_decl_$gl_func=yes]) | 46 | [[#undef $gl_func |
45 | AS_VAR_POPDEF([gl_Symbol])dnl | 47 | (void) $gl_func;]])], |
46 | done | 48 | [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) |
49 | ac_compile="$ac_save_ac_compile" | ||
50 | AS_VAR_IF([gl_Symbol], [yes], | ||
51 | [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: | ||
53 | dnl If the raw declaration exists with the given includes, then | ||
54 | dnl AC_CHECK_DECL with its many includes would see it as well. | ||
55 | dnl So, set a cache variable to allow skipping any later | ||
56 | dnl AC_CHECK_DECL invocation for $gl_func. | ||
57 | eval "ac_cv_have_decl_$gl_func=yes" | ||
58 | ]) | ||
59 | AS_VAR_POPDEF([gl_Symbol])dnl | ||
60 | done | ||
61 | ]) | ||
47 | ]) | 62 | ]) |
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4 index bedb15a..8ec6619 100644 --- a/gl/m4/wchar_h.m4 +++ b/gl/m4/wchar_h.m4 | |||
@@ -1,15 +1,15 @@ | |||
1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. | 1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. |
2 | 2 | ||
3 | dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-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 | 7 | ||
8 | dnl Written by Eric Blake. | 8 | dnl Written by Eric Blake. |
9 | 9 | ||
10 | # wchar_h.m4 serial 39 | 10 | # wchar_h.m4 serial 55 |
11 | 11 | ||
12 | AC_DEFUN([gl_WCHAR_H], | 12 | AC_DEFUN_ONCE([gl_WCHAR_H], |
13 | [ | 13 | [ |
14 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 14 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
15 | AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) | 15 | AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) |
@@ -35,76 +35,82 @@ AC_DEFUN([gl_WCHAR_H], | |||
35 | fi | 35 | fi |
36 | AC_SUBST([HAVE_WINT_T]) | 36 | AC_SUBST([HAVE_WINT_T]) |
37 | 37 | ||
38 | AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) | ||
39 | |||
38 | dnl Check for declarations of anything we want to poison if the | 40 | dnl Check for declarations of anything we want to poison if the |
39 | dnl corresponding gnulib module is not in use. | 41 | dnl corresponding gnulib module is not in use. |
40 | gl_WARN_ON_USE_PREPARE([[ | 42 | gl_WARN_ON_USE_PREPARE([[ |
41 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 43 | #include <wchar.h> |
42 | <wchar.h>. | ||
43 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
44 | included before <wchar.h>. */ | ||
45 | #if !(defined __GLIBC__ && !defined __UCLIBC__) | ||
46 | # include <stddef.h> | ||
47 | # include <stdio.h> | ||
48 | # include <time.h> | ||
49 | #endif | ||
50 | #include <wchar.h> | ||
51 | ]], | 44 | ]], |
52 | [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb | 45 | [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb |
53 | wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset | 46 | wcsrtombs wcsnrtombs wcwidth |
47 | wmemchr wmemcmp wmemcpy wmemmove wmempcpy wmemset | ||
54 | wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp | 48 | wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp |
55 | wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr | 49 | wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr |
56 | wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth | 50 | wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime |
57 | ]) | 51 | ]) |
52 | |||
53 | AC_REQUIRE([AC_C_RESTRICT]) | ||
54 | |||
55 | AC_CHECK_DECLS([wcsdup], [], [], [[ | ||
56 | #include <wchar.h> | ||
57 | ]]) | ||
58 | if test $ac_cv_have_decl_wcsdup = no; then | ||
59 | HAVE_DECL_WCSDUP=0 | ||
60 | fi | ||
58 | ]) | 61 | ]) |
59 | 62 | ||
60 | dnl Check whether <wchar.h> is usable at all. | 63 | dnl Check whether <wchar.h> is usable at all. |
61 | AC_DEFUN([gl_WCHAR_H_INLINE_OK], | 64 | AC_DEFUN([gl_WCHAR_H_INLINE_OK], |
62 | [ | 65 | [ |
63 | dnl Test whether <wchar.h> suffers due to the transition from '__inline' to | 66 | dnl Test whether <wchar.h> suffers due to the transition from '__inline' to |
64 | dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022> | 67 | dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022> |
65 | dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, | 68 | dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, |
66 | dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and | 69 | dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and |
67 | dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. | 70 | dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. |
71 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
68 | AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], | 72 | AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], |
69 | [gl_cv_header_wchar_h_correct_inline], | 73 | [gl_cv_header_wchar_h_correct_inline], |
70 | [gl_cv_header_wchar_h_correct_inline=yes | 74 | [gl_cv_header_wchar_h_correct_inline=yes |
71 | AC_LANG_CONFTEST([ | 75 | case "$host_os" in |
72 | AC_LANG_SOURCE([[#define wcstod renamed_wcstod | 76 | *-gnu* | gnu*) |
73 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 77 | AC_LANG_CONFTEST([ |
74 | <wchar.h>. | 78 | AC_LANG_SOURCE([[ |
75 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | 79 | #define wcstod renamed_wcstod |
76 | included before <wchar.h>. */ | 80 | #include <wchar.h> |
77 | #include <stddef.h> | 81 | extern int zero (void); |
78 | #include <stdio.h> | 82 | int main () { return zero(); } |
79 | #include <time.h> | 83 | ]])]) |
80 | #include <wchar.h> | 84 | dnl Do not rename the object file from conftest.$ac_objext to |
81 | extern int zero (void); | 85 | dnl conftest1.$ac_objext, as this will cause the link to fail on |
82 | int main () { return zero(); } | 86 | dnl z/OS when using the XPLINK object format (due to duplicate |
83 | ]])]) | 87 | dnl CSECT names). Instead, temporarily redefine $ac_compile so |
84 | if AC_TRY_EVAL([ac_compile]); then | 88 | dnl that the object file has the latter name from the start. |
85 | mv conftest.$ac_objext conftest1.$ac_objext | 89 | save_ac_compile="$ac_compile" |
86 | AC_LANG_CONFTEST([ | 90 | ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` |
87 | AC_LANG_SOURCE([[#define wcstod renamed_wcstod | 91 | if echo '#include "conftest.c"' >conftest1.c \ |
88 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 92 | && AC_TRY_EVAL([ac_compile]); then |
89 | <wchar.h>. | 93 | AC_LANG_CONFTEST([ |
90 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | 94 | AC_LANG_SOURCE([[ |
91 | included before <wchar.h>. */ | 95 | #define wcstod renamed_wcstod |
92 | #include <stddef.h> | 96 | #include <wchar.h> |
93 | #include <stdio.h> | 97 | int zero (void) { return 0; } |
94 | #include <time.h> | 98 | ]])]) |
95 | #include <wchar.h> | 99 | dnl See note above about renaming object files. |
96 | int zero (void) { return 0; } | 100 | ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` |
97 | ]])]) | 101 | if echo '#include "conftest.c"' >conftest2.c \ |
98 | if AC_TRY_EVAL([ac_compile]); then | 102 | && AC_TRY_EVAL([ac_compile]); then |
99 | mv conftest.$ac_objext conftest2.$ac_objext | 103 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then |
100 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then | 104 | : |
101 | : | 105 | else |
102 | else | 106 | gl_cv_header_wchar_h_correct_inline=no |
103 | gl_cv_header_wchar_h_correct_inline=no | 107 | fi |
108 | fi | ||
104 | fi | 109 | fi |
105 | fi | 110 | ac_compile="$save_ac_compile" |
106 | fi | 111 | rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext |
107 | rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext | 112 | ;; |
113 | esac | ||
108 | ]) | 114 | ]) |
109 | if test $gl_cv_header_wchar_h_correct_inline = no; then | 115 | if test $gl_cv_header_wchar_h_correct_inline = no; then |
110 | AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). | 116 | AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). |
@@ -112,63 +118,84 @@ This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in | |||
112 | C99 mode. You have four options: | 118 | C99 mode. You have four options: |
113 | - Add the flag -fgnu89-inline to CC and reconfigure, or | 119 | - Add the flag -fgnu89-inline to CC and reconfigure, or |
114 | - Fix your include files, using parts of | 120 | - Fix your include files, using parts of |
115 | <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or | 121 | <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or |
116 | - Use a gcc version older than 4.3, or | 122 | - Use a gcc version older than 4.3, or |
117 | - Don't use the flags -std=c99 or -std=gnu99. | 123 | - Don't use the flags -std=c99 or -std=gnu99. |
118 | Configuration aborted.]) | 124 | Configuration aborted.]) |
119 | fi | 125 | fi |
120 | ]) | 126 | ]) |
121 | 127 | ||
128 | # gl_WCHAR_MODULE_INDICATOR([modulename]) | ||
129 | # sets the shell variable that indicates the presence of the given module | ||
130 | # to a C preprocessor expression that will evaluate to 1. | ||
131 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
122 | AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], | 132 | AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], |
123 | [ | 133 | [ |
124 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 134 | dnl Ensure to expand the default settings once only. |
125 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 135 | gl_WCHAR_H_REQUIRE_DEFAULTS |
126 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 136 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
127 | dnl Define it also as a C macro, for the benefit of the unit tests. | 137 | dnl Define it also as a C macro, for the benefit of the unit tests. |
128 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 138 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
129 | ]) | 139 | ]) |
130 | 140 | ||
141 | # Initializes the default values for AC_SUBSTed shell variables. | ||
142 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
143 | # outside of macros or in macros that are not AC_REQUIREd. | ||
144 | AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], | ||
145 | [ | ||
146 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS], [ | ||
147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) | ||
148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) | ||
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) | ||
150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) | ||
151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) | ||
152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) | ||
153 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOWCS]) | ||
154 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCRTOMB]) | ||
155 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRTOMBS]) | ||
156 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNRTOMBS]) | ||
157 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCWIDTH]) | ||
158 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCHR]) | ||
159 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCMP]) | ||
160 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCPY]) | ||
161 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMMOVE]) | ||
162 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMPCPY]) | ||
163 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMSET]) | ||
164 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSLEN]) | ||
165 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNLEN]) | ||
166 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCPY]) | ||
167 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPCPY]) | ||
168 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCPY]) | ||
169 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPNCPY]) | ||
170 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCAT]) | ||
171 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCAT]) | ||
172 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCMP]) | ||
173 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCMP]) | ||
174 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCASECMP]) | ||
175 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCASECMP]) | ||
176 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCOLL]) | ||
177 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSXFRM]) | ||
178 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSDUP]) | ||
179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCHR]) | ||
180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRCHR]) | ||
181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCSPN]) | ||
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSPN]) | ||
183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSPBRK]) | ||
184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSTR]) | ||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) | ||
186 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) | ||
187 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) | ||
188 | dnl Support Microsoft deprecated alias function names by default. | ||
189 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) | ||
190 | ]) | ||
191 | m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS]) | ||
192 | dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized. | ||
193 | gl_STDLIB_H_REQUIRE_DEFAULTS | ||
194 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | ||
195 | ]) | ||
196 | |||
131 | AC_DEFUN([gl_WCHAR_H_DEFAULTS], | 197 | AC_DEFUN([gl_WCHAR_H_DEFAULTS], |
132 | [ | 198 | [ |
133 | GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) | ||
134 | GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) | ||
135 | GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) | ||
136 | GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) | ||
137 | GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) | ||
138 | GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) | ||
139 | GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) | ||
140 | GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) | ||
141 | GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) | ||
142 | GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) | ||
143 | GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) | ||
144 | GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) | ||
145 | GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) | ||
146 | GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) | ||
147 | GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) | ||
148 | GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) | ||
149 | GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) | ||
150 | GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) | ||
151 | GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) | ||
152 | GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) | ||
153 | GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) | ||
154 | GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) | ||
155 | GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) | ||
156 | GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) | ||
157 | GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) | ||
158 | GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) | ||
159 | GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) | ||
160 | GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) | ||
161 | GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) | ||
162 | GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) | ||
163 | GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) | ||
164 | GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) | ||
165 | GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) | ||
166 | GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) | ||
167 | GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) | ||
168 | GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) | ||
169 | GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) | ||
170 | GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) | ||
171 | GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) | ||
172 | dnl Assume proper GNU behavior unless another module says otherwise. | 199 | dnl Assume proper GNU behavior unless another module says otherwise. |
173 | HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) | 200 | HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) |
174 | HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) | 201 | HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) |
@@ -183,6 +210,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], | |||
183 | HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) | 210 | HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) |
184 | HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) | 211 | HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) |
185 | HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) | 212 | HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) |
213 | HAVE_WMEMPCPY=1; AC_SUBST([HAVE_WMEMPCPY]) | ||
186 | HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) | 214 | HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) |
187 | HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) | 215 | HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) |
188 | HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) | 216 | HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) |
@@ -207,7 +235,9 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], | |||
207 | HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) | 235 | HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) |
208 | HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) | 236 | HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) |
209 | HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) | 237 | HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) |
238 | HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) | ||
210 | HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) | 239 | HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) |
240 | HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP]) | ||
211 | HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) | 241 | HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) |
212 | REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) | 242 | REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) |
213 | REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) | 243 | REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) |
@@ -222,4 +252,6 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], | |||
222 | REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) | 252 | REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) |
223 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) | 253 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) |
224 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) | 254 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) |
255 | REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) | ||
256 | REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) | ||
225 | ]) | 257 | ]) |
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 index e1e1e69..50bde08 100644 --- a/gl/m4/wchar_t.m4 +++ b/gl/m4/wchar_t.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # wchar_t.m4 serial 4 (gettext-0.18.2) | 1 | # wchar_t.m4 serial 4 (gettext-0.18.2) |
2 | dnl Copyright (C) 2002-2003, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index f56b5ba..d51b36e 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # wcrtomb.m4 serial 11 | 1 | # wcrtomb.m4 serial 17 |
2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -15,15 +15,8 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
15 | if test $ac_cv_func_wcrtomb = no; then | 15 | if test $ac_cv_func_wcrtomb = no; then |
16 | HAVE_WCRTOMB=0 | 16 | HAVE_WCRTOMB=0 |
17 | AC_CHECK_DECLS([wcrtomb],,, [[ | 17 | AC_CHECK_DECLS([wcrtomb],,, [[ |
18 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 18 | #include <wchar.h> |
19 | <wchar.h>. | 19 | ]]) |
20 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
21 | included before <wchar.h>. */ | ||
22 | #include <stddef.h> | ||
23 | #include <stdio.h> | ||
24 | #include <time.h> | ||
25 | #include <wchar.h> | ||
26 | ]]) | ||
27 | if test $ac_cv_have_decl_wcrtomb = yes; then | 20 | if test $ac_cv_have_decl_wcrtomb = yes; then |
28 | dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although | 21 | dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although |
29 | dnl it does not have the function. Avoid a collision with gnulib's | 22 | dnl it does not have the function. Avoid a collision with gnulib's |
@@ -31,17 +24,56 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
31 | REPLACE_WCRTOMB=1 | 24 | REPLACE_WCRTOMB=1 |
32 | fi | 25 | fi |
33 | else | 26 | else |
34 | if test $REPLACE_MBSTATE_T = 1; then | 27 | dnl We don't actually need to override wcrtomb when redefining the semantics |
35 | REPLACE_WCRTOMB=1 | 28 | dnl of the mbstate_t type. Tested on 32-bit AIX. |
36 | else | 29 | dnl if test $REPLACE_MBSTATE_T = 1; then |
37 | dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes | 30 | dnl REPLACE_WCRTOMB=1 |
38 | dnl returns 0 instead of 1. | 31 | dnl fi |
32 | if test $REPLACE_WCRTOMB = 0; then | ||
33 | dnl On Android 4.3, wcrtomb produces wrong characters in the C locale. | ||
34 | dnl On AIX 4.3, OSF/1 5.1 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL) | ||
35 | dnl sometimes returns 0 instead of 1. | ||
39 | AC_REQUIRE([AC_PROG_CC]) | 36 | AC_REQUIRE([AC_PROG_CC]) |
40 | AC_REQUIRE([gt_LOCALE_FR]) | 37 | AC_REQUIRE([gt_LOCALE_FR]) |
41 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 38 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) |
42 | AC_REQUIRE([gt_LOCALE_JA]) | 39 | AC_REQUIRE([gt_LOCALE_JA]) |
43 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | 40 | AC_REQUIRE([gt_LOCALE_ZH_CN]) |
44 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 41 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
42 | AC_CACHE_CHECK([whether wcrtomb works in the C locale], | ||
43 | [gl_cv_func_wcrtomb_works], | ||
44 | [AC_RUN_IFELSE( | ||
45 | [AC_LANG_SOURCE([[ | ||
46 | #include <string.h> | ||
47 | #include <stdlib.h> | ||
48 | #include <wchar.h> | ||
49 | int main () | ||
50 | { | ||
51 | mbstate_t state; | ||
52 | char out[64]; | ||
53 | int count; | ||
54 | memset (&state, 0, sizeof (state)); | ||
55 | out[0] = 'x'; | ||
56 | count = wcrtomb (out, L'a', &state); | ||
57 | return !(count == 1 && out[0] == 'a'); | ||
58 | }]])], | ||
59 | [gl_cv_func_wcrtomb_works=yes], | ||
60 | [gl_cv_func_wcrtomb_works=no], | ||
61 | [case "$host_os" in | ||
62 | # Guess no on Android. | ||
63 | linux*-android*) gl_cv_func_wcrtomb_works="guessing no";; | ||
64 | # Guess yes otherwise. | ||
65 | *) gl_cv_func_wcrtomb_works="guessing yes";; | ||
66 | esac | ||
67 | ]) | ||
68 | ]) | ||
69 | case "$gl_cv_func_wcrtomb_works" in | ||
70 | *yes) ;; | ||
71 | *) AC_DEFINE([WCRTOMB_C_LOCALE_BUG], [1], | ||
72 | [Define if the wcrtomb function does not work in the C locale.]) | ||
73 | REPLACE_WCRTOMB=1 ;; | ||
74 | esac | ||
75 | fi | ||
76 | if test $REPLACE_WCRTOMB = 0; then | ||
45 | AC_CACHE_CHECK([whether wcrtomb return value is correct], | 77 | AC_CACHE_CHECK([whether wcrtomb return value is correct], |
46 | [gl_cv_func_wcrtomb_retval], | 78 | [gl_cv_func_wcrtomb_retval], |
47 | [ | 79 | [ |
@@ -49,10 +81,10 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
49 | dnl is present. | 81 | dnl is present. |
50 | changequote(,)dnl | 82 | changequote(,)dnl |
51 | case "$host_os" in | 83 | case "$host_os" in |
52 | # Guess no on AIX 4, OSF/1 and Solaris. | 84 | # Guess no on AIX 4, OSF/1, Solaris, native Windows. |
53 | aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; | 85 | aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; |
54 | # Guess yes otherwise. | 86 | # Guess yes otherwise. |
55 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; | 87 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; |
56 | esac | 88 | esac |
57 | changequote([,])dnl | 89 | changequote([,])dnl |
58 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then | 90 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then |
@@ -60,14 +92,8 @@ changequote([,])dnl | |||
60 | [AC_LANG_SOURCE([[ | 92 | [AC_LANG_SOURCE([[ |
61 | #include <locale.h> | 93 | #include <locale.h> |
62 | #include <string.h> | 94 | #include <string.h> |
63 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
64 | <wchar.h>. | ||
65 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
66 | included before <wchar.h>. */ | ||
67 | #include <stddef.h> | ||
68 | #include <stdio.h> | ||
69 | #include <time.h> | ||
70 | #include <wchar.h> | 95 | #include <wchar.h> |
96 | #include <stdlib.h> | ||
71 | int main () | 97 | int main () |
72 | { | 98 | { |
73 | int result = 0; | 99 | int result = 0; |
@@ -80,6 +106,12 @@ int main () | |||
80 | { | 106 | { |
81 | if (wcrtomb (NULL, 0, NULL) != 1) | 107 | if (wcrtomb (NULL, 0, NULL) != 1) |
82 | result |= 2; | 108 | result |= 2; |
109 | { | ||
110 | wchar_t wc = (wchar_t) 0xBADFACE; | ||
111 | if (mbtowc (&wc, "\303\274", 2) == 2) | ||
112 | if (wcrtomb (NULL, wc, NULL) != 1) | ||
113 | result |= 2; | ||
114 | } | ||
83 | } | 115 | } |
84 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 116 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) |
85 | { | 117 | { |
@@ -100,7 +132,9 @@ int main () | |||
100 | ]) | 132 | ]) |
101 | case "$gl_cv_func_wcrtomb_retval" in | 133 | case "$gl_cv_func_wcrtomb_retval" in |
102 | *yes) ;; | 134 | *yes) ;; |
103 | *) REPLACE_WCRTOMB=1 ;; | 135 | *) AC_DEFINE([WCRTOMB_RETVAL_BUG], [1], |
136 | [Define if the wcrtomb function has an incorrect return value.]) | ||
137 | REPLACE_WCRTOMB=1 ;; | ||
104 | esac | 138 | esac |
105 | fi | 139 | fi |
106 | fi | 140 | fi |
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 index 82ada0e..6856a73 100644 --- a/gl/m4/wctype_h.m4 +++ b/gl/m4/wctype_h.m4 | |||
@@ -1,15 +1,15 @@ | |||
1 | # wctype_h.m4 serial 18 | 1 | # wctype_h.m4 serial 30 |
2 | 2 | ||
3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. | 3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. |
4 | 4 | ||
5 | dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. | 5 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. |
6 | dnl This file is free software; the Free Software Foundation | 6 | dnl This file is free software; the Free Software Foundation |
7 | dnl gives unlimited permission to copy and/or distribute it, | 7 | dnl gives unlimited permission to copy and/or distribute it, |
8 | 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 | 9 | ||
10 | dnl Written by Paul Eggert. | 10 | dnl Written by Paul Eggert. |
11 | 11 | ||
12 | AC_DEFUN([gl_WCTYPE_H], | 12 | AC_DEFUN_ONCE([gl_WCTYPE_H], |
13 | [ | 13 | [ |
14 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | 14 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) |
15 | AC_REQUIRE([AC_PROG_CC]) | 15 | AC_REQUIRE([AC_PROG_CC]) |
@@ -30,6 +30,8 @@ AC_DEFUN([gl_WCTYPE_H], | |||
30 | fi | 30 | fi |
31 | AC_SUBST([HAVE_WINT_T]) | 31 | AC_SUBST([HAVE_WINT_T]) |
32 | 32 | ||
33 | AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) | ||
34 | |||
33 | gl_CHECK_NEXT_HEADERS([wctype.h]) | 35 | gl_CHECK_NEXT_HEADERS([wctype.h]) |
34 | if test $ac_cv_header_wctype_h = yes; then | 36 | if test $ac_cv_header_wctype_h = yes; then |
35 | if test $ac_cv_func_iswcntrl = yes; then | 37 | if test $ac_cv_func_iswcntrl = yes; then |
@@ -39,22 +41,16 @@ AC_DEFUN([gl_WCTYPE_H], | |||
39 | [ | 41 | [ |
40 | AC_RUN_IFELSE( | 42 | AC_RUN_IFELSE( |
41 | [AC_LANG_SOURCE([[ | 43 | [AC_LANG_SOURCE([[ |
42 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | ||
43 | included before <wchar.h>. | ||
44 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
45 | must be included before <wchar.h>. */ | ||
46 | #include <stddef.h> | ||
47 | #include <stdio.h> | ||
48 | #include <time.h> | ||
49 | #include <wchar.h> | 44 | #include <wchar.h> |
50 | #include <wctype.h> | 45 | #include <wctype.h> |
51 | int main () { return iswprint ('x') == 0; } | 46 | int main () { return iswprint ('x') == 0; } |
52 | ]])], | 47 | ]])], |
53 | [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], | 48 | [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], |
54 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | 49 | [dnl Guess no on Linux libc5, yes otherwise. |
50 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | ||
55 | #if __GNU_LIBRARY__ == 1 | 51 | #if __GNU_LIBRARY__ == 1 |
56 | Linux libc5 i18n is broken. | 52 | Linux libc5 i18n is broken. |
57 | #endif]], [])], | 53 | #endif]], [[]])], |
58 | [gl_cv_func_iswcntrl_works="guessing yes"], | 54 | [gl_cv_func_iswcntrl_works="guessing yes"], |
59 | [gl_cv_func_iswcntrl_works="guessing no"]) | 55 | [gl_cv_func_iswcntrl_works="guessing no"]) |
60 | ]) | 56 | ]) |
@@ -66,10 +62,14 @@ AC_DEFUN([gl_WCTYPE_H], | |||
66 | fi | 62 | fi |
67 | AC_SUBST([HAVE_WCTYPE_H]) | 63 | AC_SUBST([HAVE_WCTYPE_H]) |
68 | 64 | ||
69 | case "$gl_cv_func_iswcntrl_works" in | 65 | if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then |
70 | *yes) REPLACE_ISWCNTRL=0 ;; | 66 | REPLACE_ISWCNTRL=1 |
71 | *) REPLACE_ISWCNTRL=1 ;; | 67 | else |
72 | esac | 68 | case "$gl_cv_func_iswcntrl_works" in |
69 | *yes) REPLACE_ISWCNTRL=0 ;; | ||
70 | *) REPLACE_ISWCNTRL=1 ;; | ||
71 | esac | ||
72 | fi | ||
73 | AC_SUBST([REPLACE_ISWCNTRL]) | 73 | AC_SUBST([REPLACE_ISWCNTRL]) |
74 | 74 | ||
75 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | 75 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then |
@@ -85,14 +85,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
85 | REPLACE_TOWLOWER=0 | 85 | REPLACE_TOWLOWER=0 |
86 | else | 86 | else |
87 | AC_CHECK_DECLS([towlower],,, | 87 | AC_CHECK_DECLS([towlower],,, |
88 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 88 | [[#include <wchar.h> |
89 | included before <wchar.h>. | ||
90 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
91 | must be included before <wchar.h>. */ | ||
92 | #include <stddef.h> | ||
93 | #include <stdio.h> | ||
94 | #include <time.h> | ||
95 | #include <wchar.h> | ||
96 | #if HAVE_WCTYPE_H | 89 | #if HAVE_WCTYPE_H |
97 | # include <wctype.h> | 90 | # include <wctype.h> |
98 | #endif | 91 | #endif |
@@ -121,14 +114,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
121 | AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], | 114 | AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], |
122 | [AC_COMPILE_IFELSE( | 115 | [AC_COMPILE_IFELSE( |
123 | [AC_LANG_PROGRAM( | 116 | [AC_LANG_PROGRAM( |
124 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 117 | [[#include <wchar.h> |
125 | included before <wchar.h>. | ||
126 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
127 | must be included before <wchar.h>. */ | ||
128 | #include <stddef.h> | ||
129 | #include <stdio.h> | ||
130 | #include <time.h> | ||
131 | #include <wchar.h> | ||
132 | #if HAVE_WCTYPE_H | 118 | #if HAVE_WCTYPE_H |
133 | # include <wctype.h> | 119 | # include <wctype.h> |
134 | #endif | 120 | #endif |
@@ -147,14 +133,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
147 | AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], | 133 | AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], |
148 | [AC_COMPILE_IFELSE( | 134 | [AC_COMPILE_IFELSE( |
149 | [AC_LANG_PROGRAM( | 135 | [AC_LANG_PROGRAM( |
150 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 136 | [[#include <wchar.h> |
151 | included before <wchar.h>. | ||
152 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
153 | must be included before <wchar.h>. */ | ||
154 | #include <stddef.h> | ||
155 | #include <stdio.h> | ||
156 | #include <time.h> | ||
157 | #include <wchar.h> | ||
158 | #include <wctype.h> | 137 | #include <wctype.h> |
159 | wctrans_t a; | 138 | wctrans_t a; |
160 | ]], | 139 | ]], |
@@ -169,14 +148,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
169 | dnl Check for declarations of anything we want to poison if the | 148 | dnl Check for declarations of anything we want to poison if the |
170 | dnl corresponding gnulib module is not in use. | 149 | dnl corresponding gnulib module is not in use. |
171 | gl_WARN_ON_USE_PREPARE([[ | 150 | gl_WARN_ON_USE_PREPARE([[ |
172 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
173 | <wchar.h>. | ||
174 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
175 | included before <wchar.h>. */ | ||
176 | #if !(defined __GLIBC__ && !defined __UCLIBC__) | 151 | #if !(defined __GLIBC__ && !defined __UCLIBC__) |
177 | # include <stddef.h> | ||
178 | # include <stdio.h> | ||
179 | # include <time.h> | ||
180 | # include <wchar.h> | 152 | # include <wchar.h> |
181 | #endif | 153 | #endif |
182 | #include <wctype.h> | 154 | #include <wctype.h> |
@@ -185,25 +157,44 @@ AC_DEFUN([gl_WCTYPE_H], | |||
185 | ]) | 157 | ]) |
186 | ]) | 158 | ]) |
187 | 159 | ||
160 | # gl_WCTYPE_MODULE_INDICATOR([modulename]) | ||
161 | # sets the shell variable that indicates the presence of the given module | ||
162 | # to a C preprocessor expression that will evaluate to 1. | ||
163 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
188 | AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], | 164 | AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], |
189 | [ | 165 | [ |
190 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 166 | dnl Ensure to expand the default settings once only. |
191 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | 167 | gl_WCTYPE_H_REQUIRE_DEFAULTS |
192 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 168 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
193 | dnl Define it also as a C macro, for the benefit of the unit tests. | 169 | dnl Define it also as a C macro, for the benefit of the unit tests. |
194 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 170 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
195 | ]) | 171 | ]) |
196 | 172 | ||
173 | # Initializes the default values for AC_SUBSTed shell variables. | ||
174 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
175 | # outside of macros or in macros that are not AC_REQUIREd. | ||
176 | AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], | ||
177 | [ | ||
178 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ | ||
179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) | ||
180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) | ||
181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) | ||
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) | ||
183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) | ||
184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS]) | ||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS]) | ||
186 | ]) | ||
187 | m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS]) | ||
188 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
189 | ]) | ||
190 | |||
197 | AC_DEFUN([gl_WCTYPE_H_DEFAULTS], | 191 | AC_DEFUN([gl_WCTYPE_H_DEFAULTS], |
198 | [ | 192 | [ |
199 | GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) | ||
200 | GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE]) | ||
201 | GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE]) | ||
202 | GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS]) | ||
203 | GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS]) | ||
204 | dnl Assume proper GNU behavior unless another module says otherwise. | 193 | dnl Assume proper GNU behavior unless another module says otherwise. |
205 | HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) | 194 | HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) |
206 | HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) | 195 | HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) |
207 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) | 196 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) |
208 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) | 197 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) |
198 | REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) | ||
199 | REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) | ||
209 | ]) | 200 | ]) |
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index d7cd3db..dfd743b 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 | |||
@@ -1,11 +1,12 @@ | |||
1 | # wint_t.m4 serial 5 (gettext-0.18.2) | 1 | # wint_t.m4 serial 11 |
2 | dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
8 | dnl Test whether <wchar.h> has the 'wint_t' type. | 8 | dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's |
9 | dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'. | ||
9 | dnl Prerequisite: AC_PROG_CC | 10 | dnl Prerequisite: AC_PROG_CC |
10 | 11 | ||
11 | AC_DEFUN([gt_TYPE_WINT_T], | 12 | AC_DEFUN([gt_TYPE_WINT_T], |
@@ -13,20 +14,44 @@ AC_DEFUN([gt_TYPE_WINT_T], | |||
13 | AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], | 14 | AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], |
14 | [AC_COMPILE_IFELSE( | 15 | [AC_COMPILE_IFELSE( |
15 | [AC_LANG_PROGRAM( | 16 | [AC_LANG_PROGRAM( |
16 | [[ | 17 | [[#include <wchar.h> |
17 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
18 | <wchar.h>. | ||
19 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included | ||
20 | before <wchar.h>. */ | ||
21 | #include <stddef.h> | ||
22 | #include <stdio.h> | ||
23 | #include <time.h> | ||
24 | #include <wchar.h> | ||
25 | wint_t foo = (wchar_t)'\0';]], | 18 | wint_t foo = (wchar_t)'\0';]], |
26 | [[]])], | 19 | [[]])], |
27 | [gt_cv_c_wint_t=yes], | 20 | [gt_cv_c_wint_t=yes], |
28 | [gt_cv_c_wint_t=no])]) | 21 | [gt_cv_c_wint_t=no])]) |
29 | if test $gt_cv_c_wint_t = yes; then | 22 | if test $gt_cv_c_wint_t = yes; then |
30 | AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) | 23 | AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) |
24 | |||
25 | dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present, | ||
26 | dnl override 'wint_t'. | ||
27 | AC_CACHE_CHECK([whether wint_t is large enough], | ||
28 | [gl_cv_type_wint_t_large_enough], | ||
29 | [AC_COMPILE_IFELSE( | ||
30 | [AC_LANG_PROGRAM( | ||
31 | [[#include <wchar.h> | ||
32 | int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; | ||
33 | ]])], | ||
34 | [gl_cv_type_wint_t_large_enough=yes], | ||
35 | [gl_cv_type_wint_t_large_enough=no])]) | ||
36 | if test $gl_cv_type_wint_t_large_enough = no; then | ||
37 | GNULIBHEADERS_OVERRIDE_WINT_T=1 | ||
38 | else | ||
39 | GNULIBHEADERS_OVERRIDE_WINT_T=0 | ||
40 | fi | ||
41 | else | ||
42 | GNULIBHEADERS_OVERRIDE_WINT_T=0 | ||
43 | fi | ||
44 | AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T]) | ||
45 | ]) | ||
46 | |||
47 | dnl Prerequisites of the 'wint_t' override. | ||
48 | AC_DEFUN([gl_TYPE_WINT_T_PREREQ], | ||
49 | [ | ||
50 | AC_CHECK_HEADERS_ONCE([crtdefs.h]) | ||
51 | if test $ac_cv_header_crtdefs_h = yes; then | ||
52 | HAVE_CRTDEFS_H=1 | ||
53 | else | ||
54 | HAVE_CRTDEFS_H=0 | ||
31 | fi | 55 | fi |
56 | AC_SUBST([HAVE_CRTDEFS_H]) | ||
32 | ]) | 57 | ]) |
diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4 index 64ca701..fc56f59 100644 --- a/gl/m4/xalloc.m4 +++ b/gl/m4/xalloc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # xalloc.m4 serial 18 | 1 | # xalloc.m4 serial 18 |
2 | dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index 8ea9f2c..649db9c 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # xsize.m4 serial 5 | 1 | # xsize.m4 serial 5 |
2 | dnl Copyright (C) 2003-2004, 2008-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003-2004, 2008-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/gl/m4/xstrndup.m4 b/gl/m4/xstrndup.m4 deleted file mode 100644 index 4a9330b..0000000 --- a/gl/m4/xstrndup.m4 +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | # xstrndup.m4 serial 2 | ||
2 | dnl Copyright (C) 2003, 2009-2013 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_XSTRNDUP], | ||
8 | [ | ||
9 | gl_PREREQ_XSTRNDUP | ||
10 | ]) | ||
11 | |||
12 | # Prerequisites of lib/xstrndup.c. | ||
13 | AC_DEFUN([gl_PREREQ_XSTRNDUP], [ | ||
14 | : | ||
15 | ]) | ||
diff --git a/gl/m4/zzgnulib.m4 b/gl/m4/zzgnulib.m4 new file mode 100644 index 0000000..362102b --- /dev/null +++ b/gl/m4/zzgnulib.m4 | |||
@@ -0,0 +1,23 @@ | |||
1 | # zzgnulib.m4 serial 1 | ||
2 | dnl Copyright (C) 2020-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 This file must be named something that sorts after all other | ||
8 | dnl package- or gnulib-provided .m4 files - at least for those packages | ||
9 | dnl that redefine AC_PROG_CC. | ||
10 | |||
11 | dnl Redefine AC_PROG_CC so that it ends with invocations of gl_COMPILER_CLANG | ||
12 | dnl and gl_COMPILER_PREPARE_CHECK_DECL. | ||
13 | m4_define([AC_PROG_CC], | ||
14 | m4_defn([AC_PROG_CC])[ | ||
15 | gl_COMPILER_CLANG | ||
16 | gl_COMPILER_PREPARE_CHECK_DECL | ||
17 | ]) | ||
18 | |||
19 | # gl_ZZGNULIB | ||
20 | # ----------- | ||
21 | # Witness macro that this file has been included. Needed to force | ||
22 | # Automake to include this file after all other gnulib .m4 files. | ||
23 | AC_DEFUN([gl_ZZGNULIB]) | ||