diff options
| author | Po Lu | 2023-08-07 08:14:38 +0800 |
|---|---|---|
| committer | Po Lu | 2023-08-07 08:14:38 +0800 |
| commit | 76cac8ae6f600be34f83bd3aaf9b38355eab773e (patch) | |
| tree | 24951a85b6c4594503cf7d973ffaf680f17e0612 /m4 | |
| parent | 072a8a434eb0f39f6e4a0c956d3d8cf44b00cff8 (diff) | |
| download | emacs-76cac8ae6f600be34f83bd3aaf9b38355eab773e.tar.gz emacs-76cac8ae6f600be34f83bd3aaf9b38355eab773e.zip | |
Update from Gnulib, remove printf-posix
* m4, lib: Update from Gnulib.
* msdos/sedlibmk.inp: Remove variables deleted as part of previous
change.
* admin/merge-gnulib (GNULIB_MODULES): Remove vasprintf and
printf-posix.
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/asm-underscore.m4 | 83 | ||||
| -rw-r--r-- | m4/exponentd.m4 | 116 | ||||
| -rw-r--r-- | m4/exponentf.m4 | 92 | ||||
| -rw-r--r-- | m4/exponentl.m4 | 112 | ||||
| -rw-r--r-- | m4/float_h.m4 | 106 | ||||
| -rw-r--r-- | m4/frexp.m4 | 181 | ||||
| -rw-r--r-- | m4/frexpl.m4 | 233 | ||||
| -rw-r--r-- | m4/fseterr.m4 | 13 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 210 | ||||
| -rw-r--r-- | m4/intmax_t.m4 | 59 | ||||
| -rw-r--r-- | m4/inttypes_h.m4 | 29 | ||||
| -rw-r--r-- | m4/isnand.m4 | 96 | ||||
| -rw-r--r-- | m4/isnanf.m4 | 197 | ||||
| -rw-r--r-- | m4/isnanl.m4 | 248 | ||||
| -rw-r--r-- | m4/ldexpl.m4 | 135 | ||||
| -rw-r--r-- | m4/math_h.m4 | 391 | ||||
| -rw-r--r-- | m4/printf-frexp.m4 | 38 | ||||
| -rw-r--r-- | m4/printf-frexpl.m4 | 48 | ||||
| -rw-r--r-- | m4/printf-posix.m4 | 36 | ||||
| -rw-r--r-- | m4/printf.m4 | 2158 | ||||
| -rw-r--r-- | m4/signbit.m4 | 393 | ||||
| -rw-r--r-- | m4/size_max.m4 | 75 | ||||
| -rw-r--r-- | m4/stdint_h.m4 | 27 | ||||
| -rw-r--r-- | m4/vasnprintf.m4 | 462 | ||||
| -rw-r--r-- | m4/vasprintf-posix.m4 | 113 | ||||
| -rw-r--r-- | m4/vasprintf.m4 | 46 | ||||
| -rw-r--r-- | m4/vfprintf-posix.m4 | 122 | ||||
| -rw-r--r-- | m4/xsize.m4 | 12 |
28 files changed, 0 insertions, 5831 deletions
diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4 deleted file mode 100644 index 65ae55a75fd..00000000000 --- a/m4/asm-underscore.m4 +++ /dev/null | |||
| @@ -1,83 +0,0 @@ | |||
| 1 | # asm-underscore.m4 serial 5 | ||
| 2 | dnl Copyright (C) 2010-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. Based on as-underscore.m4 in GNU clisp. | ||
| 8 | |||
| 9 | # gl_ASM_SYMBOL_PREFIX | ||
| 10 | # Tests for the prefix of C symbols at the assembly language level and the | ||
| 11 | # linker level. This prefix is either an underscore or empty. Defines the | ||
| 12 | # C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to | ||
| 13 | # a stringified variant of this prefix. | ||
| 14 | |||
| 15 | AC_DEFUN([gl_ASM_SYMBOL_PREFIX], | ||
| 16 | [ | ||
| 17 | AC_REQUIRE([AC_PROG_EGREP]) | ||
| 18 | dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because | ||
| 19 | dnl 1. It works only for GCC. | ||
| 20 | dnl 2. It is incorrectly defined on some platforms, in some GCC versions. | ||
| 21 | AC_REQUIRE([gl_C_ASM]) | ||
| 22 | AC_CACHE_CHECK( | ||
| 23 | [whether C symbols are prefixed with underscore at the linker level], | ||
| 24 | [gl_cv_prog_as_underscore], | ||
| 25 | [cat > conftest.c <<EOF | ||
| 26 | #ifdef __cplusplus | ||
| 27 | extern "C" int foo (void); | ||
| 28 | #endif | ||
| 29 | int foo(void) { return 0; } | ||
| 30 | EOF | ||
| 31 | # Look for the assembly language name in the .s file. | ||
| 32 | AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 | ||
| 33 | if LC_ALL=C $EGREP '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then | ||
| 34 | gl_cv_prog_as_underscore=yes | ||
| 35 | else | ||
| 36 | gl_cv_prog_as_underscore=no | ||
| 37 | fi | ||
| 38 | rm -f conftest* | ||
| 39 | ]) | ||
| 40 | if test $gl_cv_prog_as_underscore = yes; then | ||
| 41 | USER_LABEL_PREFIX=_ | ||
| 42 | else | ||
| 43 | USER_LABEL_PREFIX= | ||
| 44 | fi | ||
| 45 | AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX], | ||
| 46 | [Define to the prefix of C symbols at the assembler and linker level, | ||
| 47 | either an underscore or empty.]) | ||
| 48 | ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' | ||
| 49 | AC_SUBST([ASM_SYMBOL_PREFIX]) | ||
| 50 | ]) | ||
| 51 | |||
| 52 | # gl_C_ASM | ||
| 53 | # Determines how to produce an assembly language file from C source code. | ||
| 54 | # Sets the variables: | ||
| 55 | # gl_asmext - the extension of assembly language output, | ||
| 56 | # gl_c_asm_opt - the C compiler option that produces assembly language output. | ||
| 57 | |||
| 58 | AC_DEFUN([gl_C_ASM], | ||
| 59 | [ | ||
| 60 | AC_EGREP_CPP([MicrosoftCompiler], | ||
| 61 | [ | ||
| 62 | #ifdef _MSC_VER | ||
| 63 | MicrosoftCompiler | ||
| 64 | #endif | ||
| 65 | ], | ||
| 66 | [dnl Microsoft's 'cl' and 'clang-cl' produce an .asm file, whereas 'clang' | ||
| 67 | dnl produces a .s file. Need to distinguish 'clang' and 'clang-cl'. | ||
| 68 | rm -f conftest* | ||
| 69 | echo 'int dummy;' > conftest.c | ||
| 70 | AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c) >/dev/null 2>&1 | ||
| 71 | if test -f conftest.o; then | ||
| 72 | gl_asmext='s' | ||
| 73 | gl_c_asm_opt='-S' | ||
| 74 | else | ||
| 75 | gl_asmext='asm' | ||
| 76 | gl_c_asm_opt='-c -Fa' | ||
| 77 | fi | ||
| 78 | rm -f conftest* | ||
| 79 | ], | ||
| 80 | [gl_asmext='s' | ||
| 81 | gl_c_asm_opt='-S' | ||
| 82 | ]) | ||
| 83 | ]) | ||
diff --git a/m4/exponentd.m4 b/m4/exponentd.m4 deleted file mode 100644 index 163114b89ec..00000000000 --- a/m4/exponentd.m4 +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | # exponentd.m4 serial 4 | ||
| 2 | dnl Copyright (C) 2007-2008, 2010-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 | AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], | ||
| 7 | [ | ||
| 8 | AC_CACHE_CHECK([where to find the exponent in a 'double'], | ||
| 9 | [gl_cv_cc_double_expbit0], | ||
| 10 | [ | ||
| 11 | AC_RUN_IFELSE( | ||
| 12 | [AC_LANG_SOURCE([[ | ||
| 13 | #include <float.h> | ||
| 14 | #include <stddef.h> | ||
| 15 | #include <stdio.h> | ||
| 16 | #include <string.h> | ||
| 17 | #define NWORDS \ | ||
| 18 | ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | ||
| 19 | typedef union { double value; unsigned int word[NWORDS]; } memory_double; | ||
| 20 | static unsigned int ored_words[NWORDS]; | ||
| 21 | static unsigned int anded_words[NWORDS]; | ||
| 22 | static void add_to_ored_words (double x) | ||
| 23 | { | ||
| 24 | memory_double m; | ||
| 25 | size_t i; | ||
| 26 | /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ | ||
| 27 | memset (&m, 0, sizeof (memory_double)); | ||
| 28 | m.value = x; | ||
| 29 | for (i = 0; i < NWORDS; i++) | ||
| 30 | { | ||
| 31 | ored_words[i] |= m.word[i]; | ||
| 32 | anded_words[i] &= m.word[i]; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | int main () | ||
| 36 | { | ||
| 37 | size_t j; | ||
| 38 | FILE *fp = fopen ("conftest.out", "w"); | ||
| 39 | if (fp == NULL) | ||
| 40 | return 1; | ||
| 41 | for (j = 0; j < NWORDS; j++) | ||
| 42 | anded_words[j] = ~ (unsigned int) 0; | ||
| 43 | add_to_ored_words (0.25); | ||
| 44 | add_to_ored_words (0.5); | ||
| 45 | add_to_ored_words (1.0); | ||
| 46 | add_to_ored_words (2.0); | ||
| 47 | add_to_ored_words (4.0); | ||
| 48 | /* Remove bits that are common (e.g. if representation of the first mantissa | ||
| 49 | bit is explicit). */ | ||
| 50 | for (j = 0; j < NWORDS; j++) | ||
| 51 | ored_words[j] &= ~anded_words[j]; | ||
| 52 | /* Now find the nonzero word. */ | ||
| 53 | for (j = 0; j < NWORDS; j++) | ||
| 54 | if (ored_words[j] != 0) | ||
| 55 | break; | ||
| 56 | if (j < NWORDS) | ||
| 57 | { | ||
| 58 | size_t i; | ||
| 59 | for (i = j + 1; i < NWORDS; i++) | ||
| 60 | if (ored_words[i] != 0) | ||
| 61 | { | ||
| 62 | fprintf (fp, "unknown"); | ||
| 63 | return (fclose (fp) != 0); | ||
| 64 | } | ||
| 65 | for (i = 0; ; i++) | ||
| 66 | if ((ored_words[j] >> i) & 1) | ||
| 67 | { | ||
| 68 | fprintf (fp, "word %d bit %d", (int) j, (int) i); | ||
| 69 | return (fclose (fp) != 0); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | fprintf (fp, "unknown"); | ||
| 73 | return (fclose (fp) != 0); | ||
| 74 | } | ||
| 75 | ]])], | ||
| 76 | [gl_cv_cc_double_expbit0=`cat conftest.out`], | ||
| 77 | [gl_cv_cc_double_expbit0="unknown"], | ||
| 78 | [ | ||
| 79 | dnl On ARM, there are two 'double' floating-point formats, used by | ||
| 80 | dnl different sets of instructions: The older FPA instructions assume | ||
| 81 | dnl that they are stored in big-endian word order, while the words | ||
| 82 | dnl (like integer types) are stored in little-endian byte order. | ||
| 83 | dnl The newer VFP instructions assume little-endian order | ||
| 84 | dnl consistently. | ||
| 85 | AC_EGREP_CPP([mixed_endianness], [ | ||
| 86 | #if defined arm || defined __arm || defined __arm__ | ||
| 87 | mixed_endianness | ||
| 88 | #endif | ||
| 89 | ], | ||
| 90 | [gl_cv_cc_double_expbit0="unknown"], | ||
| 91 | [ | ||
| 92 | pushdef([AC_MSG_CHECKING],[:])dnl | ||
| 93 | pushdef([AC_MSG_RESULT],[:])dnl | ||
| 94 | pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl | ||
| 95 | AC_C_BIGENDIAN( | ||
| 96 | [gl_cv_cc_double_expbit0="word 0 bit 20"], | ||
| 97 | [gl_cv_cc_double_expbit0="word 1 bit 20"], | ||
| 98 | [gl_cv_cc_double_expbit0="unknown"]) | ||
| 99 | popdef([AC_MSG_RESULT_UNQUOTED])dnl | ||
| 100 | popdef([AC_MSG_RESULT])dnl | ||
| 101 | popdef([AC_MSG_CHECKING])dnl | ||
| 102 | ]) | ||
| 103 | ]) | ||
| 104 | rm -f conftest.out | ||
| 105 | ]) | ||
| 106 | case "$gl_cv_cc_double_expbit0" in | ||
| 107 | word*bit*) | ||
| 108 | word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` | ||
| 109 | bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` | ||
| 110 | AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], | ||
| 111 | [Define as the word index where to find the exponent of 'double'.]) | ||
| 112 | AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], | ||
| 113 | [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) | ||
| 114 | ;; | ||
| 115 | esac | ||
| 116 | ]) | ||
diff --git a/m4/exponentf.m4 b/m4/exponentf.m4 deleted file mode 100644 index e761883939b..00000000000 --- a/m4/exponentf.m4 +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | # exponentf.m4 serial 3 | ||
| 2 | dnl Copyright (C) 2007-2008, 2010-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 | AC_DEFUN_ONCE([gl_FLOAT_EXPONENT_LOCATION], | ||
| 7 | [ | ||
| 8 | AC_CACHE_CHECK([where to find the exponent in a 'float'], | ||
| 9 | [gl_cv_cc_float_expbit0], | ||
| 10 | [ | ||
| 11 | AC_RUN_IFELSE( | ||
| 12 | [AC_LANG_SOURCE([[ | ||
| 13 | #include <float.h> | ||
| 14 | #include <stddef.h> | ||
| 15 | #include <stdio.h> | ||
| 16 | #include <string.h> | ||
| 17 | #define NWORDS \ | ||
| 18 | ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | ||
| 19 | typedef union { float value; unsigned int word[NWORDS]; } memory_float; | ||
| 20 | static unsigned int ored_words[NWORDS]; | ||
| 21 | static unsigned int anded_words[NWORDS]; | ||
| 22 | static void add_to_ored_words (float x) | ||
| 23 | { | ||
| 24 | memory_float m; | ||
| 25 | size_t i; | ||
| 26 | /* Clear it first, in case | ||
| 27 | sizeof (float) < sizeof (memory_float). */ | ||
| 28 | memset (&m, 0, sizeof (memory_float)); | ||
| 29 | m.value = x; | ||
| 30 | for (i = 0; i < NWORDS; i++) | ||
| 31 | { | ||
| 32 | ored_words[i] |= m.word[i]; | ||
| 33 | anded_words[i] &= m.word[i]; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | int main () | ||
| 37 | { | ||
| 38 | size_t j; | ||
| 39 | FILE *fp = fopen ("conftest.out", "w"); | ||
| 40 | if (fp == NULL) | ||
| 41 | return 1; | ||
| 42 | for (j = 0; j < NWORDS; j++) | ||
| 43 | anded_words[j] = ~ (unsigned int) 0; | ||
| 44 | add_to_ored_words (0.25f); | ||
| 45 | add_to_ored_words (0.5f); | ||
| 46 | add_to_ored_words (1.0f); | ||
| 47 | add_to_ored_words (2.0f); | ||
| 48 | add_to_ored_words (4.0f); | ||
| 49 | /* Remove bits that are common (e.g. if representation of the first mantissa | ||
| 50 | bit is explicit). */ | ||
| 51 | for (j = 0; j < NWORDS; j++) | ||
| 52 | ored_words[j] &= ~anded_words[j]; | ||
| 53 | /* Now find the nonzero word. */ | ||
| 54 | for (j = 0; j < NWORDS; j++) | ||
| 55 | if (ored_words[j] != 0) | ||
| 56 | break; | ||
| 57 | if (j < NWORDS) | ||
| 58 | { | ||
| 59 | size_t i; | ||
| 60 | for (i = j + 1; i < NWORDS; i++) | ||
| 61 | if (ored_words[i] != 0) | ||
| 62 | { | ||
| 63 | fprintf (fp, "unknown"); | ||
| 64 | return (fclose (fp) != 0); | ||
| 65 | } | ||
| 66 | for (i = 0; ; i++) | ||
| 67 | if ((ored_words[j] >> i) & 1) | ||
| 68 | { | ||
| 69 | fprintf (fp, "word %d bit %d", (int) j, (int) i); | ||
| 70 | return (fclose (fp) != 0); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | fprintf (fp, "unknown"); | ||
| 74 | return (fclose (fp) != 0); | ||
| 75 | } | ||
| 76 | ]])], | ||
| 77 | [gl_cv_cc_float_expbit0=`cat conftest.out`], | ||
| 78 | [gl_cv_cc_float_expbit0="unknown"], | ||
| 79 | [gl_cv_cc_float_expbit0="word 0 bit 23"]) | ||
| 80 | rm -f conftest.out | ||
| 81 | ]) | ||
| 82 | case "$gl_cv_cc_float_expbit0" in | ||
| 83 | word*bit*) | ||
| 84 | word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` | ||
| 85 | bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` | ||
| 86 | AC_DEFINE_UNQUOTED([FLT_EXPBIT0_WORD], [$word], | ||
| 87 | [Define as the word index where to find the exponent of 'float'.]) | ||
| 88 | AC_DEFINE_UNQUOTED([FLT_EXPBIT0_BIT], [$bit], | ||
| 89 | [Define as the bit index in the word where to find bit 0 of the exponent of 'float'.]) | ||
| 90 | ;; | ||
| 91 | esac | ||
| 92 | ]) | ||
diff --git a/m4/exponentl.m4 b/m4/exponentl.m4 deleted file mode 100644 index bc5638737e5..00000000000 --- a/m4/exponentl.m4 +++ /dev/null | |||
| @@ -1,112 +0,0 @@ | |||
| 1 | # exponentl.m4 serial 6 | ||
| 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 | AC_DEFUN_ONCE([gl_LONG_DOUBLE_EXPONENT_LOCATION], | ||
| 7 | [ | ||
| 8 | AC_REQUIRE([gl_BIGENDIAN]) | ||
| 9 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 10 | AC_CACHE_CHECK([where to find the exponent in a 'long double'], | ||
| 11 | [gl_cv_cc_long_double_expbit0], | ||
| 12 | [ | ||
| 13 | AC_RUN_IFELSE( | ||
| 14 | [AC_LANG_SOURCE([[ | ||
| 15 | #include <float.h> | ||
| 16 | #include <stddef.h> | ||
| 17 | #include <stdio.h> | ||
| 18 | #include <string.h> | ||
| 19 | #define NWORDS \ | ||
| 20 | ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | ||
| 21 | typedef union { long double value; unsigned int word[NWORDS]; } | ||
| 22 | memory_long_double; | ||
| 23 | static unsigned int ored_words[NWORDS]; | ||
| 24 | static unsigned int anded_words[NWORDS]; | ||
| 25 | static void add_to_ored_words (long double *x) | ||
| 26 | { | ||
| 27 | memory_long_double m; | ||
| 28 | size_t i; | ||
| 29 | /* Clear it first, in case | ||
| 30 | sizeof (long double) < sizeof (memory_long_double). */ | ||
| 31 | memset (&m, 0, sizeof (memory_long_double)); | ||
| 32 | m.value = *x; | ||
| 33 | for (i = 0; i < NWORDS; i++) | ||
| 34 | { | ||
| 35 | ored_words[i] |= m.word[i]; | ||
| 36 | anded_words[i] &= m.word[i]; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | int main () | ||
| 40 | { | ||
| 41 | static long double samples[5] = { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L }; | ||
| 42 | size_t j; | ||
| 43 | FILE *fp = fopen ("conftest.out", "w"); | ||
| 44 | if (fp == NULL) | ||
| 45 | return 1; | ||
| 46 | for (j = 0; j < NWORDS; j++) | ||
| 47 | anded_words[j] = ~ (unsigned int) 0; | ||
| 48 | for (j = 0; j < 5; j++) | ||
| 49 | add_to_ored_words (&samples[j]); | ||
| 50 | /* Remove bits that are common (e.g. if representation of the first mantissa | ||
| 51 | bit is explicit). */ | ||
| 52 | for (j = 0; j < NWORDS; j++) | ||
| 53 | ored_words[j] &= ~anded_words[j]; | ||
| 54 | /* Now find the nonzero word. */ | ||
| 55 | for (j = 0; j < NWORDS; j++) | ||
| 56 | if (ored_words[j] != 0) | ||
| 57 | break; | ||
| 58 | if (j < NWORDS) | ||
| 59 | { | ||
| 60 | size_t i; | ||
| 61 | for (i = j + 1; i < NWORDS; i++) | ||
| 62 | if (ored_words[i] != 0) | ||
| 63 | { | ||
| 64 | fprintf (fp, "unknown"); | ||
| 65 | return (fclose (fp) != 0); | ||
| 66 | } | ||
| 67 | for (i = 0; ; i++) | ||
| 68 | if ((ored_words[j] >> i) & 1) | ||
| 69 | { | ||
| 70 | fprintf (fp, "word %d bit %d", (int) j, (int) i); | ||
| 71 | return (fclose (fp) != 0); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | fprintf (fp, "unknown"); | ||
| 75 | return (fclose (fp) != 0); | ||
| 76 | } | ||
| 77 | ]])], | ||
| 78 | [gl_cv_cc_long_double_expbit0=`cat conftest.out`], | ||
| 79 | [gl_cv_cc_long_double_expbit0="unknown"], | ||
| 80 | [ | ||
| 81 | dnl When cross-compiling, in general we don't know. It depends on the | ||
| 82 | dnl ABI and compiler version. There are too many cases. | ||
| 83 | gl_cv_cc_long_double_expbit0="unknown" | ||
| 84 | case "$host_os" in | ||
| 85 | mingw*) # On native Windows (little-endian), we know the result | ||
| 86 | # in two cases: mingw, MSVC. | ||
| 87 | AC_EGREP_CPP([Known], [ | ||
| 88 | #ifdef __MINGW32__ | ||
| 89 | Known | ||
| 90 | #endif | ||
| 91 | ], [gl_cv_cc_long_double_expbit0="word 2 bit 0"]) | ||
| 92 | AC_EGREP_CPP([Known], [ | ||
| 93 | #ifdef _MSC_VER | ||
| 94 | Known | ||
| 95 | #endif | ||
| 96 | ], [gl_cv_cc_long_double_expbit0="word 1 bit 20"]) | ||
| 97 | ;; | ||
| 98 | esac | ||
| 99 | ]) | ||
| 100 | rm -f conftest.out | ||
| 101 | ]) | ||
| 102 | case "$gl_cv_cc_long_double_expbit0" in | ||
| 103 | word*bit*) | ||
| 104 | word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` | ||
| 105 | bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` | ||
| 106 | AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_WORD], [$word], | ||
| 107 | [Define as the word index where to find the exponent of 'long double'.]) | ||
| 108 | AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_BIT], [$bit], | ||
| 109 | [Define as the bit index in the word where to find bit 0 of the exponent of 'long double'.]) | ||
| 110 | ;; | ||
| 111 | esac | ||
| 112 | ]) | ||
diff --git a/m4/float_h.m4 b/m4/float_h.m4 deleted file mode 100644 index 2f0c9c4ee9c..00000000000 --- a/m4/float_h.m4 +++ /dev/null | |||
| @@ -1,106 +0,0 @@ | |||
| 1 | # float_h.m4 serial 13 | ||
| 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_FLOAT_H], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([AC_PROG_CC]) | ||
| 10 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 11 | GL_GENERATE_FLOAT_H=false | ||
| 12 | REPLACE_FLOAT_LDBL=0 | ||
| 13 | case "$host_os" in | ||
| 14 | aix* | beos* | openbsd* | mirbsd* | irix*) | ||
| 15 | GL_GENERATE_FLOAT_H=true | ||
| 16 | ;; | ||
| 17 | freebsd* | dragonfly*) | ||
| 18 | case "$host_cpu" in | ||
| 19 | changequote(,)dnl | ||
| 20 | i[34567]86 ) | ||
| 21 | changequote([,])dnl | ||
| 22 | GL_GENERATE_FLOAT_H=true | ||
| 23 | ;; | ||
| 24 | x86_64 ) | ||
| 25 | # On x86_64 systems, the C compiler may still be generating | ||
| 26 | # 32-bit code. | ||
| 27 | AC_COMPILE_IFELSE( | ||
| 28 | [AC_LANG_SOURCE( | ||
| 29 | [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__ | ||
| 30 | int ok; | ||
| 31 | #else | ||
| 32 | error fail | ||
| 33 | #endif | ||
| 34 | ]])], | ||
| 35 | [], | ||
| 36 | [GL_GENERATE_FLOAT_H=true]) | ||
| 37 | ;; | ||
| 38 | esac | ||
| 39 | ;; | ||
| 40 | linux*) | ||
| 41 | case "$host_cpu" in | ||
| 42 | powerpc*) | ||
| 43 | GL_GENERATE_FLOAT_H=true | ||
| 44 | ;; | ||
| 45 | esac | ||
| 46 | ;; | ||
| 47 | esac | ||
| 48 | case "$host_os" in | ||
| 49 | aix* | freebsd* | dragonfly* | linux*) | ||
| 50 | if $GL_GENERATE_FLOAT_H; then | ||
| 51 | REPLACE_FLOAT_LDBL=1 | ||
| 52 | fi | ||
| 53 | ;; | ||
| 54 | esac | ||
| 55 | |||
| 56 | dnl Test against glibc-2.7 Linux/SPARC64 bug. | ||
| 57 | REPLACE_ITOLD=0 | ||
| 58 | AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], | ||
| 59 | [gl_cv_func_itold_works], | ||
| 60 | [ | ||
| 61 | AC_RUN_IFELSE( | ||
| 62 | [AC_LANG_SOURCE([[ | ||
| 63 | int i = -1; | ||
| 64 | volatile long double ld; | ||
| 65 | int main () | ||
| 66 | { | ||
| 67 | ld += i * 1.0L; | ||
| 68 | if (ld > 0) | ||
| 69 | return 1; | ||
| 70 | return 0; | ||
| 71 | }]])], | ||
| 72 | [gl_cv_func_itold_works=yes], | ||
| 73 | [gl_cv_func_itold_works=no], | ||
| 74 | [case "$host" in | ||
| 75 | sparc*-*-linux*) | ||
| 76 | AC_COMPILE_IFELSE( | ||
| 77 | [AC_LANG_SOURCE( | ||
| 78 | [[#if defined __LP64__ || defined __arch64__ | ||
| 79 | int ok; | ||
| 80 | #else | ||
| 81 | error fail | ||
| 82 | #endif | ||
| 83 | ]])], | ||
| 84 | [gl_cv_func_itold_works="guessing no"], | ||
| 85 | [gl_cv_func_itold_works="guessing yes"]) | ||
| 86 | ;; | ||
| 87 | # Guess yes on native Windows. | ||
| 88 | mingw*) gl_cv_func_itold_works="guessing yes" ;; | ||
| 89 | *) gl_cv_func_itold_works="guessing yes" ;; | ||
| 90 | esac | ||
| 91 | ]) | ||
| 92 | ]) | ||
| 93 | case "$gl_cv_func_itold_works" in | ||
| 94 | *no) | ||
| 95 | REPLACE_ITOLD=1 | ||
| 96 | dnl We add the workaround to <float.h> but also to <math.h>, | ||
| 97 | dnl to increase the chances that the fix function gets pulled in. | ||
| 98 | GL_GENERATE_FLOAT_H=true | ||
| 99 | ;; | ||
| 100 | esac | ||
| 101 | |||
| 102 | if $GL_GENERATE_FLOAT_H; then | ||
| 103 | gl_NEXT_HEADERS([float.h]) | ||
| 104 | fi | ||
| 105 | AC_SUBST([REPLACE_ITOLD]) | ||
| 106 | ]) | ||
diff --git a/m4/frexp.m4 b/m4/frexp.m4 deleted file mode 100644 index 0480d98f304..00000000000 --- a/m4/frexp.m4 +++ /dev/null | |||
| @@ -1,181 +0,0 @@ | |||
| 1 | # frexp.m4 serial 16 | ||
| 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_FREXP], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 10 | AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM]) | ||
| 11 | FREXP_LIBM= | ||
| 12 | if test $gl_cv_func_frexp_no_libm = no; then | ||
| 13 | AC_CACHE_CHECK([whether frexp() can be used with libm], | ||
| 14 | [gl_cv_func_frexp_in_libm], | ||
| 15 | [ | ||
| 16 | save_LIBS="$LIBS" | ||
| 17 | LIBS="$LIBS -lm" | ||
| 18 | AC_LINK_IFELSE( | ||
| 19 | [AC_LANG_PROGRAM( | ||
| 20 | [[#include <math.h> | ||
| 21 | double x;]], | ||
| 22 | [[int e; return frexp (x, &e) > 0;]])], | ||
| 23 | [gl_cv_func_frexp_in_libm=yes], | ||
| 24 | [gl_cv_func_frexp_in_libm=no]) | ||
| 25 | LIBS="$save_LIBS" | ||
| 26 | ]) | ||
| 27 | if test $gl_cv_func_frexp_in_libm = yes; then | ||
| 28 | FREXP_LIBM=-lm | ||
| 29 | fi | ||
| 30 | fi | ||
| 31 | if test $gl_cv_func_frexp_no_libm = yes \ | ||
| 32 | || test $gl_cv_func_frexp_in_libm = yes; then | ||
| 33 | save_LIBS="$LIBS" | ||
| 34 | LIBS="$LIBS $FREXP_LIBM" | ||
| 35 | gl_FUNC_FREXP_WORKS | ||
| 36 | LIBS="$save_LIBS" | ||
| 37 | case "$gl_cv_func_frexp_works" in | ||
| 38 | *yes) gl_func_frexp=yes ;; | ||
| 39 | *) gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;; | ||
| 40 | esac | ||
| 41 | else | ||
| 42 | gl_func_frexp=no | ||
| 43 | fi | ||
| 44 | if test $gl_func_frexp = yes; then | ||
| 45 | AC_DEFINE([HAVE_FREXP], [1], | ||
| 46 | [Define if the frexp() function is available and works.]) | ||
| 47 | fi | ||
| 48 | AC_SUBST([FREXP_LIBM]) | ||
| 49 | ]) | ||
| 50 | |||
| 51 | AC_DEFUN([gl_FUNC_FREXP_NO_LIBM], | ||
| 52 | [ | ||
| 53 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 54 | AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM]) | ||
| 55 | if test $gl_cv_func_frexp_no_libm = yes; then | ||
| 56 | gl_FUNC_FREXP_WORKS | ||
| 57 | case "$gl_cv_func_frexp_works" in | ||
| 58 | *yes) gl_func_frexp_no_libm=yes ;; | ||
| 59 | *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;; | ||
| 60 | esac | ||
| 61 | else | ||
| 62 | gl_func_frexp_no_libm=no | ||
| 63 | dnl Set REPLACE_FREXP here because the system may have frexp in libm. | ||
| 64 | REPLACE_FREXP=1 | ||
| 65 | fi | ||
| 66 | if test $gl_func_frexp_no_libm = yes; then | ||
| 67 | AC_DEFINE([HAVE_FREXP_IN_LIBC], [1], | ||
| 68 | [Define if the frexp() function is available in libc.]) | ||
| 69 | fi | ||
| 70 | ]) | ||
| 71 | |||
| 72 | dnl Test whether frexp() can be used without linking with libm. | ||
| 73 | dnl Set gl_cv_func_frexp_no_libm to 'yes' or 'no' accordingly. | ||
| 74 | AC_DEFUN([gl_CHECK_FREXP_NO_LIBM], | ||
| 75 | [ | ||
| 76 | AC_CACHE_CHECK([whether frexp() can be used without linking with libm], | ||
| 77 | [gl_cv_func_frexp_no_libm], | ||
| 78 | [ | ||
| 79 | AC_LINK_IFELSE( | ||
| 80 | [AC_LANG_PROGRAM( | ||
| 81 | [[#include <math.h> | ||
| 82 | double x;]], | ||
| 83 | [[int e; return frexp (x, &e) > 0;]])], | ||
| 84 | [gl_cv_func_frexp_no_libm=yes], | ||
| 85 | [gl_cv_func_frexp_no_libm=no]) | ||
| 86 | ]) | ||
| 87 | ]) | ||
| 88 | |||
| 89 | dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on | ||
| 90 | dnl NetBSD 3.0), on infinite numbers (this fails e.g. on IRIX 6.5 and mingw), | ||
| 91 | dnl and on negative zero (this fails e.g. on NetBSD 4.99 and mingw). | ||
| 92 | AC_DEFUN([gl_FUNC_FREXP_WORKS], | ||
| 93 | [ | ||
| 94 | AC_REQUIRE([AC_PROG_CC]) | ||
| 95 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 96 | AC_CHECK_DECLS_ONCE([alarm]) | ||
| 97 | AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works], | ||
| 98 | [ | ||
| 99 | AC_RUN_IFELSE( | ||
| 100 | [AC_LANG_SOURCE([[ | ||
| 101 | #include <float.h> | ||
| 102 | #include <math.h> | ||
| 103 | #include <string.h> | ||
| 104 | #if HAVE_DECL_ALARM | ||
| 105 | # include <signal.h> | ||
| 106 | # include <unistd.h> | ||
| 107 | #endif | ||
| 108 | /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. | ||
| 109 | ICC 10.0 has a bug when optimizing the expression -zero. | ||
| 110 | The expression -DBL_MIN * DBL_MIN does not work when cross-compiling | ||
| 111 | to PowerPC on Mac OS X 10.5. */ | ||
| 112 | #if defined __hpux || defined __sgi || defined __ICC | ||
| 113 | static double | ||
| 114 | compute_minus_zero (void) | ||
| 115 | { | ||
| 116 | return -DBL_MIN * DBL_MIN; | ||
| 117 | } | ||
| 118 | # define minus_zero compute_minus_zero () | ||
| 119 | #else | ||
| 120 | double minus_zero = -0.0; | ||
| 121 | #endif | ||
| 122 | int main() | ||
| 123 | { | ||
| 124 | int result = 0; | ||
| 125 | int i; | ||
| 126 | volatile double x; | ||
| 127 | double zero = 0.0; | ||
| 128 | #if HAVE_DECL_ALARM | ||
| 129 | /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite | ||
| 130 | number. Let the test fail in this case. */ | ||
| 131 | signal (SIGALRM, SIG_DFL); | ||
| 132 | alarm (5); | ||
| 133 | #endif | ||
| 134 | /* Test on denormalized numbers. */ | ||
| 135 | for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) | ||
| 136 | ; | ||
| 137 | if (x > 0.0) | ||
| 138 | { | ||
| 139 | int exp; | ||
| 140 | double y = frexp (x, &exp); | ||
| 141 | /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. | ||
| 142 | On NetBSD: y = 0.75. Correct: y = 0.5. */ | ||
| 143 | if (y != 0.5) | ||
| 144 | result |= 1; | ||
| 145 | } | ||
| 146 | /* Test on infinite numbers. */ | ||
| 147 | x = 1.0 / zero; | ||
| 148 | { | ||
| 149 | int exp; | ||
| 150 | double y = frexp (x, &exp); | ||
| 151 | if (y != x) | ||
| 152 | result |= 2; | ||
| 153 | } | ||
| 154 | /* Test on negative zero. */ | ||
| 155 | x = minus_zero; | ||
| 156 | { | ||
| 157 | int exp; | ||
| 158 | double y = frexp (x, &exp); | ||
| 159 | if (memcmp (&y, &x, sizeof x)) | ||
| 160 | result |= 4; | ||
| 161 | } | ||
| 162 | return result; | ||
| 163 | }]])], | ||
| 164 | [gl_cv_func_frexp_works=yes], | ||
| 165 | [gl_cv_func_frexp_works=no], | ||
| 166 | [case "$host_os" in | ||
| 167 | netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;; | ||
| 168 | mingw*) # Guess yes with MSVC, no with mingw. | ||
| 169 | AC_EGREP_CPP([Good], [ | ||
| 170 | #ifdef _MSC_VER | ||
| 171 | Good | ||
| 172 | #endif | ||
| 173 | ], | ||
| 174 | [gl_cv_func_frexp_works="guessing yes"], | ||
| 175 | [gl_cv_func_frexp_works="guessing no"]) | ||
| 176 | ;; | ||
| 177 | *) gl_cv_func_frexp_works="guessing yes" ;; | ||
| 178 | esac | ||
| 179 | ]) | ||
| 180 | ]) | ||
| 181 | ]) | ||
diff --git a/m4/frexpl.m4 b/m4/frexpl.m4 deleted file mode 100644 index b4cf0ca9ea1..00000000000 --- a/m4/frexpl.m4 +++ /dev/null | |||
| @@ -1,233 +0,0 @@ | |||
| 1 | # frexpl.m4 serial 22 | ||
| 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_FREXPL], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 10 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 11 | |||
| 12 | dnl Persuade glibc <math.h> to declare frexpl(). | ||
| 13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 14 | |||
| 15 | dnl Check whether it's declared. | ||
| 16 | dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. | ||
| 17 | AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]]) | ||
| 18 | |||
| 19 | FREXPL_LIBM= | ||
| 20 | if test $HAVE_DECL_FREXPL = 1; then | ||
| 21 | gl_CHECK_FREXPL_NO_LIBM | ||
| 22 | if test $gl_cv_func_frexpl_no_libm = no; then | ||
| 23 | AC_CACHE_CHECK([whether frexpl() can be used with libm], | ||
| 24 | [gl_cv_func_frexpl_in_libm], | ||
| 25 | [ | ||
| 26 | save_LIBS="$LIBS" | ||
| 27 | LIBS="$LIBS -lm" | ||
| 28 | AC_LINK_IFELSE( | ||
| 29 | [AC_LANG_PROGRAM( | ||
| 30 | [[#include <math.h> | ||
| 31 | long double x;]], | ||
| 32 | [[int e; return frexpl (x, &e) > 0;]])], | ||
| 33 | [gl_cv_func_frexpl_in_libm=yes], | ||
| 34 | [gl_cv_func_frexpl_in_libm=no]) | ||
| 35 | LIBS="$save_LIBS" | ||
| 36 | ]) | ||
| 37 | if test $gl_cv_func_frexpl_in_libm = yes; then | ||
| 38 | FREXPL_LIBM=-lm | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | if test $gl_cv_func_frexpl_no_libm = yes \ | ||
| 42 | || test $gl_cv_func_frexpl_in_libm = yes; then | ||
| 43 | save_LIBS="$LIBS" | ||
| 44 | LIBS="$LIBS $FREXPL_LIBM" | ||
| 45 | gl_FUNC_FREXPL_WORKS | ||
| 46 | LIBS="$save_LIBS" | ||
| 47 | case "$gl_cv_func_frexpl_works" in | ||
| 48 | *yes) gl_func_frexpl=yes ;; | ||
| 49 | *) gl_func_frexpl=no; REPLACE_FREXPL=1 ;; | ||
| 50 | esac | ||
| 51 | else | ||
| 52 | gl_func_frexpl=no | ||
| 53 | fi | ||
| 54 | if test $gl_func_frexpl = yes; then | ||
| 55 | AC_DEFINE([HAVE_FREXPL], [1], | ||
| 56 | [Define if the frexpl() function is available.]) | ||
| 57 | fi | ||
| 58 | fi | ||
| 59 | if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then | ||
| 60 | dnl Find libraries needed to link lib/frexpl.c. | ||
| 61 | if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then | ||
| 62 | AC_REQUIRE([gl_FUNC_FREXP]) | ||
| 63 | FREXPL_LIBM="$FREXP_LIBM" | ||
| 64 | else | ||
| 65 | FREXPL_LIBM= | ||
| 66 | fi | ||
| 67 | fi | ||
| 68 | AC_SUBST([FREXPL_LIBM]) | ||
| 69 | ]) | ||
| 70 | |||
| 71 | AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], | ||
| 72 | [ | ||
| 73 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 74 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 75 | dnl Check whether it's declared. | ||
| 76 | dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. | ||
| 77 | AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]]) | ||
| 78 | if test $HAVE_DECL_FREXPL = 1; then | ||
| 79 | gl_CHECK_FREXPL_NO_LIBM | ||
| 80 | if test $gl_cv_func_frexpl_no_libm = yes; then | ||
| 81 | gl_FUNC_FREXPL_WORKS | ||
| 82 | case "$gl_cv_func_frexpl_works" in | ||
| 83 | *yes) gl_func_frexpl_no_libm=yes ;; | ||
| 84 | *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; | ||
| 85 | esac | ||
| 86 | else | ||
| 87 | gl_func_frexpl_no_libm=no | ||
| 88 | dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. | ||
| 89 | REPLACE_FREXPL=1 | ||
| 90 | fi | ||
| 91 | if test $gl_func_frexpl_no_libm = yes; then | ||
| 92 | AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1], | ||
| 93 | [Define if the frexpl() function is available in libc.]) | ||
| 94 | fi | ||
| 95 | fi | ||
| 96 | ]) | ||
| 97 | |||
| 98 | dnl Test whether frexpl() can be used without linking with libm. | ||
| 99 | dnl Set gl_cv_func_frexpl_no_libm to 'yes' or 'no' accordingly. | ||
| 100 | AC_DEFUN([gl_CHECK_FREXPL_NO_LIBM], | ||
| 101 | [ | ||
| 102 | AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], | ||
| 103 | [gl_cv_func_frexpl_no_libm], | ||
| 104 | [ | ||
| 105 | AC_LINK_IFELSE( | ||
| 106 | [AC_LANG_PROGRAM( | ||
| 107 | [[#include <math.h> | ||
| 108 | long double x;]], | ||
| 109 | [[int e; return frexpl (x, &e) > 0;]])], | ||
| 110 | [gl_cv_func_frexpl_no_libm=yes], | ||
| 111 | [gl_cv_func_frexpl_no_libm=no]) | ||
| 112 | ]) | ||
| 113 | ]) | ||
| 114 | |||
| 115 | dnl Test whether frexpl() works on finite numbers (this fails on | ||
| 116 | dnl Mac OS X 10.4/PowerPC, on AIX 5.1, and on BeOS), on denormalized numbers | ||
| 117 | dnl (this fails on Mac OS X 10.5/i386), and also on infinite numbers (this | ||
| 118 | dnl fails e.g. on IRIX 6.5 and mingw). | ||
| 119 | AC_DEFUN([gl_FUNC_FREXPL_WORKS], | ||
| 120 | [ | ||
| 121 | AC_REQUIRE([AC_PROG_CC]) | ||
| 122 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 123 | AC_CACHE_CHECK([whether frexpl works], [gl_cv_func_frexpl_works], | ||
| 124 | [ | ||
| 125 | AC_RUN_IFELSE( | ||
| 126 | [AC_LANG_SOURCE([[ | ||
| 127 | #include <float.h> | ||
| 128 | #include <math.h> | ||
| 129 | /* Override the values of <float.h>, like done in float.in.h. */ | ||
| 130 | #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) | ||
| 131 | # undef LDBL_MIN_EXP | ||
| 132 | # define LDBL_MIN_EXP (-16381) | ||
| 133 | #endif | ||
| 134 | #if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) | ||
| 135 | # undef LDBL_MIN_EXP | ||
| 136 | # define LDBL_MIN_EXP (-16381) | ||
| 137 | #endif | ||
| 138 | #if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ | ||
| 139 | # undef LDBL_MIN_EXP | ||
| 140 | # define LDBL_MIN_EXP DBL_MIN_EXP | ||
| 141 | #endif | ||
| 142 | #if defined __sgi && (LDBL_MANT_DIG >= 106) | ||
| 143 | # if defined __GNUC__ | ||
| 144 | # undef LDBL_MIN_EXP | ||
| 145 | # define LDBL_MIN_EXP DBL_MIN_EXP | ||
| 146 | # endif | ||
| 147 | #endif | ||
| 148 | extern | ||
| 149 | #ifdef __cplusplus | ||
| 150 | "C" | ||
| 151 | #endif | ||
| 152 | long double frexpl (long double, int *); | ||
| 153 | long double zero = 0.0L; | ||
| 154 | int main() | ||
| 155 | { | ||
| 156 | int result = 0; | ||
| 157 | volatile long double x; | ||
| 158 | /* Test on finite numbers that fails on AIX 5.1. */ | ||
| 159 | x = 16.0L; | ||
| 160 | { | ||
| 161 | int exp = -9999; | ||
| 162 | frexpl (x, &exp); | ||
| 163 | if (exp != 5) | ||
| 164 | result |= 1; | ||
| 165 | } | ||
| 166 | /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl | ||
| 167 | function returns an invalid (incorrectly normalized) value: it returns | ||
| 168 | y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } | ||
| 169 | but the correct result is | ||
| 170 | 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ | ||
| 171 | x = 1.01L; | ||
| 172 | { | ||
| 173 | int exp = -9999; | ||
| 174 | long double y = frexpl (x, &exp); | ||
| 175 | if (!(exp == 1 && y == 0.505L)) | ||
| 176 | result |= 2; | ||
| 177 | } | ||
| 178 | /* Test on large finite numbers. This fails on BeOS at i = 16322, while | ||
| 179 | LDBL_MAX_EXP = 16384. | ||
| 180 | In the loop end test, we test x against Infinity, rather than comparing | ||
| 181 | i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ | ||
| 182 | { | ||
| 183 | int i; | ||
| 184 | for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) | ||
| 185 | { | ||
| 186 | int exp = -9999; | ||
| 187 | frexpl (x, &exp); | ||
| 188 | if (exp != i) | ||
| 189 | { | ||
| 190 | result |= 4; | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | } | ||
| 195 | /* Test on denormalized numbers. */ | ||
| 196 | { | ||
| 197 | int i; | ||
| 198 | for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) | ||
| 199 | ; | ||
| 200 | if (x > 0.0L) | ||
| 201 | { | ||
| 202 | int exp; | ||
| 203 | long double y = frexpl (x, &exp); | ||
| 204 | /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, | ||
| 205 | exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ | ||
| 206 | if (exp != LDBL_MIN_EXP - 1) | ||
| 207 | result |= 8; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | /* Test on infinite numbers. */ | ||
| 211 | /* The Microsoft MSVC 14 compiler chokes on the expression 1.0 / 0.0. */ | ||
| 212 | x = 1.0L / zero; | ||
| 213 | { | ||
| 214 | int exp; | ||
| 215 | long double y = frexpl (x, &exp); | ||
| 216 | if (y != x) | ||
| 217 | result |= 16; | ||
| 218 | } | ||
| 219 | return result; | ||
| 220 | }]])], | ||
| 221 | [gl_cv_func_frexpl_works=yes], | ||
| 222 | [gl_cv_func_frexpl_works=no], | ||
| 223 | [ | ||
| 224 | changequote(,)dnl | ||
| 225 | case "$host_os" in | ||
| 226 | aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*) | ||
| 227 | gl_cv_func_frexpl_works="guessing no";; | ||
| 228 | *) gl_cv_func_frexpl_works="guessing yes";; | ||
| 229 | esac | ||
| 230 | changequote([,])dnl | ||
| 231 | ]) | ||
| 232 | ]) | ||
| 233 | ]) | ||
diff --git a/m4/fseterr.m4 b/m4/fseterr.m4 deleted file mode 100644 index 61ac03d49d1..00000000000 --- a/m4/fseterr.m4 +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | # fseterr.m4 serial 2 | ||
| 2 | dnl Copyright (C) 2012-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_FSETERR], | ||
| 8 | [ | ||
| 9 | gl_CHECK_FUNCS_ANDROID([__fseterr], | ||
| 10 | [[#include <stdio.h> | ||
| 11 | #include <stdio_ext.h> | ||
| 12 | ]]) | ||
| 13 | ]) | ||
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 4c1e41daf51..72adcf90d5e 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -95,15 +95,10 @@ AC_DEFUN([gl_EARLY], | |||
| 95 | # Code from module filename: | 95 | # Code from module filename: |
| 96 | # Code from module filevercmp: | 96 | # Code from module filevercmp: |
| 97 | # Code from module flexmember: | 97 | # Code from module flexmember: |
| 98 | # Code from module float: | ||
| 99 | # Code from module fpending: | 98 | # Code from module fpending: |
| 100 | # Code from module fpieee: | 99 | # Code from module fpieee: |
| 101 | AC_REQUIRE([gl_FP_IEEE]) | 100 | AC_REQUIRE([gl_FP_IEEE]) |
| 102 | # Code from module fpucw: | ||
| 103 | # Code from module free-posix: | 101 | # Code from module free-posix: |
| 104 | # Code from module frexp-nolibm: | ||
| 105 | # Code from module frexpl-nolibm: | ||
| 106 | # Code from module fseterr: | ||
| 107 | # Code from module fstatat: | 102 | # Code from module fstatat: |
| 108 | # Code from module fsusage: | 103 | # Code from module fsusage: |
| 109 | # Code from module fsync: | 104 | # Code from module fsync: |
| @@ -130,9 +125,6 @@ AC_DEFUN([gl_EARLY], | |||
| 130 | # Code from module include_next: | 125 | # Code from module include_next: |
| 131 | # Code from module intprops: | 126 | # Code from module intprops: |
| 132 | # Code from module inttypes-incomplete: | 127 | # Code from module inttypes-incomplete: |
| 133 | # Code from module isnand-nolibm: | ||
| 134 | # Code from module isnanf-nolibm: | ||
| 135 | # Code from module isnanl-nolibm: | ||
| 136 | # Code from module largefile: | 128 | # Code from module largefile: |
| 137 | AC_REQUIRE([AC_SYS_LARGEFILE]) | 129 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
| 138 | # Code from module lchmod: | 130 | # Code from module lchmod: |
| @@ -143,7 +135,6 @@ AC_DEFUN([gl_EARLY], | |||
| 143 | # Code from module malloc-gnu: | 135 | # Code from module malloc-gnu: |
| 144 | # Code from module malloc-posix: | 136 | # Code from module malloc-posix: |
| 145 | # Code from module manywarnings: | 137 | # Code from module manywarnings: |
| 146 | # Code from module math: | ||
| 147 | # Code from module memmem-simple: | 138 | # Code from module memmem-simple: |
| 148 | # Code from module mempcpy: | 139 | # Code from module mempcpy: |
| 149 | # Code from module memrchr: | 140 | # Code from module memrchr: |
| @@ -161,10 +152,6 @@ AC_DEFUN([gl_EARLY], | |||
| 161 | # Code from module openat-h: | 152 | # Code from module openat-h: |
| 162 | # Code from module pathmax: | 153 | # Code from module pathmax: |
| 163 | # Code from module pipe2: | 154 | # Code from module pipe2: |
| 164 | # Code from module printf-frexp: | ||
| 165 | # Code from module printf-frexpl: | ||
| 166 | # Code from module printf-posix: | ||
| 167 | # Code from module printf-safe: | ||
| 168 | # Code from module pselect: | 155 | # Code from module pselect: |
| 169 | # Code from module pthread_sigmask: | 156 | # Code from module pthread_sigmask: |
| 170 | # Code from module qcopy-acl: | 157 | # Code from module qcopy-acl: |
| @@ -178,8 +165,6 @@ AC_DEFUN([gl_EARLY], | |||
| 178 | # Code from module sig2str: | 165 | # Code from module sig2str: |
| 179 | # Code from module sigdescr_np: | 166 | # Code from module sigdescr_np: |
| 180 | # Code from module signal-h: | 167 | # Code from module signal-h: |
| 181 | # Code from module signbit: | ||
| 182 | # Code from module size_max: | ||
| 183 | # Code from module snippet/_Noreturn: | 168 | # Code from module snippet/_Noreturn: |
| 184 | # Code from module snippet/arg-nonnull: | 169 | # Code from module snippet/arg-nonnull: |
| 185 | # Code from module snippet/c++defs: | 170 | # Code from module snippet/c++defs: |
| @@ -224,15 +209,10 @@ AC_DEFUN([gl_EARLY], | |||
| 224 | # Code from module utimens: | 209 | # Code from module utimens: |
| 225 | # Code from module utimensat: | 210 | # Code from module utimensat: |
| 226 | # Code from module vararrays: | 211 | # Code from module vararrays: |
| 227 | # Code from module vasnprintf: | ||
| 228 | # Code from module vasprintf: | ||
| 229 | # Code from module vasprintf-posix: | ||
| 230 | # Code from module verify: | 212 | # Code from module verify: |
| 231 | # Code from module vfprintf-posix: | ||
| 232 | # Code from module vla: | 213 | # Code from module vla: |
| 233 | # Code from module warnings: | 214 | # Code from module warnings: |
| 234 | # Code from module xalloc-oversized: | 215 | # Code from module xalloc-oversized: |
| 235 | # Code from module xsize: | ||
| 236 | # Code from module year2038: | 216 | # Code from module year2038: |
| 237 | AC_REQUIRE([AC_SYS_YEAR2038]) | 217 | AC_REQUIRE([AC_SYS_YEAR2038]) |
| 238 | ]) | 218 | ]) |
| @@ -342,11 +322,6 @@ AC_DEFUN([gl_INIT], | |||
| 342 | gl_FILE_HAS_ACL | 322 | gl_FILE_HAS_ACL |
| 343 | gl_FILEMODE | 323 | gl_FILEMODE |
| 344 | AC_C_FLEXIBLE_ARRAY_MEMBER | 324 | AC_C_FLEXIBLE_ARRAY_MEMBER |
| 345 | gl_FLOAT_H | ||
| 346 | gl_CONDITIONAL_HEADER([float.h]) | ||
| 347 | AC_PROG_MKDIR_P | ||
| 348 | gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) | ||
| 349 | gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) | ||
| 350 | gl_FUNC_FPENDING | 325 | gl_FUNC_FPENDING |
| 351 | gl_CONDITIONAL([GL_COND_OBJ_FPENDING], [test $gl_cv_func___fpending = no]) | 326 | gl_CONDITIONAL([GL_COND_OBJ_FPENDING], [test $gl_cv_func___fpending = no]) |
| 352 | gl_FUNC_FREE | 327 | gl_FUNC_FREE |
| @@ -355,16 +330,6 @@ AC_DEFUN([gl_INIT], | |||
| 355 | gl_PREREQ_FREE | 330 | gl_PREREQ_FREE |
| 356 | ]) | 331 | ]) |
| 357 | gl_STDLIB_MODULE_INDICATOR([free-posix]) | 332 | gl_STDLIB_MODULE_INDICATOR([free-posix]) |
| 358 | gl_FUNC_FREXP_NO_LIBM | ||
| 359 | if test $gl_func_frexp_no_libm != yes; then | ||
| 360 | AC_LIBOBJ([frexp]) | ||
| 361 | fi | ||
| 362 | gl_MATH_MODULE_INDICATOR([frexp]) | ||
| 363 | gl_FUNC_FREXPL_NO_LIBM | ||
| 364 | if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then | ||
| 365 | AC_LIBOBJ([frexpl]) | ||
| 366 | fi | ||
| 367 | gl_MATH_MODULE_INDICATOR([frexpl]) | ||
| 368 | gl_FUNC_FSTATAT | 333 | gl_FUNC_FSTATAT |
| 369 | gl_CONDITIONAL([GL_COND_OBJ_FSTATAT], | 334 | gl_CONDITIONAL([GL_COND_OBJ_FSTATAT], |
| 370 | [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]) | 335 | [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]) |
| @@ -432,16 +397,6 @@ AC_DEFUN([gl_INIT], | |||
| 432 | gl_INTTYPES_INCOMPLETE | 397 | gl_INTTYPES_INCOMPLETE |
| 433 | gl_INTTYPES_H_REQUIRE_DEFAULTS | 398 | gl_INTTYPES_H_REQUIRE_DEFAULTS |
| 434 | AC_PROG_MKDIR_P | 399 | AC_PROG_MKDIR_P |
| 435 | gl_FUNC_ISNAND_NO_LIBM | ||
| 436 | if test $gl_func_isnand_no_libm != yes; then | ||
| 437 | AC_LIBOBJ([isnand]) | ||
| 438 | gl_PREREQ_ISNAND | ||
| 439 | fi | ||
| 440 | gl_FUNC_ISNANL_NO_LIBM | ||
| 441 | if test $gl_func_isnanl_no_libm != yes; then | ||
| 442 | AC_LIBOBJ([isnanl]) | ||
| 443 | gl_PREREQ_ISNANL | ||
| 444 | fi | ||
| 445 | AC_REQUIRE([gl_LARGEFILE]) | 400 | AC_REQUIRE([gl_LARGEFILE]) |
| 446 | gl___INLINE | 401 | gl___INLINE |
| 447 | gl_LIBGMP | 402 | gl_LIBGMP |
| @@ -457,9 +412,6 @@ AC_DEFUN([gl_INIT], | |||
| 457 | gl_PREREQ_LSTAT | 412 | gl_PREREQ_LSTAT |
| 458 | ]) | 413 | ]) |
| 459 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) | 414 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) |
| 460 | gl_MATH_H | ||
| 461 | gl_MATH_H_REQUIRE_DEFAULTS | ||
| 462 | AC_PROG_MKDIR_P | ||
| 463 | gl_FUNC_MEMMEM_SIMPLE | 415 | gl_FUNC_MEMMEM_SIMPLE |
| 464 | if test $HAVE_MEMMEM = 0 || test $REPLACE_MEMMEM = 1; then | 416 | if test $HAVE_MEMMEM = 0 || test $REPLACE_MEMMEM = 1; then |
| 465 | AC_LIBOBJ([memmem]) | 417 | AC_LIBOBJ([memmem]) |
| @@ -509,11 +461,6 @@ AC_DEFUN([gl_INIT], | |||
| 509 | gl_PATHMAX | 461 | gl_PATHMAX |
| 510 | gl_FUNC_PIPE2 | 462 | gl_FUNC_PIPE2 |
| 511 | gl_UNISTD_MODULE_INDICATOR([pipe2]) | 463 | gl_UNISTD_MODULE_INDICATOR([pipe2]) |
| 512 | gl_FUNC_PRINTF_FREXP | ||
| 513 | gl_FUNC_PRINTF_FREXPL | ||
| 514 | gl_FUNC_PRINTF_POSIX | ||
| 515 | gl_STDIO_MODULE_INDICATOR([printf-posix]) | ||
| 516 | m4_divert_text([INIT_PREPARE], [gl_printf_safe=yes]) | ||
| 517 | gl_FUNC_PSELECT | 464 | gl_FUNC_PSELECT |
| 518 | gl_CONDITIONAL([GL_COND_OBJ_PSELECT], | 465 | gl_CONDITIONAL([GL_COND_OBJ_PSELECT], |
| 519 | [test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1]) | 466 | [test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1]) |
| @@ -560,9 +507,6 @@ AC_DEFUN([gl_INIT], | |||
| 560 | gl_SIGNAL_H | 507 | gl_SIGNAL_H |
| 561 | gl_SIGNAL_H_REQUIRE_DEFAULTS | 508 | gl_SIGNAL_H_REQUIRE_DEFAULTS |
| 562 | AC_PROG_MKDIR_P | 509 | AC_PROG_MKDIR_P |
| 563 | gl_SIGNBIT | ||
| 564 | gl_CONDITIONAL([GL_COND_OBJ_SIGNBIT3], [test $REPLACE_SIGNBIT = 1]) | ||
| 565 | gl_MATH_MODULE_INDICATOR([signbit]) | ||
| 566 | gl_TYPE_SOCKLEN_T | 510 | gl_TYPE_SOCKLEN_T |
| 567 | gt_TYPE_SSIZE_T | 511 | gt_TYPE_SSIZE_T |
| 568 | gl_STAT_TIME | 512 | gl_STAT_TIME |
| @@ -709,18 +653,11 @@ AC_DEFUN([gl_INIT], | |||
| 709 | [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]) | 653 | [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]) |
| 710 | gl_SYS_STAT_MODULE_INDICATOR([utimensat]) | 654 | gl_SYS_STAT_MODULE_INDICATOR([utimensat]) |
| 711 | AC_C_VARARRAYS | 655 | AC_C_VARARRAYS |
| 712 | gl_FUNC_VASPRINTF | ||
| 713 | gl_STDIO_MODULE_INDICATOR([vasprintf]) | ||
| 714 | m4_ifdef([AM_XGETTEXT_OPTION], | ||
| 715 | [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format]) | ||
| 716 | AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) | ||
| 717 | gl_FUNC_VASPRINTF_POSIX | ||
| 718 | gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false | 656 | gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false |
| 719 | gl_gnulib_enabled_cloexec=false | 657 | gl_gnulib_enabled_cloexec=false |
| 720 | gl_gnulib_enabled_dirfd=false | 658 | gl_gnulib_enabled_dirfd=false |
| 721 | gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c=false | 659 | gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c=false |
| 722 | gl_gnulib_enabled_euidaccess=false | 660 | gl_gnulib_enabled_euidaccess=false |
| 723 | gl_gnulib_enabled_fseterr=false | ||
| 724 | gl_gnulib_enabled_getdelim=false | 661 | gl_gnulib_enabled_getdelim=false |
| 725 | gl_gnulib_enabled_getdtablesize=false | 662 | gl_gnulib_enabled_getdtablesize=false |
| 726 | gl_gnulib_enabled_getgroups=false | 663 | gl_gnulib_enabled_getgroups=false |
| @@ -728,7 +665,6 @@ AC_DEFUN([gl_INIT], | |||
| 728 | gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c=false | 665 | gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c=false |
| 729 | gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=false | 666 | gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=false |
| 730 | gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false | 667 | gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false |
| 731 | gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66=false | ||
| 732 | gl_gnulib_enabled_lchmod=false | 668 | gl_gnulib_enabled_lchmod=false |
| 733 | gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b=false | 669 | gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b=false |
| 734 | gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=false | 670 | gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=false |
| @@ -739,13 +675,9 @@ AC_DEFUN([gl_INIT], | |||
| 739 | gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=false | 675 | gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=false |
| 740 | gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=false | 676 | gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=false |
| 741 | gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false | 677 | gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false |
| 742 | gl_gnulib_enabled_size_max=false | ||
| 743 | gl_gnulib_enabled_strtoll=false | 678 | gl_gnulib_enabled_strtoll=false |
| 744 | gl_gnulib_enabled_utimens=false | 679 | gl_gnulib_enabled_utimens=false |
| 745 | gl_gnulib_enabled_vasnprintf=false | ||
| 746 | gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b=false | ||
| 747 | gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false | 680 | gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false |
| 748 | gl_gnulib_enabled_xsize=false | ||
| 749 | func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b () | 681 | func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b () |
| 750 | { | 682 | { |
| 751 | if $gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b; then :; else | 683 | if $gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b; then :; else |
| @@ -798,14 +730,6 @@ AC_DEFUN([gl_INIT], | |||
| 798 | func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c | 730 | func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c |
| 799 | fi | 731 | fi |
| 800 | } | 732 | } |
| 801 | func_gl_gnulib_m4code_fseterr () | ||
| 802 | { | ||
| 803 | if $gl_gnulib_enabled_fseterr; then :; else | ||
| 804 | gl_FUNC_FSETERR | ||
| 805 | gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no]) | ||
| 806 | gl_gnulib_enabled_fseterr=true | ||
| 807 | fi | ||
| 808 | } | ||
| 809 | func_gl_gnulib_m4code_getdelim () | 733 | func_gl_gnulib_m4code_getdelim () |
| 810 | { | 734 | { |
| 811 | if $gl_gnulib_enabled_getdelim; then :; else | 735 | if $gl_gnulib_enabled_getdelim; then :; else |
| @@ -887,17 +811,6 @@ AC_DEFUN([gl_INIT], | |||
| 887 | fi | 811 | fi |
| 888 | fi | 812 | fi |
| 889 | } | 813 | } |
| 890 | func_gl_gnulib_m4code_3f0e593033d1fc2c127581960f641b66 () | ||
| 891 | { | ||
| 892 | if $gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66; then :; else | ||
| 893 | gl_FUNC_ISNANF_NO_LIBM | ||
| 894 | if test $gl_func_isnanf_no_libm != yes; then | ||
| 895 | AC_LIBOBJ([isnanf]) | ||
| 896 | gl_PREREQ_ISNANF | ||
| 897 | fi | ||
| 898 | gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66=true | ||
| 899 | fi | ||
| 900 | } | ||
| 901 | func_gl_gnulib_m4code_lchmod () | 814 | func_gl_gnulib_m4code_lchmod () |
| 902 | { | 815 | { |
| 903 | if $gl_gnulib_enabled_lchmod; then :; else | 816 | if $gl_gnulib_enabled_lchmod; then :; else |
| @@ -1024,13 +937,6 @@ AC_DEFUN([gl_INIT], | |||
| 1024 | gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true | 937 | gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true |
| 1025 | fi | 938 | fi |
| 1026 | } | 939 | } |
| 1027 | func_gl_gnulib_m4code_size_max () | ||
| 1028 | { | ||
| 1029 | if $gl_gnulib_enabled_size_max; then :; else | ||
| 1030 | gl_SIZE_MAX | ||
| 1031 | gl_gnulib_enabled_size_max=true | ||
| 1032 | fi | ||
| 1033 | } | ||
| 1034 | func_gl_gnulib_m4code_strtoll () | 940 | func_gl_gnulib_m4code_strtoll () |
| 1035 | { | 941 | { |
| 1036 | if $gl_gnulib_enabled_strtoll; then :; else | 942 | if $gl_gnulib_enabled_strtoll; then :; else |
| @@ -1051,44 +957,12 @@ AC_DEFUN([gl_INIT], | |||
| 1051 | gl_gnulib_enabled_utimens=true | 957 | gl_gnulib_enabled_utimens=true |
| 1052 | fi | 958 | fi |
| 1053 | } | 959 | } |
| 1054 | func_gl_gnulib_m4code_vasnprintf () | ||
| 1055 | { | ||
| 1056 | if $gl_gnulib_enabled_vasnprintf; then :; else | ||
| 1057 | AC_REQUIRE([AC_C_RESTRICT]) | ||
| 1058 | gl_FUNC_VASNPRINTF | ||
| 1059 | gl_gnulib_enabled_vasnprintf=true | ||
| 1060 | func_gl_gnulib_m4code_xsize | ||
| 1061 | fi | ||
| 1062 | } | ||
| 1063 | func_gl_gnulib_m4code_ed5616be3593d355b981ffab56b9f37b () | ||
| 1064 | { | ||
| 1065 | if $gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b; then :; else | ||
| 1066 | gl_FUNC_VFPRINTF_POSIX | ||
| 1067 | gl_STDIO_MODULE_INDICATOR([vfprintf-posix]) | ||
| 1068 | gl_MODULE_INDICATOR([vfprintf-posix]) | ||
| 1069 | gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b=true | ||
| 1070 | if test $REPLACE_VFPRINTF = 1; then | ||
| 1071 | func_gl_gnulib_m4code_fseterr | ||
| 1072 | fi | ||
| 1073 | if test $REPLACE_VFPRINTF = 1; then | ||
| 1074 | func_gl_gnulib_m4code_vasnprintf | ||
| 1075 | fi | ||
| 1076 | fi | ||
| 1077 | } | ||
| 1078 | func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec () | 960 | func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec () |
| 1079 | { | 961 | { |
| 1080 | if $gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec; then :; else | 962 | if $gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec; then :; else |
| 1081 | gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true | 963 | gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true |
| 1082 | fi | 964 | fi |
| 1083 | } | 965 | } |
| 1084 | func_gl_gnulib_m4code_xsize () | ||
| 1085 | { | ||
| 1086 | if $gl_gnulib_enabled_xsize; then :; else | ||
| 1087 | gl_XSIZE | ||
| 1088 | gl_gnulib_enabled_xsize=true | ||
| 1089 | func_gl_gnulib_m4code_size_max | ||
| 1090 | fi | ||
| 1091 | } | ||
| 1092 | if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then | 966 | if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then |
| 1093 | func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c | 967 | func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c |
| 1094 | fi | 968 | fi |
| @@ -1146,9 +1020,6 @@ AC_DEFUN([gl_INIT], | |||
| 1146 | if case $host_os in mingw*) false;; *) test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1;; esac; then | 1020 | if case $host_os in mingw*) false;; *) test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1;; esac; then |
| 1147 | func_gl_gnulib_m4code_open | 1021 | func_gl_gnulib_m4code_open |
| 1148 | fi | 1022 | fi |
| 1149 | if test $REPLACE_PRINTF = 1; then | ||
| 1150 | func_gl_gnulib_m4code_ed5616be3593d355b981ffab56b9f37b | ||
| 1151 | fi | ||
| 1152 | if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then | 1023 | if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then |
| 1153 | func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b | 1024 | func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b |
| 1154 | fi | 1025 | fi |
| @@ -1158,9 +1029,6 @@ AC_DEFUN([gl_INIT], | |||
| 1158 | if test $ac_use_included_regex = yes; then | 1029 | if test $ac_use_included_regex = yes; then |
| 1159 | func_gl_gnulib_m4code_fd38c7e463b54744b77b98aeafb4fa7c | 1030 | func_gl_gnulib_m4code_fd38c7e463b54744b77b98aeafb4fa7c |
| 1160 | fi | 1031 | fi |
| 1161 | if test $REPLACE_SIGNBIT = 1; then | ||
| 1162 | func_gl_gnulib_m4code_3f0e593033d1fc2c127581960f641b66 | ||
| 1163 | fi | ||
| 1164 | if { test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then | 1032 | if { test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then |
| 1165 | func_gl_gnulib_m4code_strtoll | 1033 | func_gl_gnulib_m4code_strtoll |
| 1166 | fi | 1034 | fi |
| @@ -1176,19 +1044,12 @@ AC_DEFUN([gl_INIT], | |||
| 1176 | if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then | 1044 | if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then |
| 1177 | func_gl_gnulib_m4code_utimens | 1045 | func_gl_gnulib_m4code_utimens |
| 1178 | fi | 1046 | fi |
| 1179 | if test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1; then | ||
| 1180 | func_gl_gnulib_m4code_vasnprintf | ||
| 1181 | fi | ||
| 1182 | if test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1; then | ||
| 1183 | func_gl_gnulib_m4code_vasnprintf | ||
| 1184 | fi | ||
| 1185 | m4_pattern_allow([^gl_GNULIB_ENABLED_]) | 1047 | m4_pattern_allow([^gl_GNULIB_ENABLED_]) |
| 1186 | AM_CONDITIONAL([gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b], [$gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b]) | 1048 | AM_CONDITIONAL([gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b], [$gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b]) |
| 1187 | AM_CONDITIONAL([gl_GNULIB_ENABLED_cloexec], [$gl_gnulib_enabled_cloexec]) | 1049 | AM_CONDITIONAL([gl_GNULIB_ENABLED_cloexec], [$gl_gnulib_enabled_cloexec]) |
| 1188 | AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd]) | 1050 | AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd]) |
| 1189 | AM_CONDITIONAL([gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c], [$gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c]) | 1051 | AM_CONDITIONAL([gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c], [$gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c]) |
| 1190 | AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess]) | 1052 | AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess]) |
| 1191 | AM_CONDITIONAL([gl_GNULIB_ENABLED_fseterr], [$gl_gnulib_enabled_fseterr]) | ||
| 1192 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getdelim], [$gl_gnulib_enabled_getdelim]) | 1053 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getdelim], [$gl_gnulib_enabled_getdelim]) |
| 1193 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize]) | 1054 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize]) |
| 1194 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups]) | 1055 | AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups]) |
| @@ -1196,7 +1057,6 @@ AC_DEFUN([gl_INIT], | |||
| 1196 | AM_CONDITIONAL([gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c], [$gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c]) | 1057 | AM_CONDITIONAL([gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c], [$gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c]) |
| 1197 | AM_CONDITIONAL([gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9], [$gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9]) | 1058 | AM_CONDITIONAL([gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9], [$gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9]) |
| 1198 | AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) | 1059 | AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) |
| 1199 | AM_CONDITIONAL([gl_GNULIB_ENABLED_3f0e593033d1fc2c127581960f641b66], [$gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66]) | ||
| 1200 | AM_CONDITIONAL([gl_GNULIB_ENABLED_lchmod], [$gl_gnulib_enabled_lchmod]) | 1060 | AM_CONDITIONAL([gl_GNULIB_ENABLED_lchmod], [$gl_gnulib_enabled_lchmod]) |
| 1201 | AM_CONDITIONAL([gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b], [$gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b]) | 1061 | AM_CONDITIONAL([gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b], [$gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b]) |
| 1202 | AM_CONDITIONAL([gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866], [$gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866]) | 1062 | AM_CONDITIONAL([gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866], [$gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866]) |
| @@ -1207,13 +1067,9 @@ AC_DEFUN([gl_INIT], | |||
| 1207 | AM_CONDITIONAL([gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b], [$gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b]) | 1067 | AM_CONDITIONAL([gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b], [$gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b]) |
| 1208 | AM_CONDITIONAL([gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4], [$gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4]) | 1068 | AM_CONDITIONAL([gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4], [$gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4]) |
| 1209 | AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) | 1069 | AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) |
| 1210 | AM_CONDITIONAL([gl_GNULIB_ENABLED_size_max], [$gl_gnulib_enabled_size_max]) | ||
| 1211 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) | 1070 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) |
| 1212 | AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens]) | 1071 | AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens]) |
| 1213 | AM_CONDITIONAL([gl_GNULIB_ENABLED_vasnprintf], [$gl_gnulib_enabled_vasnprintf]) | ||
| 1214 | AM_CONDITIONAL([gl_GNULIB_ENABLED_ed5616be3593d355b981ffab56b9f37b], [$gl_gnulib_enabled_ed5616be3593d355b981ffab56b9f37b]) | ||
| 1215 | AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], [$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec]) | 1072 | AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], [$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec]) |
| 1216 | AM_CONDITIONAL([gl_GNULIB_ENABLED_xsize], [$gl_gnulib_enabled_xsize]) | ||
| 1217 | # End of code from modules | 1073 | # End of code from modules |
| 1218 | m4_ifval(gl_LIBSOURCES_LIST, [ | 1074 | m4_ifval(gl_LIBSOURCES_LIST, [ |
| 1219 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || | 1075 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || |
| @@ -1399,8 +1255,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1399 | lib/allocator.c | 1255 | lib/allocator.c |
| 1400 | lib/allocator.h | 1256 | lib/allocator.h |
| 1401 | lib/arg-nonnull.h | 1257 | lib/arg-nonnull.h |
| 1402 | lib/asnprintf.c | ||
| 1403 | lib/asprintf.c | ||
| 1404 | lib/assert.in.h | 1258 | lib/assert.in.h |
| 1405 | lib/at-func.c | 1259 | lib/at-func.c |
| 1406 | lib/attribute.h | 1260 | lib/attribute.h |
| @@ -1453,17 +1307,9 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1453 | lib/filevercmp.c | 1307 | lib/filevercmp.c |
| 1454 | lib/filevercmp.h | 1308 | lib/filevercmp.h |
| 1455 | lib/flexmember.h | 1309 | lib/flexmember.h |
| 1456 | lib/float+.h | ||
| 1457 | lib/float.c | ||
| 1458 | lib/float.in.h | ||
| 1459 | lib/fpending.c | 1310 | lib/fpending.c |
| 1460 | lib/fpending.h | 1311 | lib/fpending.h |
| 1461 | lib/fpucw.h | ||
| 1462 | lib/free.c | 1312 | lib/free.c |
| 1463 | lib/frexp.c | ||
| 1464 | lib/frexpl.c | ||
| 1465 | lib/fseterr.c | ||
| 1466 | lib/fseterr.h | ||
| 1467 | lib/fstatat.c | 1313 | lib/fstatat.c |
| 1468 | lib/fsusage.c | 1314 | lib/fsusage.c |
| 1469 | lib/fsusage.h | 1315 | lib/fsusage.h |
| @@ -1498,14 +1344,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1498 | lib/intprops-internal.h | 1344 | lib/intprops-internal.h |
| 1499 | lib/intprops.h | 1345 | lib/intprops.h |
| 1500 | lib/inttypes.in.h | 1346 | lib/inttypes.in.h |
| 1501 | lib/isnan.c | ||
| 1502 | lib/isnand-nolibm.h | ||
| 1503 | lib/isnand.c | ||
| 1504 | lib/isnanf-nolibm.h | ||
| 1505 | lib/isnanf.c | ||
| 1506 | lib/isnanl-nolibm.h | ||
| 1507 | lib/isnanl.c | ||
| 1508 | lib/itold.c | ||
| 1509 | lib/lchmod.c | 1347 | lib/lchmod.c |
| 1510 | lib/libc-config.h | 1348 | lib/libc-config.h |
| 1511 | lib/limits.in.h | 1349 | lib/limits.in.h |
| @@ -1522,8 +1360,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1522 | lib/malloc/scratch_buffer_grow.c | 1360 | lib/malloc/scratch_buffer_grow.c |
| 1523 | lib/malloc/scratch_buffer_grow_preserve.c | 1361 | lib/malloc/scratch_buffer_grow_preserve.c |
| 1524 | lib/malloc/scratch_buffer_set_array_size.c | 1362 | lib/malloc/scratch_buffer_set_array_size.c |
| 1525 | lib/math.c | ||
| 1526 | lib/math.in.h | ||
| 1527 | lib/md5-stream.c | 1363 | lib/md5-stream.c |
| 1528 | lib/md5.c | 1364 | lib/md5.c |
| 1529 | lib/md5.h | 1365 | lib/md5.h |
| @@ -1548,15 +1384,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1548 | lib/openat.h | 1384 | lib/openat.h |
| 1549 | lib/pathmax.h | 1385 | lib/pathmax.h |
| 1550 | lib/pipe2.c | 1386 | lib/pipe2.c |
| 1551 | lib/printf-args.c | ||
| 1552 | lib/printf-args.h | ||
| 1553 | lib/printf-frexp.c | ||
| 1554 | lib/printf-frexp.h | ||
| 1555 | lib/printf-frexpl.c | ||
| 1556 | lib/printf-frexpl.h | ||
| 1557 | lib/printf-parse.c | ||
| 1558 | lib/printf-parse.h | ||
| 1559 | lib/printf.c | ||
| 1560 | lib/pselect.c | 1387 | lib/pselect.c |
| 1561 | lib/pthread_sigmask.c | 1388 | lib/pthread_sigmask.c |
| 1562 | lib/qcopy-acl.c | 1389 | lib/qcopy-acl.c |
| @@ -1584,10 +1411,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1584 | lib/sig2str.h | 1411 | lib/sig2str.h |
| 1585 | lib/sigdescr_np.c | 1412 | lib/sigdescr_np.c |
| 1586 | lib/signal.in.h | 1413 | lib/signal.in.h |
| 1587 | lib/signbitd.c | ||
| 1588 | lib/signbitf.c | ||
| 1589 | lib/signbitl.c | ||
| 1590 | lib/size_max.h | ||
| 1591 | lib/stat-time.c | 1414 | lib/stat-time.c |
| 1592 | lib/stat-time.h | 1415 | lib/stat-time.h |
| 1593 | lib/stdckdint.in.h | 1416 | lib/stdckdint.in.h |
| @@ -1632,22 +1455,15 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1632 | lib/utimens.c | 1455 | lib/utimens.c |
| 1633 | lib/utimens.h | 1456 | lib/utimens.h |
| 1634 | lib/utimensat.c | 1457 | lib/utimensat.c |
| 1635 | lib/vasnprintf.c | ||
| 1636 | lib/vasnprintf.h | ||
| 1637 | lib/vasprintf.c | ||
| 1638 | lib/verify.h | 1458 | lib/verify.h |
| 1639 | lib/vfprintf.c | ||
| 1640 | lib/vla.h | 1459 | lib/vla.h |
| 1641 | lib/warn-on-use.h | 1460 | lib/warn-on-use.h |
| 1642 | lib/xalloc-oversized.h | 1461 | lib/xalloc-oversized.h |
| 1643 | lib/xsize.c | ||
| 1644 | lib/xsize.h | ||
| 1645 | m4/00gnulib.m4 | 1462 | m4/00gnulib.m4 |
| 1646 | m4/__inline.m4 | 1463 | m4/__inline.m4 |
| 1647 | m4/absolute-header.m4 | 1464 | m4/absolute-header.m4 |
| 1648 | m4/acl.m4 | 1465 | m4/acl.m4 |
| 1649 | m4/alloca.m4 | 1466 | m4/alloca.m4 |
| 1650 | m4/asm-underscore.m4 | ||
| 1651 | m4/assert_h.m4 | 1467 | m4/assert_h.m4 |
| 1652 | m4/builtin-expect.m4 | 1468 | m4/builtin-expect.m4 |
| 1653 | m4/byteswap.m4 | 1469 | m4/byteswap.m4 |
| @@ -1666,9 +1482,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1666 | m4/errno_h.m4 | 1482 | m4/errno_h.m4 |
| 1667 | m4/euidaccess.m4 | 1483 | m4/euidaccess.m4 |
| 1668 | m4/execinfo.m4 | 1484 | m4/execinfo.m4 |
| 1669 | m4/exponentd.m4 | ||
| 1670 | m4/exponentf.m4 | ||
| 1671 | m4/exponentl.m4 | ||
| 1672 | m4/extensions.m4 | 1485 | m4/extensions.m4 |
| 1673 | m4/extern-inline.m4 | 1486 | m4/extern-inline.m4 |
| 1674 | m4/faccessat.m4 | 1487 | m4/faccessat.m4 |
| @@ -1679,13 +1492,9 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1679 | m4/fdopendir.m4 | 1492 | m4/fdopendir.m4 |
| 1680 | m4/filemode.m4 | 1493 | m4/filemode.m4 |
| 1681 | m4/flexmember.m4 | 1494 | m4/flexmember.m4 |
| 1682 | m4/float_h.m4 | ||
| 1683 | m4/fpending.m4 | 1495 | m4/fpending.m4 |
| 1684 | m4/fpieee.m4 | 1496 | m4/fpieee.m4 |
| 1685 | m4/free.m4 | 1497 | m4/free.m4 |
| 1686 | m4/frexp.m4 | ||
| 1687 | m4/frexpl.m4 | ||
| 1688 | m4/fseterr.m4 | ||
| 1689 | m4/fstatat.m4 | 1498 | m4/fstatat.m4 |
| 1690 | m4/fsusage.m4 | 1499 | m4/fsusage.m4 |
| 1691 | m4/fsync.m4 | 1500 | m4/fsync.m4 |
| @@ -1704,15 +1513,9 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1704 | m4/group-member.m4 | 1513 | m4/group-member.m4 |
| 1705 | m4/ieee754-h.m4 | 1514 | m4/ieee754-h.m4 |
| 1706 | m4/include_next.m4 | 1515 | m4/include_next.m4 |
| 1707 | m4/intmax_t.m4 | ||
| 1708 | m4/inttypes.m4 | 1516 | m4/inttypes.m4 |
| 1709 | m4/inttypes_h.m4 | ||
| 1710 | m4/isnand.m4 | ||
| 1711 | m4/isnanf.m4 | ||
| 1712 | m4/isnanl.m4 | ||
| 1713 | m4/largefile.m4 | 1517 | m4/largefile.m4 |
| 1714 | m4/lchmod.m4 | 1518 | m4/lchmod.m4 |
| 1715 | m4/ldexpl.m4 | ||
| 1716 | m4/libgmp.m4 | 1519 | m4/libgmp.m4 |
| 1717 | m4/limits-h.m4 | 1520 | m4/limits-h.m4 |
| 1718 | m4/locale-fr.m4 | 1521 | m4/locale-fr.m4 |
| @@ -1720,7 +1523,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1720 | m4/malloc.m4 | 1523 | m4/malloc.m4 |
| 1721 | m4/manywarnings-c++.m4 | 1524 | m4/manywarnings-c++.m4 |
| 1722 | m4/manywarnings.m4 | 1525 | m4/manywarnings.m4 |
| 1723 | m4/math_h.m4 | ||
| 1724 | m4/mbstate_t.m4 | 1526 | m4/mbstate_t.m4 |
| 1725 | m4/md5.m4 | 1527 | m4/md5.m4 |
| 1726 | m4/memmem.m4 | 1528 | m4/memmem.m4 |
| @@ -1744,10 +1546,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1744 | m4/pathmax.m4 | 1546 | m4/pathmax.m4 |
| 1745 | m4/pid_t.m4 | 1547 | m4/pid_t.m4 |
| 1746 | m4/pipe2.m4 | 1548 | m4/pipe2.m4 |
| 1747 | m4/printf-frexp.m4 | ||
| 1748 | m4/printf-frexpl.m4 | ||
| 1749 | m4/printf-posix.m4 | ||
| 1750 | m4/printf.m4 | ||
| 1751 | m4/pselect.m4 | 1549 | m4/pselect.m4 |
| 1752 | m4/pthread_sigmask.m4 | 1550 | m4/pthread_sigmask.m4 |
| 1753 | m4/rawmemchr.m4 | 1551 | m4/rawmemchr.m4 |
| @@ -1761,8 +1559,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1761 | m4/sig2str.m4 | 1559 | m4/sig2str.m4 |
| 1762 | m4/sigdescr_np.m4 | 1560 | m4/sigdescr_np.m4 |
| 1763 | m4/signal_h.m4 | 1561 | m4/signal_h.m4 |
| 1764 | m4/signbit.m4 | ||
| 1765 | m4/size_max.m4 | ||
| 1766 | m4/socklen.m4 | 1562 | m4/socklen.m4 |
| 1767 | m4/ssize_t.m4 | 1563 | m4/ssize_t.m4 |
| 1768 | m4/stat-time.m4 | 1564 | m4/stat-time.m4 |
| @@ -1770,7 +1566,6 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1770 | m4/stdalign.m4 | 1566 | m4/stdalign.m4 |
| 1771 | m4/stddef_h.m4 | 1567 | m4/stddef_h.m4 |
| 1772 | m4/stdint.m4 | 1568 | m4/stdint.m4 |
| 1773 | m4/stdint_h.m4 | ||
| 1774 | m4/stdio_h.m4 | 1569 | m4/stdio_h.m4 |
| 1775 | m4/stdlib_h.m4 | 1570 | m4/stdlib_h.m4 |
| 1776 | m4/stpcpy.m4 | 1571 | m4/stpcpy.m4 |
| @@ -1800,15 +1595,10 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1800 | m4/utimensat.m4 | 1595 | m4/utimensat.m4 |
| 1801 | m4/utimes.m4 | 1596 | m4/utimes.m4 |
| 1802 | m4/vararrays.m4 | 1597 | m4/vararrays.m4 |
| 1803 | m4/vasnprintf.m4 | ||
| 1804 | m4/vasprintf-posix.m4 | ||
| 1805 | m4/vasprintf.m4 | ||
| 1806 | m4/vfprintf-posix.m4 | ||
| 1807 | m4/warn-on-use.m4 | 1598 | m4/warn-on-use.m4 |
| 1808 | m4/warnings.m4 | 1599 | m4/warnings.m4 |
| 1809 | m4/wchar_t.m4 | 1600 | m4/wchar_t.m4 |
| 1810 | m4/wint_t.m4 | 1601 | m4/wint_t.m4 |
| 1811 | m4/xattr.m4 | 1602 | m4/xattr.m4 |
| 1812 | m4/xsize.m4 | ||
| 1813 | m4/zzgnulib.m4 | 1603 | m4/zzgnulib.m4 |
| 1814 | ]) | 1604 | ]) |
diff --git a/m4/intmax_t.m4 b/m4/intmax_t.m4 deleted file mode 100644 index ef32e1b9ca9..00000000000 --- a/m4/intmax_t.m4 +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | # intmax_t.m4 serial 9 | ||
| 2 | dnl Copyright (C) 1997-2004, 2006-2007, 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 | dnl From Paul Eggert. | ||
| 9 | |||
| 10 | AC_PREREQ([2.53]) | ||
| 11 | |||
| 12 | # Define intmax_t to 'long' or 'long long' | ||
| 13 | # if it is not already defined in <stdint.h> or <inttypes.h>. | ||
| 14 | |||
| 15 | AC_DEFUN([gl_AC_TYPE_INTMAX_T], | ||
| 16 | [ | ||
| 17 | dnl For simplicity, we assume that a header file defines 'intmax_t' if and | ||
| 18 | dnl only if it defines 'uintmax_t'. | ||
| 19 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_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 | ||
| 22 | AC_DEFINE_UNQUOTED([intmax_t], [long long], | ||
| 23 | [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) | ||
| 24 | else | ||
| 25 | AC_DEFINE([HAVE_INTMAX_T], [1], | ||
| 26 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
| 27 | fi | ||
| 28 | ]) | ||
| 29 | |||
| 30 | dnl An alternative would be to explicitly test for 'intmax_t'. | ||
| 31 | |||
| 32 | AC_DEFUN([gt_AC_TYPE_INTMAX_T], | ||
| 33 | [ | ||
| 34 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
| 35 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
| 36 | AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], | ||
| 37 | [AC_COMPILE_IFELSE( | ||
| 38 | [AC_LANG_PROGRAM( | ||
| 39 | [[ | ||
| 40 | #include <stddef.h> | ||
| 41 | #include <stdlib.h> | ||
| 42 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
| 43 | #include <stdint.h> | ||
| 44 | #endif | ||
| 45 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 46 | #include <inttypes.h> | ||
| 47 | #endif | ||
| 48 | ]], | ||
| 49 | [[intmax_t x = -1; return !x;]])], | ||
| 50 | [gt_cv_c_intmax_t=yes], | ||
| 51 | [gt_cv_c_intmax_t=no])]) | ||
| 52 | if test $gt_cv_c_intmax_t = yes; then | ||
| 53 | AC_DEFINE([HAVE_INTMAX_T], [1], | ||
| 54 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
| 55 | else | ||
| 56 | AC_DEFINE_UNQUOTED([intmax_t], [long long], | ||
| 57 | [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) | ||
| 58 | fi | ||
| 59 | ]) | ||
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 deleted file mode 100644 index 68c60e9dbb6..00000000000 --- a/m4/inttypes_h.m4 +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | # inttypes_h.m4 serial 10 | ||
| 2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Paul Eggert. | ||
| 8 | |||
| 9 | # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, | ||
| 10 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | ||
| 11 | |||
| 12 | AC_DEFUN([gl_AC_HEADER_INTTYPES_H], | ||
| 13 | [ | ||
| 14 | AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], | ||
| 15 | [AC_COMPILE_IFELSE( | ||
| 16 | [AC_LANG_PROGRAM( | ||
| 17 | [[ | ||
| 18 | #include <sys/types.h> | ||
| 19 | #include <inttypes.h> | ||
| 20 | ]], | ||
| 21 | [[uintmax_t i = (uintmax_t) -1; return !i;]])], | ||
| 22 | [gl_cv_header_inttypes_h=yes], | ||
| 23 | [gl_cv_header_inttypes_h=no])]) | ||
| 24 | if test $gl_cv_header_inttypes_h = yes; then | ||
| 25 | AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], | ||
| 26 | [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, | ||
| 27 | and declares uintmax_t. ]) | ||
| 28 | fi | ||
| 29 | ]) | ||
diff --git a/m4/isnand.m4 b/m4/isnand.m4 deleted file mode 100644 index 95346f420b7..00000000000 --- a/m4/isnand.m4 +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | # isnand.m4 serial 12 | ||
| 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 Check how to get or define isnand(). | ||
| 8 | |||
| 9 | AC_DEFUN([gl_FUNC_ISNAND], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 12 | ISNAND_LIBM= | ||
| 13 | gl_HAVE_ISNAND_NO_LIBM | ||
| 14 | if test $gl_cv_func_isnand_no_libm = no; then | ||
| 15 | gl_HAVE_ISNAND_IN_LIBM | ||
| 16 | if test $gl_cv_func_isnand_in_libm = yes; then | ||
| 17 | ISNAND_LIBM=-lm | ||
| 18 | fi | ||
| 19 | fi | ||
| 20 | dnl The variable gl_func_isnand set here is used by isnan.m4. | ||
| 21 | if test $gl_cv_func_isnand_no_libm = yes \ | ||
| 22 | || test $gl_cv_func_isnand_in_libm = yes; then | ||
| 23 | gl_func_isnand=yes | ||
| 24 | else | ||
| 25 | gl_func_isnand=no | ||
| 26 | HAVE_ISNAND=0 | ||
| 27 | fi | ||
| 28 | AC_SUBST([ISNAND_LIBM]) | ||
| 29 | ]) | ||
| 30 | |||
| 31 | dnl Check how to get or define isnand() without linking with libm. | ||
| 32 | |||
| 33 | AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM], | ||
| 34 | [ | ||
| 35 | gl_HAVE_ISNAND_NO_LIBM | ||
| 36 | gl_func_isnand_no_libm=$gl_cv_func_isnand_no_libm | ||
| 37 | if test $gl_cv_func_isnand_no_libm = yes; then | ||
| 38 | AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1], | ||
| 39 | [Define if the isnan(double) function is available in libc.]) | ||
| 40 | fi | ||
| 41 | ]) | ||
| 42 | |||
| 43 | dnl Prerequisites of replacement isnand definition. It does not need -lm. | ||
| 44 | AC_DEFUN([gl_PREREQ_ISNAND], | ||
| 45 | [ | ||
| 46 | AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) | ||
| 47 | ]) | ||
| 48 | |||
| 49 | dnl Test whether isnand() can be used with libm. | ||
| 50 | |||
| 51 | AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM], | ||
| 52 | [ | ||
| 53 | AC_CACHE_CHECK([whether isnan(double) can be used with libm], | ||
| 54 | [gl_cv_func_isnand_in_libm], | ||
| 55 | [ | ||
| 56 | save_LIBS="$LIBS" | ||
| 57 | LIBS="$LIBS -lm" | ||
| 58 | AC_LINK_IFELSE( | ||
| 59 | [AC_LANG_PROGRAM( | ||
| 60 | [[#include <math.h> | ||
| 61 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 62 | # undef isnand | ||
| 63 | # define isnand(x) __builtin_isnan ((double)(x)) | ||
| 64 | #elif defined isnan | ||
| 65 | # undef isnand | ||
| 66 | # define isnand(x) isnan ((double)(x)) | ||
| 67 | #endif | ||
| 68 | double x;]], | ||
| 69 | [[return isnand (x);]])], | ||
| 70 | [gl_cv_func_isnand_in_libm=yes], | ||
| 71 | [gl_cv_func_isnand_in_libm=no]) | ||
| 72 | LIBS="$save_LIBS" | ||
| 73 | ]) | ||
| 74 | ]) | ||
| 75 | |||
| 76 | AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM], | ||
| 77 | [ | ||
| 78 | AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm], | ||
| 79 | [gl_cv_func_isnand_no_libm], | ||
| 80 | [ | ||
| 81 | AC_LINK_IFELSE( | ||
| 82 | [AC_LANG_PROGRAM( | ||
| 83 | [[#include <math.h> | ||
| 84 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 85 | # undef isnand | ||
| 86 | # define isnand(x) __builtin_isnan ((double)(x)) | ||
| 87 | #else | ||
| 88 | # undef isnand | ||
| 89 | # define isnand(x) isnan ((double)(x)) | ||
| 90 | #endif | ||
| 91 | double x;]], | ||
| 92 | [[return isnand (x);]])], | ||
| 93 | [gl_cv_func_isnand_no_libm=yes], | ||
| 94 | [gl_cv_func_isnand_no_libm=no]) | ||
| 95 | ]) | ||
| 96 | ]) | ||
diff --git a/m4/isnanf.m4 b/m4/isnanf.m4 deleted file mode 100644 index 01f7bbd20d8..00000000000 --- a/m4/isnanf.m4 +++ /dev/null | |||
| @@ -1,197 +0,0 @@ | |||
| 1 | # isnanf.m4 serial 18 | ||
| 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 Check how to get or define isnanf(). | ||
| 8 | |||
| 9 | AC_DEFUN([gl_FUNC_ISNANF], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 12 | ISNANF_LIBM= | ||
| 13 | gl_HAVE_ISNANF_NO_LIBM | ||
| 14 | if test $gl_cv_func_isnanf_no_libm = no; then | ||
| 15 | gl_HAVE_ISNANF_IN_LIBM | ||
| 16 | if test $gl_cv_func_isnanf_in_libm = yes; then | ||
| 17 | ISNANF_LIBM=-lm | ||
| 18 | fi | ||
| 19 | fi | ||
| 20 | dnl The variable gl_func_isnanf set here is used by isnan.m4. | ||
| 21 | if test $gl_cv_func_isnanf_no_libm = yes \ | ||
| 22 | || test $gl_cv_func_isnanf_in_libm = yes; then | ||
| 23 | save_LIBS="$LIBS" | ||
| 24 | LIBS="$LIBS $ISNANF_LIBM" | ||
| 25 | gl_ISNANF_WORKS | ||
| 26 | LIBS="$save_LIBS" | ||
| 27 | case "$gl_cv_func_isnanf_works" in | ||
| 28 | *yes) gl_func_isnanf=yes ;; | ||
| 29 | *) gl_func_isnanf=no; ISNANF_LIBM= ;; | ||
| 30 | esac | ||
| 31 | else | ||
| 32 | gl_func_isnanf=no | ||
| 33 | fi | ||
| 34 | if test $gl_func_isnanf != yes; then | ||
| 35 | HAVE_ISNANF=0 | ||
| 36 | fi | ||
| 37 | AC_SUBST([ISNANF_LIBM]) | ||
| 38 | ]) | ||
| 39 | |||
| 40 | dnl Check how to get or define isnanf() without linking with libm. | ||
| 41 | |||
| 42 | AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM], | ||
| 43 | [ | ||
| 44 | gl_HAVE_ISNANF_NO_LIBM | ||
| 45 | if test $gl_cv_func_isnanf_no_libm = yes; then | ||
| 46 | gl_ISNANF_WORKS | ||
| 47 | fi | ||
| 48 | if test $gl_cv_func_isnanf_no_libm = yes \ | ||
| 49 | && { case "$gl_cv_func_isnanf_works" in | ||
| 50 | *yes) true;; | ||
| 51 | *) false;; | ||
| 52 | esac | ||
| 53 | }; then | ||
| 54 | gl_func_isnanf_no_libm=yes | ||
| 55 | AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1], | ||
| 56 | [Define if the isnan(float) function is available in libc.]) | ||
| 57 | else | ||
| 58 | gl_func_isnanf_no_libm=no | ||
| 59 | fi | ||
| 60 | ]) | ||
| 61 | |||
| 62 | dnl Prerequisites of replacement isnanf definition. It does not need -lm. | ||
| 63 | AC_DEFUN([gl_PREREQ_ISNANF], | ||
| 64 | [ | ||
| 65 | gl_FLOAT_EXPONENT_LOCATION | ||
| 66 | ]) | ||
| 67 | |||
| 68 | dnl Test whether isnanf() can be used without libm. | ||
| 69 | AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM], | ||
| 70 | [ | ||
| 71 | AC_CACHE_CHECK([whether isnan(float) can be used without linking with libm], | ||
| 72 | [gl_cv_func_isnanf_no_libm], | ||
| 73 | [ | ||
| 74 | AC_LINK_IFELSE( | ||
| 75 | [AC_LANG_PROGRAM( | ||
| 76 | [[#include <math.h> | ||
| 77 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 78 | # undef isnanf | ||
| 79 | # define isnanf(x) __builtin_isnan ((float)(x)) | ||
| 80 | #elif defined isnan | ||
| 81 | # undef isnanf | ||
| 82 | # define isnanf(x) isnan ((float)(x)) | ||
| 83 | #endif | ||
| 84 | float x;]], | ||
| 85 | [[return isnanf (x);]])], | ||
| 86 | [gl_cv_func_isnanf_no_libm=yes], | ||
| 87 | [gl_cv_func_isnanf_no_libm=no]) | ||
| 88 | ]) | ||
| 89 | ]) | ||
| 90 | |||
| 91 | dnl Test whether isnanf() can be used with libm. | ||
| 92 | AC_DEFUN([gl_HAVE_ISNANF_IN_LIBM], | ||
| 93 | [ | ||
| 94 | AC_CACHE_CHECK([whether isnan(float) can be used with libm], | ||
| 95 | [gl_cv_func_isnanf_in_libm], | ||
| 96 | [ | ||
| 97 | save_LIBS="$LIBS" | ||
| 98 | LIBS="$LIBS -lm" | ||
| 99 | AC_LINK_IFELSE( | ||
| 100 | [AC_LANG_PROGRAM( | ||
| 101 | [[#include <math.h> | ||
| 102 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 103 | # undef isnanf | ||
| 104 | # define isnanf(x) __builtin_isnan ((float)(x)) | ||
| 105 | #elif defined isnan | ||
| 106 | # undef isnanf | ||
| 107 | # define isnanf(x) isnan ((float)(x)) | ||
| 108 | #endif | ||
| 109 | float x;]], | ||
| 110 | [[return isnanf (x);]])], | ||
| 111 | [gl_cv_func_isnanf_in_libm=yes], | ||
| 112 | [gl_cv_func_isnanf_in_libm=no]) | ||
| 113 | LIBS="$save_LIBS" | ||
| 114 | ]) | ||
| 115 | ]) | ||
| 116 | |||
| 117 | dnl Test whether isnanf() rejects Infinity (this fails on Solaris 2.5.1), | ||
| 118 | dnl recognizes a NaN (this fails on IRIX 6.5 with cc), and recognizes a NaN | ||
| 119 | dnl with in-memory representation 0x7fbfffff (this fails on IRIX 6.5). | ||
| 120 | AC_DEFUN([gl_ISNANF_WORKS], | ||
| 121 | [ | ||
| 122 | AC_REQUIRE([AC_PROG_CC]) | ||
| 123 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 124 | AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION]) | ||
| 125 | AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works], | ||
| 126 | [ | ||
| 127 | AC_RUN_IFELSE( | ||
| 128 | [AC_LANG_SOURCE([[ | ||
| 129 | #include <math.h> | ||
| 130 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 131 | # undef isnanf | ||
| 132 | # define isnanf(x) __builtin_isnan ((float)(x)) | ||
| 133 | #elif defined isnan | ||
| 134 | # undef isnanf | ||
| 135 | # define isnanf(x) isnan ((float)(x)) | ||
| 136 | #endif | ||
| 137 | /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ | ||
| 138 | #ifdef __DECC | ||
| 139 | static float | ||
| 140 | NaN () | ||
| 141 | { | ||
| 142 | static float zero = 0.0f; | ||
| 143 | return zero / zero; | ||
| 144 | } | ||
| 145 | #else | ||
| 146 | # define NaN() (0.0f / 0.0f) | ||
| 147 | #endif | ||
| 148 | #define NWORDS \ | ||
| 149 | ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | ||
| 150 | typedef union { unsigned int word[NWORDS]; float value; } memory_float; | ||
| 151 | int main() | ||
| 152 | { | ||
| 153 | int result = 0; | ||
| 154 | |||
| 155 | if (isnanf (1.0f / 0.0f)) | ||
| 156 | result |= 1; | ||
| 157 | |||
| 158 | if (!isnanf (NaN ())) | ||
| 159 | result |= 2; | ||
| 160 | |||
| 161 | #if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT | ||
| 162 | /* The isnanf function should be immune against changes in the sign bit and | ||
| 163 | in the mantissa bits. The xor operation twiddles a bit that can only be | ||
| 164 | a sign bit or a mantissa bit. */ | ||
| 165 | if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) | ||
| 166 | { | ||
| 167 | memory_float m; | ||
| 168 | |||
| 169 | m.value = NaN (); | ||
| 170 | /* Set the bits below the exponent to 01111...111. */ | ||
| 171 | m.word[0] &= -1U << FLT_EXPBIT0_BIT; | ||
| 172 | m.word[0] |= (1U << (FLT_EXPBIT0_BIT - 1)) - 1; | ||
| 173 | if (!isnanf (m.value)) | ||
| 174 | result |= 4; | ||
| 175 | } | ||
| 176 | #endif | ||
| 177 | |||
| 178 | return result; | ||
| 179 | }]])], | ||
| 180 | [gl_cv_func_isnanf_works=yes], | ||
| 181 | [gl_cv_func_isnanf_works=no], | ||
| 182 | [case "$host_os" in | ||
| 183 | irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;; | ||
| 184 | mingw*) # Guess yes on mingw, no on MSVC. | ||
| 185 | AC_EGREP_CPP([Known], [ | ||
| 186 | #ifdef __MINGW32__ | ||
| 187 | Known | ||
| 188 | #endif | ||
| 189 | ], | ||
| 190 | [gl_cv_func_isnanf_works="guessing yes"], | ||
| 191 | [gl_cv_func_isnanf_works="guessing no"]) | ||
| 192 | ;; | ||
| 193 | *) gl_cv_func_isnanf_works="guessing yes" ;; | ||
| 194 | esac | ||
| 195 | ]) | ||
| 196 | ]) | ||
| 197 | ]) | ||
diff --git a/m4/isnanl.m4 b/m4/isnanl.m4 deleted file mode 100644 index bb39d02558f..00000000000 --- a/m4/isnanl.m4 +++ /dev/null | |||
| @@ -1,248 +0,0 @@ | |||
| 1 | # isnanl.m4 serial 22 | ||
| 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_ISNANL], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 10 | ISNANL_LIBM= | ||
| 11 | gl_HAVE_ISNANL_NO_LIBM | ||
| 12 | if test $gl_cv_func_isnanl_no_libm = no; then | ||
| 13 | gl_HAVE_ISNANL_IN_LIBM | ||
| 14 | if test $gl_cv_func_isnanl_in_libm = yes; then | ||
| 15 | ISNANL_LIBM=-lm | ||
| 16 | fi | ||
| 17 | fi | ||
| 18 | dnl The variable gl_func_isnanl set here is used by isnan.m4. | ||
| 19 | if test $gl_cv_func_isnanl_no_libm = yes \ | ||
| 20 | || test $gl_cv_func_isnanl_in_libm = yes; then | ||
| 21 | save_LIBS="$LIBS" | ||
| 22 | LIBS="$LIBS $ISNANL_LIBM" | ||
| 23 | gl_FUNC_ISNANL_WORKS | ||
| 24 | LIBS="$save_LIBS" | ||
| 25 | case "$gl_cv_func_isnanl_works" in | ||
| 26 | *yes) gl_func_isnanl=yes ;; | ||
| 27 | *) gl_func_isnanl=no; ISNANL_LIBM= ;; | ||
| 28 | esac | ||
| 29 | else | ||
| 30 | gl_func_isnanl=no | ||
| 31 | fi | ||
| 32 | if test $gl_func_isnanl != yes; then | ||
| 33 | HAVE_ISNANL=0 | ||
| 34 | fi | ||
| 35 | AC_SUBST([ISNANL_LIBM]) | ||
| 36 | ]) | ||
| 37 | |||
| 38 | AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM], | ||
| 39 | [ | ||
| 40 | gl_HAVE_ISNANL_NO_LIBM | ||
| 41 | gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm | ||
| 42 | if test $gl_func_isnanl_no_libm = yes; then | ||
| 43 | gl_FUNC_ISNANL_WORKS | ||
| 44 | case "$gl_cv_func_isnanl_works" in | ||
| 45 | *yes) ;; | ||
| 46 | *) gl_func_isnanl_no_libm=no ;; | ||
| 47 | esac | ||
| 48 | fi | ||
| 49 | if test $gl_func_isnanl_no_libm = yes; then | ||
| 50 | AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1], | ||
| 51 | [Define if the isnan(long double) function is available in libc.]) | ||
| 52 | fi | ||
| 53 | ]) | ||
| 54 | |||
| 55 | dnl Prerequisites of replacement isnanl definition. It does not need -lm. | ||
| 56 | AC_DEFUN([gl_PREREQ_ISNANL], | ||
| 57 | [ | ||
| 58 | gl_LONG_DOUBLE_EXPONENT_LOCATION | ||
| 59 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 60 | ]) | ||
| 61 | |||
| 62 | dnl Test whether isnanl() can be used without libm. | ||
| 63 | AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM], | ||
| 64 | [ | ||
| 65 | AC_CACHE_CHECK([whether isnan(long double) can be used without linking with libm], | ||
| 66 | [gl_cv_func_isnanl_no_libm], | ||
| 67 | [ | ||
| 68 | AC_LINK_IFELSE( | ||
| 69 | [AC_LANG_PROGRAM( | ||
| 70 | [[#include <math.h> | ||
| 71 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 72 | # undef isnanl | ||
| 73 | # define isnanl(x) __builtin_isnan ((long double)(x)) | ||
| 74 | #elif defined isnan | ||
| 75 | # undef isnanl | ||
| 76 | # define isnanl(x) isnan ((long double)(x)) | ||
| 77 | #endif | ||
| 78 | long double x;]], | ||
| 79 | [[return isnanl (x);]])], | ||
| 80 | [gl_cv_func_isnanl_no_libm=yes], | ||
| 81 | [gl_cv_func_isnanl_no_libm=no]) | ||
| 82 | ]) | ||
| 83 | ]) | ||
| 84 | |||
| 85 | dnl Test whether isnanl() can be used with libm. | ||
| 86 | AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM], | ||
| 87 | [ | ||
| 88 | AC_CACHE_CHECK([whether isnan(long double) can be used with libm], | ||
| 89 | [gl_cv_func_isnanl_in_libm], | ||
| 90 | [ | ||
| 91 | save_LIBS="$LIBS" | ||
| 92 | LIBS="$LIBS -lm" | ||
| 93 | AC_LINK_IFELSE( | ||
| 94 | [AC_LANG_PROGRAM( | ||
| 95 | [[#include <math.h> | ||
| 96 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 97 | # undef isnanl | ||
| 98 | # define isnanl(x) __builtin_isnan ((long double)(x)) | ||
| 99 | #elif defined isnan | ||
| 100 | # undef isnanl | ||
| 101 | # define isnanl(x) isnan ((long double)(x)) | ||
| 102 | #endif | ||
| 103 | long double x;]], | ||
| 104 | [[return isnanl (x);]])], | ||
| 105 | [gl_cv_func_isnanl_in_libm=yes], | ||
| 106 | [gl_cv_func_isnanl_in_libm=no]) | ||
| 107 | LIBS="$save_LIBS" | ||
| 108 | ]) | ||
| 109 | ]) | ||
| 110 | |||
| 111 | dnl Test whether isnanl() recognizes all canonical numbers which are neither | ||
| 112 | dnl finite nor infinite. | ||
| 113 | AC_DEFUN([gl_FUNC_ISNANL_WORKS], | ||
| 114 | [ | ||
| 115 | AC_REQUIRE([AC_PROG_CC]) | ||
| 116 | AC_REQUIRE([gl_BIGENDIAN]) | ||
| 117 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 118 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 119 | AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works], | ||
| 120 | [ | ||
| 121 | AC_RUN_IFELSE( | ||
| 122 | [AC_LANG_SOURCE([[ | ||
| 123 | #include <float.h> | ||
| 124 | #include <limits.h> | ||
| 125 | #include <math.h> | ||
| 126 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 127 | # undef isnanl | ||
| 128 | # define isnanl(x) __builtin_isnan ((long double)(x)) | ||
| 129 | #elif defined isnan | ||
| 130 | # undef isnanl | ||
| 131 | # define isnanl(x) isnan ((long double)(x)) | ||
| 132 | #endif | ||
| 133 | #define NWORDS \ | ||
| 134 | ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | ||
| 135 | typedef union { unsigned int word[NWORDS]; long double value; } | ||
| 136 | memory_long_double; | ||
| 137 | /* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the | ||
| 138 | runtime type conversion. */ | ||
| 139 | #ifdef __sgi | ||
| 140 | static long double NaNl () | ||
| 141 | { | ||
| 142 | double zero = 0.0; | ||
| 143 | return zero / zero; | ||
| 144 | } | ||
| 145 | #else | ||
| 146 | # define NaNl() (0.0L / 0.0L) | ||
| 147 | #endif | ||
| 148 | int main () | ||
| 149 | { | ||
| 150 | int result = 0; | ||
| 151 | |||
| 152 | if (!isnanl (NaNl ())) | ||
| 153 | result |= 1; | ||
| 154 | |||
| 155 | { | ||
| 156 | memory_long_double m; | ||
| 157 | unsigned int i; | ||
| 158 | |||
| 159 | /* The isnanl function should be immune against changes in the sign bit and | ||
| 160 | in the mantissa bits. The xor operation twiddles a bit that can only be | ||
| 161 | a sign bit or a mantissa bit (since the exponent never extends to | ||
| 162 | bit 31). */ | ||
| 163 | m.value = NaNl (); | ||
| 164 | m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); | ||
| 165 | for (i = 0; i < NWORDS; i++) | ||
| 166 | m.word[i] |= 1; | ||
| 167 | if (!isnanl (m.value)) | ||
| 168 | result |= 1; | ||
| 169 | } | ||
| 170 | |||
| 171 | #if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE | ||
| 172 | /* Representation of an 80-bit 'long double' as an initializer for a sequence | ||
| 173 | of 'unsigned int' words. */ | ||
| 174 | # ifdef WORDS_BIGENDIAN | ||
| 175 | # define LDBL80_WORDS(exponent,manthi,mantlo) \ | ||
| 176 | { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ | ||
| 177 | ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ | ||
| 178 | (unsigned int) (mantlo) << 16 \ | ||
| 179 | } | ||
| 180 | # else | ||
| 181 | # define LDBL80_WORDS(exponent,manthi,mantlo) \ | ||
| 182 | { mantlo, manthi, exponent } | ||
| 183 | # endif | ||
| 184 | { /* Quiet NaN. */ | ||
| 185 | static memory_long_double x = | ||
| 186 | { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; | ||
| 187 | if (!isnanl (x.value)) | ||
| 188 | result |= 2; | ||
| 189 | } | ||
| 190 | { | ||
| 191 | /* Signalling NaN. */ | ||
| 192 | static memory_long_double x = | ||
| 193 | { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; | ||
| 194 | if (!isnanl (x.value)) | ||
| 195 | result |= 2; | ||
| 196 | } | ||
| 197 | /* isnanl should return something even for noncanonical values. */ | ||
| 198 | { /* Pseudo-NaN. */ | ||
| 199 | static memory_long_double x = | ||
| 200 | { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; | ||
| 201 | if (isnanl (x.value) && !isnanl (x.value)) | ||
| 202 | result |= 4; | ||
| 203 | } | ||
| 204 | { /* Pseudo-Infinity. */ | ||
| 205 | static memory_long_double x = | ||
| 206 | { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; | ||
| 207 | if (isnanl (x.value) && !isnanl (x.value)) | ||
| 208 | result |= 8; | ||
| 209 | } | ||
| 210 | { /* Pseudo-Zero. */ | ||
| 211 | static memory_long_double x = | ||
| 212 | { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; | ||
| 213 | if (isnanl (x.value) && !isnanl (x.value)) | ||
| 214 | result |= 16; | ||
| 215 | } | ||
| 216 | { /* Unnormalized number. */ | ||
| 217 | static memory_long_double x = | ||
| 218 | { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; | ||
| 219 | if (isnanl (x.value) && !isnanl (x.value)) | ||
| 220 | result |= 32; | ||
| 221 | } | ||
| 222 | { /* Pseudo-Denormal. */ | ||
| 223 | static memory_long_double x = | ||
| 224 | { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; | ||
| 225 | if (isnanl (x.value) && !isnanl (x.value)) | ||
| 226 | result |= 64; | ||
| 227 | } | ||
| 228 | #endif | ||
| 229 | |||
| 230 | return result; | ||
| 231 | }]])], | ||
| 232 | [gl_cv_func_isnanl_works=yes], | ||
| 233 | [gl_cv_func_isnanl_works=no], | ||
| 234 | [case "$host_os" in | ||
| 235 | mingw*) # Guess yes on mingw, no on MSVC. | ||
| 236 | AC_EGREP_CPP([Known], [ | ||
| 237 | #ifdef __MINGW32__ | ||
| 238 | Known | ||
| 239 | #endif | ||
| 240 | ], | ||
| 241 | [gl_cv_func_isnanl_works="guessing yes"], | ||
| 242 | [gl_cv_func_isnanl_works="guessing no"]) | ||
| 243 | ;; | ||
| 244 | *) gl_cv_func_isnanl_works="guessing yes" ;; | ||
| 245 | esac | ||
| 246 | ]) | ||
| 247 | ]) | ||
| 248 | ]) | ||
diff --git a/m4/ldexpl.m4 b/m4/ldexpl.m4 deleted file mode 100644 index f2785d67c5b..00000000000 --- a/m4/ldexpl.m4 +++ /dev/null | |||
| @@ -1,135 +0,0 @@ | |||
| 1 | # ldexpl.m4 serial 17 | ||
| 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_LDEXPL], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 10 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 11 | AC_REQUIRE([gl_FUNC_ISNANL]) dnl for ISNANL_LIBM | ||
| 12 | |||
| 13 | dnl Persuade glibc <math.h> to declare ldexpl(). | ||
| 14 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 15 | |||
| 16 | dnl Check whether it's declared. | ||
| 17 | dnl Mac OS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. | ||
| 18 | AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [[#include <math.h>]]) | ||
| 19 | |||
| 20 | LDEXPL_LIBM= | ||
| 21 | if test $HAVE_DECL_LDEXPL = 1; then | ||
| 22 | gl_CHECK_LDEXPL_NO_LIBM | ||
| 23 | if test $gl_cv_func_ldexpl_no_libm = no; then | ||
| 24 | AC_CACHE_CHECK([whether ldexpl() can be used with libm], | ||
| 25 | [gl_cv_func_ldexpl_in_libm], | ||
| 26 | [ | ||
| 27 | save_LIBS="$LIBS" | ||
| 28 | LIBS="$LIBS -lm" | ||
| 29 | AC_LINK_IFELSE( | ||
| 30 | [AC_LANG_PROGRAM( | ||
| 31 | [[#include <math.h> | ||
| 32 | long double x;]], | ||
| 33 | [[return ldexpl (x, -1) > 0;]])], | ||
| 34 | [gl_cv_func_ldexpl_in_libm=yes], | ||
| 35 | [gl_cv_func_ldexpl_in_libm=no]) | ||
| 36 | LIBS="$save_LIBS" | ||
| 37 | ]) | ||
| 38 | if test $gl_cv_func_ldexpl_in_libm = yes; then | ||
| 39 | LDEXPL_LIBM=-lm | ||
| 40 | fi | ||
| 41 | fi | ||
| 42 | if test $gl_cv_func_ldexpl_no_libm = yes \ | ||
| 43 | || test $gl_cv_func_ldexpl_in_libm = yes; then | ||
| 44 | save_LIBS="$LIBS" | ||
| 45 | LIBS="$LIBS $LDEXPL_LIBM" | ||
| 46 | gl_FUNC_LDEXPL_WORKS | ||
| 47 | LIBS="$save_LIBS" | ||
| 48 | case "$gl_cv_func_ldexpl_works" in | ||
| 49 | *yes) gl_func_ldexpl=yes ;; | ||
| 50 | *) gl_func_ldexpl=no; REPLACE_LDEXPL=1 ;; | ||
| 51 | esac | ||
| 52 | else | ||
| 53 | gl_func_ldexpl=no | ||
| 54 | fi | ||
| 55 | if test $gl_func_ldexpl = yes; then | ||
| 56 | AC_DEFINE([HAVE_LDEXPL], [1], | ||
| 57 | [Define if the ldexpl() function is available.]) | ||
| 58 | fi | ||
| 59 | fi | ||
| 60 | if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then | ||
| 61 | dnl Find libraries needed to link lib/ldexpl.c. | ||
| 62 | if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then | ||
| 63 | AC_REQUIRE([gl_FUNC_LDEXP]) | ||
| 64 | LDEXPL_LIBM="$LDEXP_LIBM" | ||
| 65 | else | ||
| 66 | LDEXPL_LIBM="$ISNANL_LIBM" | ||
| 67 | fi | ||
| 68 | fi | ||
| 69 | AC_SUBST([LDEXPL_LIBM]) | ||
| 70 | ]) | ||
| 71 | |||
| 72 | dnl Test whether ldexpl() can be used without linking with libm. | ||
| 73 | dnl Set gl_cv_func_ldexpl_no_libm to 'yes' or 'no' accordingly. | ||
| 74 | AC_DEFUN([gl_CHECK_LDEXPL_NO_LIBM], | ||
| 75 | [ | ||
| 76 | AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm], | ||
| 77 | [gl_cv_func_ldexpl_no_libm], | ||
| 78 | [ | ||
| 79 | AC_LINK_IFELSE( | ||
| 80 | [AC_LANG_PROGRAM( | ||
| 81 | [[#include <math.h> | ||
| 82 | long double x;]], | ||
| 83 | [[return ldexpl (x, -1) > 0;]])], | ||
| 84 | [gl_cv_func_ldexpl_no_libm=yes], | ||
| 85 | [gl_cv_func_ldexpl_no_libm=no]) | ||
| 86 | ]) | ||
| 87 | ]) | ||
| 88 | |||
| 89 | dnl Test whether ldexpl() works on finite numbers (this fails on AIX 5.1 | ||
| 90 | dnl and Mac OS X 10.4/PowerPC). | ||
| 91 | AC_DEFUN([gl_FUNC_LDEXPL_WORKS], | ||
| 92 | [ | ||
| 93 | AC_REQUIRE([AC_PROG_CC]) | ||
| 94 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 95 | AC_CACHE_CHECK([whether ldexpl works], [gl_cv_func_ldexpl_works], | ||
| 96 | [ | ||
| 97 | AC_RUN_IFELSE( | ||
| 98 | [AC_LANG_SOURCE([[ | ||
| 99 | #include <math.h> | ||
| 100 | extern | ||
| 101 | #ifdef __cplusplus | ||
| 102 | "C" | ||
| 103 | #endif | ||
| 104 | long double ldexpl (long double, int); | ||
| 105 | int main() | ||
| 106 | { | ||
| 107 | int result = 0; | ||
| 108 | { | ||
| 109 | volatile long double x = 1.0; | ||
| 110 | volatile long double y = ldexpl (x, -1); | ||
| 111 | if (y != 0.5L) | ||
| 112 | result |= 1; | ||
| 113 | } | ||
| 114 | { | ||
| 115 | volatile long double x = 1.73205L; | ||
| 116 | volatile long double y = ldexpl (x, 0); | ||
| 117 | if (y != x) | ||
| 118 | result |= 2; | ||
| 119 | } | ||
| 120 | return result; | ||
| 121 | }]])], | ||
| 122 | [gl_cv_func_ldexpl_works=yes], | ||
| 123 | [gl_cv_func_ldexpl_works=no], | ||
| 124 | [ | ||
| 125 | changequote(,)dnl | ||
| 126 | case "$host_os" in | ||
| 127 | aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no" ;; | ||
| 128 | # Guess yes on native Windows. | ||
| 129 | mingw*) gl_cv_func_ldexpl_works="guessing yes" ;; | ||
| 130 | *) gl_cv_func_ldexpl_works="guessing yes" ;; | ||
| 131 | esac | ||
| 132 | changequote([,])dnl | ||
| 133 | ]) | ||
| 134 | ]) | ||
| 135 | ]) | ||
diff --git a/m4/math_h.m4 b/m4/math_h.m4 deleted file mode 100644 index d2e90ff1eb6..00000000000 --- a/m4/math_h.m4 +++ /dev/null | |||
| @@ -1,391 +0,0 @@ | |||
| 1 | # math_h.m4 serial 125 | ||
| 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_ONCE([gl_MATH_H], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 10 | gl_CHECK_NEXT_HEADERS([math.h]) | ||
| 11 | |||
| 12 | AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], | ||
| 13 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], | ||
| 14 | [[/* Solaris 10 has a broken definition of NAN. Other platforms | ||
| 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. */ | ||
| 17 | float f = 1.0f; | ||
| 18 | #ifdef NAN | ||
| 19 | f = NAN; | ||
| 20 | #endif | ||
| 21 | return f == 0;]])], | ||
| 22 | [gl_cv_header_math_nan_works=yes], | ||
| 23 | [gl_cv_header_math_nan_works=no])]) | ||
| 24 | if test $gl_cv_header_math_nan_works = no; then | ||
| 25 | REPLACE_NAN=1 | ||
| 26 | fi | ||
| 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>]], | ||
| 29 | [[/* Solaris 10 has a broken definition of HUGE_VAL. */ | ||
| 30 | double d = HUGE_VAL; | ||
| 31 | return d == 0;]])], | ||
| 32 | [gl_cv_header_math_huge_val_works=yes], | ||
| 33 | [gl_cv_header_math_huge_val_works=no])]) | ||
| 34 | if test $gl_cv_header_math_huge_val_works = no; then | ||
| 35 | REPLACE_HUGE_VAL=1 | ||
| 36 | fi | ||
| 37 | |||
| 38 | dnl Check for declarations of anything we want to poison if the | ||
| 39 | dnl corresponding gnulib module is not in use. | ||
| 40 | gl_WARN_ON_USE_PREPARE([[#include <math.h>]], | ||
| 41 | [acosf acosl asinf asinl atanf atanl | ||
| 42 | cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf | ||
| 43 | expf expl exp2 exp2f exp2l expm1 expm1f expm1l | ||
| 44 | fabsf fabsl floorf floorl fma fmaf fmal | ||
| 45 | fmod fmodf fmodl frexpf frexpl hypotf hypotl | ||
| 46 | ilogb ilogbf ilogbl | ||
| 47 | ldexpf ldexpl | ||
| 48 | log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l | ||
| 49 | logb logbf logbl | ||
| 50 | modf modff modfl powf | ||
| 51 | remainder remainderf remainderl | ||
| 52 | rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl | ||
| 53 | tanf tanl tanhf trunc truncf truncl]) | ||
| 54 | ]) | ||
| 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. | ||
| 60 | AC_DEFUN([gl_MATH_MODULE_INDICATOR], | ||
| 61 | [ | ||
| 62 | dnl Ensure to expand the default settings once only. | ||
| 63 | gl_MATH_H_REQUIRE_DEFAULTS | ||
| 64 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 65 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 66 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 67 | ]) | ||
| 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 | |||
| 182 | AC_DEFUN([gl_MATH_H_DEFAULTS], | ||
| 183 | [ | ||
| 184 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 185 | HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) | ||
| 186 | HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) | ||
| 187 | HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) | ||
| 188 | HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) | ||
| 189 | HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) | ||
| 190 | HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) | ||
| 191 | HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) | ||
| 192 | HAVE_CBRT=1; AC_SUBST([HAVE_CBRT]) | ||
| 193 | HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) | ||
| 194 | HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) | ||
| 195 | HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) | ||
| 196 | HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) | ||
| 197 | HAVE_COSF=1; AC_SUBST([HAVE_COSF]) | ||
| 198 | HAVE_COSL=1; AC_SUBST([HAVE_COSL]) | ||
| 199 | HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) | ||
| 200 | HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) | ||
| 201 | HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) | ||
| 202 | HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) | ||
| 203 | HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) | ||
| 204 | HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) | ||
| 205 | HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) | ||
| 206 | HAVE_FMA=1; AC_SUBST([HAVE_FMA]) | ||
| 207 | HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) | ||
| 208 | HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) | ||
| 209 | HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) | ||
| 210 | HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) | ||
| 211 | HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) | ||
| 212 | HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) | ||
| 213 | HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) | ||
| 214 | HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) | ||
| 215 | HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF]) | ||
| 216 | HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL]) | ||
| 217 | HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) | ||
| 218 | HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) | ||
| 219 | HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) | ||
| 220 | HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) | ||
| 221 | HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) | ||
| 222 | HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) | ||
| 223 | HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) | ||
| 224 | HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L]) | ||
| 225 | HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) | ||
| 226 | HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) | ||
| 227 | HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) | ||
| 228 | HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) | ||
| 229 | HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) | ||
| 230 | HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) | ||
| 231 | HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) | ||
| 232 | HAVE_POWF=1; AC_SUBST([HAVE_POWF]) | ||
| 233 | HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) | ||
| 234 | HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) | ||
| 235 | HAVE_RINT=1; AC_SUBST([HAVE_RINT]) | ||
| 236 | HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) | ||
| 237 | HAVE_SINF=1; AC_SUBST([HAVE_SINF]) | ||
| 238 | HAVE_SINL=1; AC_SUBST([HAVE_SINL]) | ||
| 239 | HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) | ||
| 240 | HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) | ||
| 241 | HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) | ||
| 242 | HAVE_TANF=1; AC_SUBST([HAVE_TANF]) | ||
| 243 | HAVE_TANL=1; AC_SUBST([HAVE_TANL]) | ||
| 244 | HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) | ||
| 245 | HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) | ||
| 246 | HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) | ||
| 247 | HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) | ||
| 248 | HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF]) | ||
| 249 | HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL]) | ||
| 250 | HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) | ||
| 251 | HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) | ||
| 252 | HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF]) | ||
| 253 | HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) | ||
| 254 | HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) | ||
| 255 | HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2]) | ||
| 256 | HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F]) | ||
| 257 | HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L]) | ||
| 258 | HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L]) | ||
| 259 | HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) | ||
| 260 | HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) | ||
| 261 | HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) | ||
| 262 | HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) | ||
| 263 | HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) | ||
| 264 | HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) | ||
| 265 | HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2]) | ||
| 266 | HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F]) | ||
| 267 | HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L]) | ||
| 268 | HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) | ||
| 269 | HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) | ||
| 270 | HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL]) | ||
| 271 | HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) | ||
| 272 | HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) | ||
| 273 | HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) | ||
| 274 | HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) | ||
| 275 | HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) | ||
| 276 | HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) | ||
| 277 | HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) | ||
| 278 | HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) | ||
| 279 | HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) | ||
| 280 | HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) | ||
| 281 | REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) | ||
| 282 | REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) | ||
| 283 | REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) | ||
| 284 | REPLACE_ATAN2F=0; AC_SUBST([REPLACE_ATAN2F]) | ||
| 285 | REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) | ||
| 286 | REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) | ||
| 287 | REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) | ||
| 288 | REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) | ||
| 289 | REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) | ||
| 290 | REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) | ||
| 291 | REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) | ||
| 292 | REPLACE_EXPF=0; AC_SUBST([REPLACE_EXPF]) | ||
| 293 | REPLACE_EXPL=0; AC_SUBST([REPLACE_EXPL]) | ||
| 294 | REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) | ||
| 295 | REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) | ||
| 296 | REPLACE_EXPM1L=0; AC_SUBST([REPLACE_EXPM1L]) | ||
| 297 | REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) | ||
| 298 | REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) | ||
| 299 | REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) | ||
| 300 | REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) | ||
| 301 | REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) | ||
| 302 | REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) | ||
| 303 | REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) | ||
| 304 | REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) | ||
| 305 | REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) | ||
| 306 | REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD]) | ||
| 307 | REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF]) | ||
| 308 | REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL]) | ||
| 309 | REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) | ||
| 310 | REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) | ||
| 311 | REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) | ||
| 312 | REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) | ||
| 313 | REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) | ||
| 314 | REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) | ||
| 315 | REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) | ||
| 316 | REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) | ||
| 317 | REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) | ||
| 318 | REPLACE_ILOGBL=0; AC_SUBST([REPLACE_ILOGBL]) | ||
| 319 | REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) | ||
| 320 | REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) | ||
| 321 | REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) | ||
| 322 | REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) | ||
| 323 | REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) | ||
| 324 | REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) | ||
| 325 | REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL]) | ||
| 326 | REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10]) | ||
| 327 | REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F]) | ||
| 328 | REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L]) | ||
| 329 | REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P]) | ||
| 330 | REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF]) | ||
| 331 | REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL]) | ||
| 332 | REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2]) | ||
| 333 | REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F]) | ||
| 334 | REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L]) | ||
| 335 | REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB]) | ||
| 336 | REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF]) | ||
| 337 | REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL]) | ||
| 338 | REPLACE_MODF=0; AC_SUBST([REPLACE_MODF]) | ||
| 339 | REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF]) | ||
| 340 | REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL]) | ||
| 341 | REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) | ||
| 342 | REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) | ||
| 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]) | ||
| 360 | ]) | ||
| 361 | |||
| 362 | # gl_LONG_DOUBLE_VS_DOUBLE | ||
| 363 | # determines whether 'long double' and 'double' have the same representation. | ||
| 364 | # Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines | ||
| 365 | # HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. | ||
| 366 | # The currently known platforms where this is the case are: | ||
| 367 | # Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. | ||
| 368 | AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], | ||
| 369 | [ | ||
| 370 | AC_CACHE_CHECK([whether long double and double are the same], | ||
| 371 | [gl_cv_long_double_equals_double], | ||
| 372 | [AC_COMPILE_IFELSE( | ||
| 373 | [AC_LANG_PROGRAM([[#include <float.h>]], | ||
| 374 | [[typedef int check[sizeof (long double) == sizeof (double) | ||
| 375 | && LDBL_MANT_DIG == DBL_MANT_DIG | ||
| 376 | && LDBL_MAX_EXP == DBL_MAX_EXP | ||
| 377 | && LDBL_MIN_EXP == DBL_MIN_EXP | ||
| 378 | ? 1 : -1]; | ||
| 379 | ]])], | ||
| 380 | [gl_cv_long_double_equals_double=yes], | ||
| 381 | [gl_cv_long_double_equals_double=no]) | ||
| 382 | ]) | ||
| 383 | if test $gl_cv_long_double_equals_double = yes; then | ||
| 384 | AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1], | ||
| 385 | [Define to 1 if 'long double' and 'double' have the same representation.]) | ||
| 386 | HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1 | ||
| 387 | else | ||
| 388 | HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0 | ||
| 389 | fi | ||
| 390 | AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]) | ||
| 391 | ]) | ||
diff --git a/m4/printf-frexp.m4 b/m4/printf-frexp.m4 deleted file mode 100644 index 8f5844a2c1c..00000000000 --- a/m4/printf-frexp.m4 +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | # printf-frexp.m4 serial 5 | ||
| 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 | dnl Check how to define printf_frexp() without linking with libm. | ||
| 8 | |||
| 9 | AC_DEFUN([gl_FUNC_PRINTF_FREXP], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM]) | ||
| 12 | if test $gl_cv_func_frexp_no_libm = yes; then | ||
| 13 | gl_FUNC_FREXP_WORKS | ||
| 14 | case "$gl_cv_func_frexp_works" in | ||
| 15 | *yes) | ||
| 16 | AC_DEFINE([HAVE_FREXP_IN_LIBC], [1], | ||
| 17 | [Define if the frexp function is available in libc.]) | ||
| 18 | ;; | ||
| 19 | esac | ||
| 20 | fi | ||
| 21 | |||
| 22 | AC_CACHE_CHECK([whether ldexp can be used without linking with libm], | ||
| 23 | [gl_cv_func_ldexp_no_libm], | ||
| 24 | [ | ||
| 25 | AC_LINK_IFELSE( | ||
| 26 | [AC_LANG_PROGRAM( | ||
| 27 | [[#include <math.h> | ||
| 28 | double x; | ||
| 29 | int y;]], | ||
| 30 | [[return ldexp (x, y) < 1;]])], | ||
| 31 | [gl_cv_func_ldexp_no_libm=yes], | ||
| 32 | [gl_cv_func_ldexp_no_libm=no]) | ||
| 33 | ]) | ||
| 34 | if test $gl_cv_func_ldexp_no_libm = yes; then | ||
| 35 | AC_DEFINE([HAVE_LDEXP_IN_LIBC], [1], | ||
| 36 | [Define if the ldexp function is available in libc.]) | ||
| 37 | fi | ||
| 38 | ]) | ||
diff --git a/m4/printf-frexpl.m4 b/m4/printf-frexpl.m4 deleted file mode 100644 index aee170ffd39..00000000000 --- a/m4/printf-frexpl.m4 +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | # printf-frexpl.m4 serial 10 | ||
| 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 | dnl Check how to define printf_frexpl() without linking with libm. | ||
| 8 | |||
| 9 | AC_DEFUN([gl_FUNC_PRINTF_FREXPL], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 12 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 13 | |||
| 14 | dnl Subset of gl_FUNC_FREXPL_NO_LIBM. | ||
| 15 | gl_CHECK_FREXPL_NO_LIBM | ||
| 16 | if test $gl_cv_func_frexpl_no_libm = yes; then | ||
| 17 | gl_FUNC_FREXPL_WORKS | ||
| 18 | case "$gl_cv_func_frexpl_works" in | ||
| 19 | *yes) gl_func_frexpl_no_libm=yes ;; | ||
| 20 | *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; | ||
| 21 | esac | ||
| 22 | else | ||
| 23 | gl_func_frexpl_no_libm=no | ||
| 24 | dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. | ||
| 25 | REPLACE_FREXPL=1 | ||
| 26 | fi | ||
| 27 | if test $gl_func_frexpl_no_libm = yes; then | ||
| 28 | AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1], | ||
| 29 | [Define if the frexpl function is available in libc.]) | ||
| 30 | dnl Also check whether it's declared. | ||
| 31 | dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. | ||
| 32 | AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]]) | ||
| 33 | fi | ||
| 34 | |||
| 35 | gl_CHECK_LDEXPL_NO_LIBM | ||
| 36 | if test $gl_cv_func_ldexpl_no_libm = yes; then | ||
| 37 | gl_FUNC_LDEXPL_WORKS | ||
| 38 | case "$gl_cv_func_ldexpl_works" in | ||
| 39 | *yes) | ||
| 40 | AC_DEFINE([HAVE_LDEXPL_IN_LIBC], [1], | ||
| 41 | [Define if the ldexpl function is available in libc.]) | ||
| 42 | dnl Also check whether it's declared. | ||
| 43 | dnl Mac OS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. | ||
| 44 | AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [[#include <math.h>]]) | ||
| 45 | ;; | ||
| 46 | esac | ||
| 47 | fi | ||
| 48 | ]) | ||
diff --git a/m4/printf-posix.m4 b/m4/printf-posix.m4 deleted file mode 100644 index 9aebf4002d6..00000000000 --- a/m4/printf-posix.m4 +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | # printf-posix.m4 serial 5 | ||
| 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_PRINTF_POSIX], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_FUNC_PRINTF_IS_POSIX]) | ||
| 10 | if test $gl_cv_func_printf_posix = no; then | ||
| 11 | gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS | ||
| 12 | gl_REPLACE_VASNPRINTF | ||
| 13 | gl_REPLACE_PRINTF | ||
| 14 | fi | ||
| 15 | ]) | ||
| 16 | |||
| 17 | dnl Test whether printf is POSIX compliant. | ||
| 18 | dnl Result is gl_cv_func_printf_posix. | ||
| 19 | AC_DEFUN([gl_FUNC_PRINTF_IS_POSIX], | ||
| 20 | [ | ||
| 21 | AC_REQUIRE([gl_FUNC_VFPRINTF_IS_POSIX]) | ||
| 22 | gl_cv_func_printf_posix="$gl_cv_func_vfprintf_posix" | ||
| 23 | ]) | ||
| 24 | |||
| 25 | AC_DEFUN([gl_REPLACE_PRINTF], | ||
| 26 | [ | ||
| 27 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 28 | AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) | ||
| 29 | AC_LIBOBJ([printf]) | ||
| 30 | REPLACE_PRINTF=1 | ||
| 31 | AC_DEFINE([REPLACE_PRINTF_POSIX], [1], | ||
| 32 | [Define if printf is overridden by a POSIX compliant gnulib implementation.]) | ||
| 33 | gl_PREREQ_PRINTF | ||
| 34 | ]) | ||
| 35 | |||
| 36 | AC_DEFUN([gl_PREREQ_PRINTF], [:]) | ||
diff --git a/m4/printf.m4 b/m4/printf.m4 deleted file mode 100644 index 8b8f01067fc..00000000000 --- a/m4/printf.m4 +++ /dev/null | |||
| @@ -1,2158 +0,0 @@ | |||
| 1 | # printf.m4 serial 84 | ||
| 2 | dnl Copyright (C) 2003, 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 Test whether the *printf family of functions supports the 'j', 'z', 't', | ||
| 8 | dnl 'L' size specifiers. (ISO C99, POSIX:2001) | ||
| 9 | dnl Result is gl_cv_func_printf_sizes_c99. | ||
| 10 | |||
| 11 | AC_DEFUN([gl_PRINTF_SIZES_C99], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([AC_PROG_CC]) | ||
| 14 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
| 15 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
| 16 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 17 | AC_CACHE_CHECK([whether printf supports size specifiers as in C99], | ||
| 18 | [gl_cv_func_printf_sizes_c99], | ||
| 19 | [ | ||
| 20 | AC_RUN_IFELSE( | ||
| 21 | [AC_LANG_SOURCE([[ | ||
| 22 | #include <stddef.h> | ||
| 23 | #include <stdio.h> | ||
| 24 | #include <string.h> | ||
| 25 | #include <sys/types.h> | ||
| 26 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
| 27 | # include <stdint.h> | ||
| 28 | #endif | ||
| 29 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 30 | # include <inttypes.h> | ||
| 31 | #endif | ||
| 32 | static char buf[100]; | ||
| 33 | int main () | ||
| 34 | { | ||
| 35 | int result = 0; | ||
| 36 | #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 37 | buf[0] = '\0'; | ||
| 38 | if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 | ||
| 39 | || strcmp (buf, "12345671 33") != 0) | ||
| 40 | result |= 1; | ||
| 41 | #else | ||
| 42 | result |= 1; | ||
| 43 | #endif | ||
| 44 | buf[0] = '\0'; | ||
| 45 | if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 | ||
| 46 | || strcmp (buf, "12345672 33") != 0) | ||
| 47 | result |= 2; | ||
| 48 | buf[0] = '\0'; | ||
| 49 | if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 | ||
| 50 | || strcmp (buf, "12345673 33") != 0) | ||
| 51 | result |= 4; | ||
| 52 | buf[0] = '\0'; | ||
| 53 | if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 | ||
| 54 | || strcmp (buf, "1.5 33") != 0) | ||
| 55 | result |= 8; | ||
| 56 | return result; | ||
| 57 | }]])], | ||
| 58 | [gl_cv_func_printf_sizes_c99=yes], | ||
| 59 | [gl_cv_func_printf_sizes_c99=no], | ||
| 60 | [ | ||
| 61 | case "$host_os" in | ||
| 62 | changequote(,)dnl | ||
| 63 | # Guess yes on glibc systems. | ||
| 64 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 65 | # Guess yes on musl systems. | ||
| 66 | *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 67 | # Guess yes on FreeBSD >= 5. | ||
| 68 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; | ||
| 69 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 70 | midnightbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 71 | # Guess yes on Mac OS X >= 10.3. | ||
| 72 | darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; | ||
| 73 | darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 74 | # Guess yes on OpenBSD >= 3.9. | ||
| 75 | openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) | ||
| 76 | gl_cv_func_printf_sizes_c99="guessing no";; | ||
| 77 | openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 78 | # Guess yes on Solaris >= 2.10. | ||
| 79 | solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 80 | solaris*) gl_cv_func_printf_sizes_c99="guessing no";; | ||
| 81 | # Guess yes on NetBSD >= 3. | ||
| 82 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | ||
| 83 | gl_cv_func_printf_sizes_c99="guessing no";; | ||
| 84 | netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 85 | # Guess yes on Android. | ||
| 86 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 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 | ||
| 100 | ]) | ||
| 101 | ]) | ||
| 102 | ]) | ||
| 103 | |||
| 104 | dnl Test whether the *printf family of functions supports the 'w8', 'w16', | ||
| 105 | dnl 'w32', 'w64', 'wf8', 'wf16', 'wf32', 'wf64' size specifiers. (ISO C23) | ||
| 106 | dnl Result is gl_cv_func_printf_sizes_c23. | ||
| 107 | |||
| 108 | AC_DEFUN([gl_PRINTF_SIZES_C23], | ||
| 109 | [ | ||
| 110 | AC_REQUIRE([AC_PROG_CC]) | ||
| 111 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
| 112 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
| 113 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 114 | AC_CACHE_CHECK([whether printf supports size specifiers as in C23], | ||
| 115 | [gl_cv_func_printf_sizes_c23], | ||
| 116 | [ | ||
| 117 | AC_RUN_IFELSE( | ||
| 118 | [AC_LANG_SOURCE([[ | ||
| 119 | #include <stddef.h> | ||
| 120 | #include <stdio.h> | ||
| 121 | #include <string.h> | ||
| 122 | #include <sys/types.h> | ||
| 123 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
| 124 | # include <stdint.h> | ||
| 125 | #endif | ||
| 126 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 127 | # include <inttypes.h> | ||
| 128 | #endif | ||
| 129 | static char buf[100]; | ||
| 130 | int main () | ||
| 131 | { | ||
| 132 | int result = 0; | ||
| 133 | buf[0] = '\0'; | ||
| 134 | if (sprintf (buf, "%w8u %d", (uint8_t) 123, 33, 44, 55) < 0 | ||
| 135 | || strcmp (buf, "123 33") != 0) | ||
| 136 | result |= 1; | ||
| 137 | buf[0] = '\0'; | ||
| 138 | if (sprintf (buf, "%wf8u %d", (uint_fast8_t) 123, 33, 44, 55) < 0 | ||
| 139 | || strcmp (buf, "123 33") != 0) | ||
| 140 | result |= 1; | ||
| 141 | buf[0] = '\0'; | ||
| 142 | if (sprintf (buf, "%w16u %d", (uint16_t) 12345, 33, 44, 55) < 0 | ||
| 143 | || strcmp (buf, "12345 33") != 0) | ||
| 144 | result |= 2; | ||
| 145 | buf[0] = '\0'; | ||
| 146 | if (sprintf (buf, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55) < 0 | ||
| 147 | || strcmp (buf, "12345 33") != 0) | ||
| 148 | result |= 2; | ||
| 149 | buf[0] = '\0'; | ||
| 150 | if (sprintf (buf, "%w32u %d", (uint32_t) 12345671, 33, 44, 55) < 0 | ||
| 151 | || strcmp (buf, "12345671 33") != 0) | ||
| 152 | result |= 4; | ||
| 153 | buf[0] = '\0'; | ||
| 154 | if (sprintf (buf, "%wf32u %d", (uint_fast32_t) 12345671, 33, 44, 55) < 0 | ||
| 155 | || strcmp (buf, "12345671 33") != 0) | ||
| 156 | result |= 4; | ||
| 157 | #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX | ||
| 158 | buf[0] = '\0'; | ||
| 159 | if (sprintf (buf, "%w64u %d", (uint64_t) 12345671, 33, 44, 55) < 0 | ||
| 160 | || strcmp (buf, "12345671 33") != 0) | ||
| 161 | result |= 8; | ||
| 162 | buf[0] = '\0'; | ||
| 163 | if (sprintf (buf, "%wf64u %d", (uint_fast64_t) 12345671, 33, 44, 55) < 0 | ||
| 164 | || strcmp (buf, "12345671 33") != 0) | ||
| 165 | result |= 8; | ||
| 166 | #else | ||
| 167 | result |= 8; | ||
| 168 | #endif | ||
| 169 | return result; | ||
| 170 | }]])], | ||
| 171 | [gl_cv_func_printf_sizes_c23=yes], | ||
| 172 | [gl_cv_func_printf_sizes_c23=no], | ||
| 173 | [ | ||
| 174 | case "$host_os" in | ||
| 175 | # Guess no on glibc systems. | ||
| 176 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 177 | # Guess no on musl systems. | ||
| 178 | *-musl* | midipix*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 179 | # Guess no on Android. | ||
| 180 | linux*-android*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 181 | # Guess no on native Windows. | ||
| 182 | mingw*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
| 183 | # If we don't know, obey --enable-cross-guesses. | ||
| 184 | *) gl_cv_func_printf_sizes_c23="$gl_cross_guess_normal";; | ||
| 185 | esac | ||
| 186 | ]) | ||
| 187 | ]) | ||
| 188 | ]) | ||
| 189 | |||
| 190 | dnl Test whether the *printf family of functions supports 'long double' | ||
| 191 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) | ||
| 192 | dnl Result is gl_cv_func_printf_long_double. | ||
| 193 | |||
| 194 | AC_DEFUN([gl_PRINTF_LONG_DOUBLE], | ||
| 195 | [ | ||
| 196 | AC_REQUIRE([AC_PROG_CC]) | ||
| 197 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 198 | AC_CACHE_CHECK([whether printf supports 'long double' arguments], | ||
| 199 | [gl_cv_func_printf_long_double], | ||
| 200 | [ | ||
| 201 | AC_RUN_IFELSE( | ||
| 202 | [AC_LANG_SOURCE([[ | ||
| 203 | #include <stdio.h> | ||
| 204 | #include <string.h> | ||
| 205 | static char buf[10000]; | ||
| 206 | int main () | ||
| 207 | { | ||
| 208 | int result = 0; | ||
| 209 | buf[0] = '\0'; | ||
| 210 | if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 | ||
| 211 | || strcmp (buf, "1.750000 33") != 0) | ||
| 212 | result |= 1; | ||
| 213 | buf[0] = '\0'; | ||
| 214 | if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 | ||
| 215 | || strcmp (buf, "1.750000e+00 33") != 0) | ||
| 216 | result |= 2; | ||
| 217 | buf[0] = '\0'; | ||
| 218 | if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 | ||
| 219 | || strcmp (buf, "1.75 33") != 0) | ||
| 220 | result |= 4; | ||
| 221 | return result; | ||
| 222 | }]])], | ||
| 223 | [gl_cv_func_printf_long_double=yes], | ||
| 224 | [gl_cv_func_printf_long_double=no], | ||
| 225 | [case "$host_os" in | ||
| 226 | # Guess no on BeOS. | ||
| 227 | beos*) gl_cv_func_printf_long_double="guessing no";; | ||
| 228 | # Guess yes on Android. | ||
| 229 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; | ||
| 230 | # Guess yes on MSVC, no on mingw. | ||
| 231 | mingw*) AC_EGREP_CPP([Known], [ | ||
| 232 | #ifdef _MSC_VER | ||
| 233 | Known | ||
| 234 | #endif | ||
| 235 | ], | ||
| 236 | [gl_cv_func_printf_long_double="guessing yes"], | ||
| 237 | [gl_cv_func_printf_long_double="guessing no"]) | ||
| 238 | ;; | ||
| 239 | *) gl_cv_func_printf_long_double="guessing yes";; | ||
| 240 | esac | ||
| 241 | ]) | ||
| 242 | ]) | ||
| 243 | ]) | ||
| 244 | |||
| 245 | dnl Test whether the *printf family of functions supports infinite and NaN | ||
| 246 | dnl 'double' arguments and negative zero arguments in the %f, %e, %g | ||
| 247 | dnl directives. (ISO C99, POSIX:2001) | ||
| 248 | dnl Result is gl_cv_func_printf_infinite. | ||
| 249 | |||
| 250 | AC_DEFUN([gl_PRINTF_INFINITE], | ||
| 251 | [ | ||
| 252 | AC_REQUIRE([AC_PROG_CC]) | ||
| 253 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 254 | AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], | ||
| 255 | [gl_cv_func_printf_infinite], | ||
| 256 | [ | ||
| 257 | AC_RUN_IFELSE( | ||
| 258 | [AC_LANG_SOURCE([[ | ||
| 259 | #include <stdio.h> | ||
| 260 | #include <string.h> | ||
| 261 | static int | ||
| 262 | strisnan (const char *string, size_t start_index, size_t end_index) | ||
| 263 | { | ||
| 264 | if (start_index < end_index) | ||
| 265 | { | ||
| 266 | if (string[start_index] == '-') | ||
| 267 | start_index++; | ||
| 268 | if (start_index + 3 <= end_index | ||
| 269 | && memcmp (string + start_index, "nan", 3) == 0) | ||
| 270 | { | ||
| 271 | start_index += 3; | ||
| 272 | if (start_index == end_index | ||
| 273 | || (string[start_index] == '(' && string[end_index - 1] == ')')) | ||
| 274 | return 1; | ||
| 275 | } | ||
| 276 | } | ||
| 277 | return 0; | ||
| 278 | } | ||
| 279 | static int | ||
| 280 | have_minus_zero () | ||
| 281 | { | ||
| 282 | static double plus_zero = 0.0; | ||
| 283 | double minus_zero = - plus_zero; | ||
| 284 | return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; | ||
| 285 | } | ||
| 286 | static char buf[10000]; | ||
| 287 | static double zero = 0.0; | ||
| 288 | int main () | ||
| 289 | { | ||
| 290 | int result = 0; | ||
| 291 | if (sprintf (buf, "%f", 1.0 / zero) < 0 | ||
| 292 | || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) | ||
| 293 | result |= 1; | ||
| 294 | if (sprintf (buf, "%f", -1.0 / zero) < 0 | ||
| 295 | || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) | ||
| 296 | result |= 1; | ||
| 297 | if (sprintf (buf, "%f", zero / zero) < 0 | ||
| 298 | || !strisnan (buf, 0, strlen (buf))) | ||
| 299 | result |= 2; | ||
| 300 | if (sprintf (buf, "%e", 1.0 / zero) < 0 | ||
| 301 | || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) | ||
| 302 | result |= 4; | ||
| 303 | if (sprintf (buf, "%e", -1.0 / zero) < 0 | ||
| 304 | || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) | ||
| 305 | result |= 4; | ||
| 306 | if (sprintf (buf, "%e", zero / zero) < 0 | ||
| 307 | || !strisnan (buf, 0, strlen (buf))) | ||
| 308 | result |= 8; | ||
| 309 | if (sprintf (buf, "%g", 1.0 / zero) < 0 | ||
| 310 | || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) | ||
| 311 | result |= 16; | ||
| 312 | if (sprintf (buf, "%g", -1.0 / zero) < 0 | ||
| 313 | || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) | ||
| 314 | result |= 16; | ||
| 315 | if (sprintf (buf, "%g", zero / zero) < 0 | ||
| 316 | || !strisnan (buf, 0, strlen (buf))) | ||
| 317 | result |= 32; | ||
| 318 | /* This test fails on HP-UX 10.20. */ | ||
| 319 | if (have_minus_zero ()) | ||
| 320 | if (sprintf (buf, "%g", - zero) < 0 | ||
| 321 | || strcmp (buf, "-0") != 0) | ||
| 322 | result |= 64; | ||
| 323 | return result; | ||
| 324 | }]])], | ||
| 325 | [gl_cv_func_printf_infinite=yes], | ||
| 326 | [gl_cv_func_printf_infinite=no], | ||
| 327 | [ | ||
| 328 | case "$host_os" in | ||
| 329 | changequote(,)dnl | ||
| 330 | # Guess yes on glibc systems. | ||
| 331 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 332 | # Guess yes on musl systems. | ||
| 333 | *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 334 | # Guess yes on FreeBSD >= 6. | ||
| 335 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; | ||
| 336 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 337 | midnightbsd*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 338 | # Guess yes on Mac OS X >= 10.3. | ||
| 339 | darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; | ||
| 340 | darwin*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 341 | # Guess yes on HP-UX >= 11. | ||
| 342 | hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; | ||
| 343 | hpux*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 344 | # Guess yes on NetBSD >= 3. | ||
| 345 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | ||
| 346 | gl_cv_func_printf_infinite="guessing no";; | ||
| 347 | netbsd*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 348 | # Guess yes on OpenBSD >= 6.0. | ||
| 349 | openbsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; | ||
| 350 | openbsd*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 351 | # Guess yes on BeOS. | ||
| 352 | beos*) gl_cv_func_printf_infinite="guessing yes";; | ||
| 353 | # Guess no on Android. | ||
| 354 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; | ||
| 355 | changequote([,])dnl | ||
| 356 | # Guess yes on MSVC, no on mingw. | ||
| 357 | mingw*) AC_EGREP_CPP([Known], [ | ||
| 358 | #ifdef _MSC_VER | ||
| 359 | Known | ||
| 360 | #endif | ||
| 361 | ], | ||
| 362 | [gl_cv_func_printf_infinite="guessing yes"], | ||
| 363 | [gl_cv_func_printf_infinite="guessing no"]) | ||
| 364 | ;; | ||
| 365 | # If we don't know, obey --enable-cross-guesses. | ||
| 366 | *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; | ||
| 367 | esac | ||
| 368 | ]) | ||
| 369 | ]) | ||
| 370 | ]) | ||
| 371 | |||
| 372 | dnl Test whether the *printf family of functions supports infinite and NaN | ||
| 373 | dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) | ||
| 374 | dnl Result is gl_cv_func_printf_infinite_long_double. | ||
| 375 | |||
| 376 | AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], | ||
| 377 | [ | ||
| 378 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) | ||
| 379 | AC_REQUIRE([AC_PROG_CC]) | ||
| 380 | AC_REQUIRE([gl_BIGENDIAN]) | ||
| 381 | AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) | ||
| 382 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 383 | dnl The user can set or unset the variable gl_printf_safe to indicate | ||
| 384 | dnl that he wishes a safe handling of non-IEEE-754 'long double' values. | ||
| 385 | if test -n "$gl_printf_safe"; then | ||
| 386 | AC_DEFINE([CHECK_PRINTF_SAFE], [1], | ||
| 387 | [Define if you wish *printf() functions that have a safe handling of | ||
| 388 | non-IEEE-754 'long double' values.]) | ||
| 389 | fi | ||
| 390 | case "$gl_cv_func_printf_long_double" in | ||
| 391 | *yes) | ||
| 392 | AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], | ||
| 393 | [gl_cv_func_printf_infinite_long_double], | ||
| 394 | [ | ||
| 395 | AC_RUN_IFELSE( | ||
| 396 | [AC_LANG_SOURCE([[ | ||
| 397 | ]GL_NOCRASH[ | ||
| 398 | #include <float.h> | ||
| 399 | #include <stdio.h> | ||
| 400 | #include <string.h> | ||
| 401 | static int | ||
| 402 | strisnan (const char *string, size_t start_index, size_t end_index) | ||
| 403 | { | ||
| 404 | if (start_index < end_index) | ||
| 405 | { | ||
| 406 | if (string[start_index] == '-') | ||
| 407 | start_index++; | ||
| 408 | if (start_index + 3 <= end_index | ||
| 409 | && memcmp (string + start_index, "nan", 3) == 0) | ||
| 410 | { | ||
| 411 | start_index += 3; | ||
| 412 | if (start_index == end_index | ||
| 413 | || (string[start_index] == '(' && string[end_index - 1] == ')')) | ||
| 414 | return 1; | ||
| 415 | } | ||
| 416 | } | ||
| 417 | return 0; | ||
| 418 | } | ||
| 419 | static char buf[10000]; | ||
| 420 | static long double zeroL = 0.0L; | ||
| 421 | int main () | ||
| 422 | { | ||
| 423 | int result = 0; | ||
| 424 | nocrash_init(); | ||
| 425 | if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 | ||
| 426 | || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) | ||
| 427 | result |= 1; | ||
| 428 | if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 | ||
| 429 | || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) | ||
| 430 | result |= 1; | ||
| 431 | if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 | ||
| 432 | || !strisnan (buf, 0, strlen (buf))) | ||
| 433 | result |= 1; | ||
| 434 | if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 | ||
| 435 | || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) | ||
| 436 | result |= 1; | ||
| 437 | if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 | ||
| 438 | || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) | ||
| 439 | result |= 1; | ||
| 440 | if (sprintf (buf, "%Le", zeroL / zeroL) < 0 | ||
| 441 | || !strisnan (buf, 0, strlen (buf))) | ||
| 442 | result |= 1; | ||
| 443 | if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 | ||
| 444 | || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) | ||
| 445 | result |= 1; | ||
| 446 | if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 | ||
| 447 | || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) | ||
| 448 | result |= 1; | ||
| 449 | if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 | ||
| 450 | || !strisnan (buf, 0, strlen (buf))) | ||
| 451 | result |= 1; | ||
| 452 | #if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE | ||
| 453 | /* Representation of an 80-bit 'long double' as an initializer for a sequence | ||
| 454 | of 'unsigned int' words. */ | ||
| 455 | # ifdef WORDS_BIGENDIAN | ||
| 456 | # define LDBL80_WORDS(exponent,manthi,mantlo) \ | ||
| 457 | { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ | ||
| 458 | ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ | ||
| 459 | (unsigned int) (mantlo) << 16 \ | ||
| 460 | } | ||
| 461 | # else | ||
| 462 | # define LDBL80_WORDS(exponent,manthi,mantlo) \ | ||
| 463 | { mantlo, manthi, exponent } | ||
| 464 | # endif | ||
| 465 | { /* Quiet NaN. */ | ||
| 466 | static union { unsigned int word[4]; long double value; } x = | ||
| 467 | { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; | ||
| 468 | if (sprintf (buf, "%Lf", x.value) < 0 | ||
| 469 | || !strisnan (buf, 0, strlen (buf))) | ||
| 470 | result |= 2; | ||
| 471 | if (sprintf (buf, "%Le", x.value) < 0 | ||
| 472 | || !strisnan (buf, 0, strlen (buf))) | ||
| 473 | result |= 2; | ||
| 474 | if (sprintf (buf, "%Lg", x.value) < 0 | ||
| 475 | || !strisnan (buf, 0, strlen (buf))) | ||
| 476 | result |= 2; | ||
| 477 | } | ||
| 478 | { | ||
| 479 | /* Signalling NaN. */ | ||
| 480 | static union { unsigned int word[4]; long double value; } x = | ||
| 481 | { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; | ||
| 482 | if (sprintf (buf, "%Lf", x.value) < 0 | ||
| 483 | || !strisnan (buf, 0, strlen (buf))) | ||
| 484 | result |= 2; | ||
| 485 | if (sprintf (buf, "%Le", x.value) < 0 | ||
| 486 | || !strisnan (buf, 0, strlen (buf))) | ||
| 487 | result |= 2; | ||
| 488 | if (sprintf (buf, "%Lg", x.value) < 0 | ||
| 489 | || !strisnan (buf, 0, strlen (buf))) | ||
| 490 | result |= 2; | ||
| 491 | } | ||
| 492 | { /* Pseudo-NaN. */ | ||
| 493 | static union { unsigned int word[4]; long double value; } x = | ||
| 494 | { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; | ||
| 495 | if (sprintf (buf, "%Lf", x.value) <= 0) | ||
| 496 | result |= 4; | ||
| 497 | if (sprintf (buf, "%Le", x.value) <= 0) | ||
| 498 | result |= 4; | ||
| 499 | if (sprintf (buf, "%Lg", x.value) <= 0) | ||
| 500 | result |= 4; | ||
| 501 | } | ||
| 502 | { /* Pseudo-Infinity. */ | ||
| 503 | static union { unsigned int word[4]; long double value; } x = | ||
| 504 | { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; | ||
| 505 | if (sprintf (buf, "%Lf", x.value) <= 0) | ||
| 506 | result |= 8; | ||
| 507 | if (sprintf (buf, "%Le", x.value) <= 0) | ||
| 508 | result |= 8; | ||
| 509 | if (sprintf (buf, "%Lg", x.value) <= 0) | ||
| 510 | result |= 8; | ||
| 511 | } | ||
| 512 | { /* Pseudo-Zero. */ | ||
| 513 | static union { unsigned int word[4]; long double value; } x = | ||
| 514 | { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; | ||
| 515 | if (sprintf (buf, "%Lf", x.value) <= 0) | ||
| 516 | result |= 16; | ||
| 517 | if (sprintf (buf, "%Le", x.value) <= 0) | ||
| 518 | result |= 16; | ||
| 519 | if (sprintf (buf, "%Lg", x.value) <= 0) | ||
| 520 | result |= 16; | ||
| 521 | } | ||
| 522 | { /* Unnormalized number. */ | ||
| 523 | static union { unsigned int word[4]; long double value; } x = | ||
| 524 | { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; | ||
| 525 | if (sprintf (buf, "%Lf", x.value) <= 0) | ||
| 526 | result |= 32; | ||
| 527 | if (sprintf (buf, "%Le", x.value) <= 0) | ||
| 528 | result |= 32; | ||
| 529 | if (sprintf (buf, "%Lg", x.value) <= 0) | ||
| 530 | result |= 32; | ||
| 531 | } | ||
| 532 | { /* Pseudo-Denormal. */ | ||
| 533 | static union { unsigned int word[4]; long double value; } x = | ||
| 534 | { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; | ||
| 535 | if (sprintf (buf, "%Lf", x.value) <= 0) | ||
| 536 | result |= 64; | ||
| 537 | if (sprintf (buf, "%Le", x.value) <= 0) | ||
| 538 | result |= 64; | ||
| 539 | if (sprintf (buf, "%Lg", x.value) <= 0) | ||
| 540 | result |= 64; | ||
| 541 | } | ||
| 542 | #endif | ||
| 543 | return result; | ||
| 544 | }]])], | ||
| 545 | [gl_cv_func_printf_infinite_long_double=yes], | ||
| 546 | [gl_cv_func_printf_infinite_long_double=no], | ||
| 547 | [case "$host_cpu" in | ||
| 548 | # Guess no on ia64, x86_64, i386. | ||
| 549 | ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; | ||
| 550 | *) | ||
| 551 | case "$host_os" in | ||
| 552 | changequote(,)dnl | ||
| 553 | # Guess yes on glibc systems. | ||
| 554 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
| 555 | # Guess yes on musl systems. | ||
| 556 | *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
| 557 | # Guess yes on FreeBSD >= 6. | ||
| 558 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; | ||
| 559 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
| 560 | midnightbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
| 561 | # Guess yes on HP-UX >= 11. | ||
| 562 | hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; | ||
| 563 | hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
| 564 | # Guess yes on OpenBSD >= 6.0. | ||
| 565 | openbsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; | ||
| 566 | openbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | ||
| 567 | # Guess no on Android. | ||
| 568 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; | ||
| 569 | changequote([,])dnl | ||
| 570 | # Guess yes on MSVC, no on mingw. | ||
| 571 | mingw*) AC_EGREP_CPP([Known], [ | ||
| 572 | #ifdef _MSC_VER | ||
| 573 | Known | ||
| 574 | #endif | ||
| 575 | ], | ||
| 576 | [gl_cv_func_printf_infinite_long_double="guessing yes"], | ||
| 577 | [gl_cv_func_printf_infinite_long_double="guessing no"]) | ||
| 578 | ;; | ||
| 579 | # If we don't know, obey --enable-cross-guesses. | ||
| 580 | *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; | ||
| 581 | esac | ||
| 582 | ;; | ||
| 583 | esac | ||
| 584 | ]) | ||
| 585 | ]) | ||
| 586 | ;; | ||
| 587 | *) | ||
| 588 | gl_cv_func_printf_infinite_long_double="irrelevant" | ||
| 589 | ;; | ||
| 590 | esac | ||
| 591 | ]) | ||
| 592 | |||
| 593 | dnl Test whether the *printf family of functions supports the 'a' and 'A' | ||
| 594 | dnl conversion specifier for hexadecimal output of floating-point numbers. | ||
| 595 | dnl (ISO C99, POSIX:2001) | ||
| 596 | dnl Result is gl_cv_func_printf_directive_a. | ||
| 597 | |||
| 598 | AC_DEFUN([gl_PRINTF_DIRECTIVE_A], | ||
| 599 | [ | ||
| 600 | AC_REQUIRE([AC_PROG_CC]) | ||
| 601 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 602 | AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], | ||
| 603 | [gl_cv_func_printf_directive_a], | ||
| 604 | [ | ||
| 605 | AC_RUN_IFELSE( | ||
| 606 | [AC_LANG_SOURCE([[ | ||
| 607 | #include <stdio.h> | ||
| 608 | #include <string.h> | ||
| 609 | static char buf[100]; | ||
| 610 | static double zero = 0.0; | ||
| 611 | int main () | ||
| 612 | { | ||
| 613 | int result = 0; | ||
| 614 | if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 | ||
| 615 | || (strcmp (buf, "0x1.922p+1 33") != 0 | ||
| 616 | && strcmp (buf, "0x3.244p+0 33") != 0 | ||
| 617 | && strcmp (buf, "0x6.488p-1 33") != 0 | ||
| 618 | && strcmp (buf, "0xc.91p-2 33") != 0)) | ||
| 619 | result |= 1; | ||
| 620 | if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 | ||
| 621 | || (strcmp (buf, "-0X1.922P+1 33") != 0 | ||
| 622 | && strcmp (buf, "-0X3.244P+0 33") != 0 | ||
| 623 | && strcmp (buf, "-0X6.488P-1 33") != 0 | ||
| 624 | && strcmp (buf, "-0XC.91P-2 33") != 0)) | ||
| 625 | result |= 2; | ||
| 626 | /* This catches a FreeBSD 13.0 bug: it doesn't round. */ | ||
| 627 | if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 | ||
| 628 | || (strcmp (buf, "0x1.83p+0 33") != 0 | ||
| 629 | && strcmp (buf, "0x3.05p-1 33") != 0 | ||
| 630 | && strcmp (buf, "0x6.0ap-2 33") != 0 | ||
| 631 | && strcmp (buf, "0xc.14p-3 33") != 0)) | ||
| 632 | result |= 4; | ||
| 633 | /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ | ||
| 634 | if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 | ||
| 635 | || (strcmp (buf, "0x2p+0 33") != 0 | ||
| 636 | && strcmp (buf, "0x3p-1 33") != 0 | ||
| 637 | && strcmp (buf, "0x6p-2 33") != 0 | ||
| 638 | && strcmp (buf, "0xcp-3 33") != 0)) | ||
| 639 | result |= 4; | ||
| 640 | /* This catches a FreeBSD 6.1 bug. See | ||
| 641 | <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ | ||
| 642 | if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 | ||
| 643 | || buf[0] == '0') | ||
| 644 | result |= 8; | ||
| 645 | /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ | ||
| 646 | if (sprintf (buf, "%.1a", 1.999) < 0 | ||
| 647 | || (strcmp (buf, "0x1.0p+1") != 0 | ||
| 648 | && strcmp (buf, "0x2.0p+0") != 0 | ||
| 649 | && strcmp (buf, "0x4.0p-1") != 0 | ||
| 650 | && strcmp (buf, "0x8.0p-2") != 0)) | ||
| 651 | result |= 16; | ||
| 652 | /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a | ||
| 653 | glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ | ||
| 654 | if (sprintf (buf, "%.1La", 1.999L) < 0 | ||
| 655 | || (strcmp (buf, "0x1.0p+1") != 0 | ||
| 656 | && strcmp (buf, "0x2.0p+0") != 0 | ||
| 657 | && strcmp (buf, "0x4.0p-1") != 0 | ||
| 658 | && strcmp (buf, "0x8.0p-2") != 0)) | ||
| 659 | result |= 32; | ||
| 660 | return result; | ||
| 661 | }]])], | ||
| 662 | [gl_cv_func_printf_directive_a=yes], | ||
| 663 | [gl_cv_func_printf_directive_a=no], | ||
| 664 | [ | ||
| 665 | case "$host_os" in | ||
| 666 | # Guess yes on glibc >= 2.5 systems. | ||
| 667 | *-gnu* | gnu*) | ||
| 668 | AC_EGREP_CPP([BZ2908], [ | ||
| 669 | #include <features.h> | ||
| 670 | #ifdef __GNU_LIBRARY__ | ||
| 671 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ | ||
| 672 | BZ2908 | ||
| 673 | #endif | ||
| 674 | #endif | ||
| 675 | ], | ||
| 676 | [gl_cv_func_printf_directive_a="guessing yes"], | ||
| 677 | [gl_cv_func_printf_directive_a="guessing no"]) | ||
| 678 | ;; | ||
| 679 | # Guess yes on musl systems. | ||
| 680 | *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";; | ||
| 681 | # Guess no on Android. | ||
| 682 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; | ||
| 683 | # Guess no on native Windows. | ||
| 684 | mingw*) gl_cv_func_printf_directive_a="guessing no";; | ||
| 685 | # If we don't know, obey --enable-cross-guesses. | ||
| 686 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; | ||
| 687 | esac | ||
| 688 | ]) | ||
| 689 | ]) | ||
| 690 | ]) | ||
| 691 | |||
| 692 | dnl Test whether the *printf family of functions supports the 'b' conversion | ||
| 693 | dnl specifier for binary output of integers. | ||
| 694 | dnl (ISO C23) | ||
| 695 | dnl Result is gl_cv_func_printf_directive_b. | ||
| 696 | |||
| 697 | AC_DEFUN([gl_PRINTF_DIRECTIVE_B], | ||
| 698 | [ | ||
| 699 | AC_REQUIRE([AC_PROG_CC]) | ||
| 700 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 701 | AC_CACHE_CHECK([whether printf supports the 'b' directive], | ||
| 702 | [gl_cv_func_printf_directive_b], | ||
| 703 | [ | ||
| 704 | AC_RUN_IFELSE( | ||
| 705 | [AC_LANG_SOURCE([[ | ||
| 706 | #include <stdio.h> | ||
| 707 | #include <string.h> | ||
| 708 | static char buf[100]; | ||
| 709 | int main () | ||
| 710 | { | ||
| 711 | int result = 0; | ||
| 712 | if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0 | ||
| 713 | || strcmp (buf, "11000000111001 33") != 0) | ||
| 714 | result |= 1; | ||
| 715 | return result; | ||
| 716 | }]])], | ||
| 717 | [gl_cv_func_printf_directive_b=yes], | ||
| 718 | [gl_cv_func_printf_directive_b=no], | ||
| 719 | [ | ||
| 720 | case "$host_os" in | ||
| 721 | # Guess yes on glibc >= 2.35 systems. | ||
| 722 | *-gnu* | gnu*) | ||
| 723 | AC_EGREP_CPP([Lucky], [ | ||
| 724 | #include <features.h> | ||
| 725 | #ifdef __GNU_LIBRARY__ | ||
| 726 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
| 727 | Lucky user | ||
| 728 | #endif | ||
| 729 | #endif | ||
| 730 | ], | ||
| 731 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
| 732 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
| 733 | ;; | ||
| 734 | # Guess no on musl systems. | ||
| 735 | *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";; | ||
| 736 | # Guess no on Android. | ||
| 737 | linux*-android*) gl_cv_func_printf_directive_b="guessing no";; | ||
| 738 | # Guess no on native Windows. | ||
| 739 | mingw*) gl_cv_func_printf_directive_b="guessing no";; | ||
| 740 | # If we don't know, obey --enable-cross-guesses. | ||
| 741 | *) gl_cv_func_printf_directive_b="$gl_cross_guess_normal";; | ||
| 742 | esac | ||
| 743 | ]) | ||
| 744 | ]) | ||
| 745 | ]) | ||
| 746 | |||
| 747 | dnl Test whether the *printf family of functions supports the 'B' conversion | ||
| 748 | dnl specifier for binary output of integers. | ||
| 749 | dnl (GNU, encouraged by ISO C23 § 7.23.6.1) | ||
| 750 | dnl Result is gl_cv_func_printf_directive_uppercase_b. | ||
| 751 | |||
| 752 | AC_DEFUN([gl_PRINTF_DIRECTIVE_UPPERCASE_B], | ||
| 753 | [ | ||
| 754 | AC_REQUIRE([AC_PROG_CC]) | ||
| 755 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 756 | AC_CACHE_CHECK([whether printf supports the 'B' directive], | ||
| 757 | [gl_cv_func_printf_directive_uppercase_b], | ||
| 758 | [ | ||
| 759 | AC_RUN_IFELSE( | ||
| 760 | [AC_LANG_SOURCE([[ | ||
| 761 | #include <stdio.h> | ||
| 762 | #include <string.h> | ||
| 763 | static char buf[100]; | ||
| 764 | int main () | ||
| 765 | { | ||
| 766 | int result = 0; | ||
| 767 | if (sprintf (buf, "%#B %d", 12345, 33, 44, 55) < 0 | ||
| 768 | || strcmp (buf, "0B11000000111001 33") != 0) | ||
| 769 | result |= 1; | ||
| 770 | return result; | ||
| 771 | }]])], | ||
| 772 | [gl_cv_func_printf_directive_uppercase_b=yes], | ||
| 773 | [gl_cv_func_printf_directive_uppercase_b=no], | ||
| 774 | [ | ||
| 775 | case "$host_os" in | ||
| 776 | # Guess yes on glibc >= 2.35 systems. | ||
| 777 | *-gnu* | gnu*) | ||
| 778 | AC_EGREP_CPP([Lucky], [ | ||
| 779 | #include <features.h> | ||
| 780 | #ifdef __GNU_LIBRARY__ | ||
| 781 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
| 782 | Lucky user | ||
| 783 | #endif | ||
| 784 | #endif | ||
| 785 | ], | ||
| 786 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
| 787 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
| 788 | ;; | ||
| 789 | # Guess no on musl systems. | ||
| 790 | *-musl* | midipix*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
| 791 | # Guess no on Android. | ||
| 792 | linux*-android*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
| 793 | # Guess no on native Windows. | ||
| 794 | mingw*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
| 795 | # If we don't know, obey --enable-cross-guesses. | ||
| 796 | *) gl_cv_func_printf_directive_uppercase_b="$gl_cross_guess_normal";; | ||
| 797 | esac | ||
| 798 | ]) | ||
| 799 | ]) | ||
| 800 | ]) | ||
| 801 | |||
| 802 | dnl Test whether the *printf family of functions supports the %F format | ||
| 803 | dnl directive. (ISO C99, POSIX:2001) | ||
| 804 | dnl Result is gl_cv_func_printf_directive_f. | ||
| 805 | |||
| 806 | AC_DEFUN([gl_PRINTF_DIRECTIVE_F], | ||
| 807 | [ | ||
| 808 | AC_REQUIRE([AC_PROG_CC]) | ||
| 809 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 810 | AC_CACHE_CHECK([whether printf supports the 'F' directive], | ||
| 811 | [gl_cv_func_printf_directive_f], | ||
| 812 | [ | ||
| 813 | AC_RUN_IFELSE( | ||
| 814 | [AC_LANG_SOURCE([[ | ||
| 815 | #include <stdio.h> | ||
| 816 | #include <string.h> | ||
| 817 | static char buf[100]; | ||
| 818 | static double zero = 0.0; | ||
| 819 | int main () | ||
| 820 | { | ||
| 821 | int result = 0; | ||
| 822 | if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 | ||
| 823 | || strcmp (buf, "1234567.000000 33") != 0) | ||
| 824 | result |= 1; | ||
| 825 | if (sprintf (buf, "%F", 1.0 / zero) < 0 | ||
| 826 | || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) | ||
| 827 | result |= 2; | ||
| 828 | /* This catches a Cygwin 1.5.x bug. */ | ||
| 829 | if (sprintf (buf, "%.F", 1234.0) < 0 | ||
| 830 | || strcmp (buf, "1234") != 0) | ||
| 831 | result |= 4; | ||
| 832 | return result; | ||
| 833 | }]])], | ||
| 834 | [gl_cv_func_printf_directive_f=yes], | ||
| 835 | [gl_cv_func_printf_directive_f=no], | ||
| 836 | [ | ||
| 837 | case "$host_os" in | ||
| 838 | changequote(,)dnl | ||
| 839 | # Guess yes on glibc systems. | ||
| 840 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 841 | # Guess yes on musl systems. | ||
| 842 | *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 843 | # Guess yes on FreeBSD >= 6. | ||
| 844 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; | ||
| 845 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 846 | midnightbsd*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 847 | # Guess yes on Mac OS X >= 10.3. | ||
| 848 | darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; | ||
| 849 | darwin*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 850 | # Guess yes on OpenBSD >= 6.0. | ||
| 851 | openbsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; | ||
| 852 | openbsd*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 853 | # Guess yes on Solaris >= 2.10. | ||
| 854 | solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; | ||
| 855 | solaris*) gl_cv_func_printf_directive_f="guessing no";; | ||
| 856 | # Guess no on Android. | ||
| 857 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; | ||
| 858 | changequote([,])dnl | ||
| 859 | # Guess yes on MSVC, no on mingw. | ||
| 860 | mingw*) AC_EGREP_CPP([Known], [ | ||
| 861 | #ifdef _MSC_VER | ||
| 862 | Known | ||
| 863 | #endif | ||
| 864 | ], | ||
| 865 | [gl_cv_func_printf_directive_f="guessing yes"], | ||
| 866 | [gl_cv_func_printf_directive_f="guessing no"]) | ||
| 867 | ;; | ||
| 868 | # If we don't know, obey --enable-cross-guesses. | ||
| 869 | *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; | ||
| 870 | esac | ||
| 871 | ]) | ||
| 872 | ]) | ||
| 873 | ]) | ||
| 874 | |||
| 875 | dnl Test whether the *printf family of functions supports the %n format | ||
| 876 | dnl directive. (ISO C99, POSIX:2001) | ||
| 877 | dnl Result is gl_cv_func_printf_directive_n. | ||
| 878 | |||
| 879 | AC_DEFUN([gl_PRINTF_DIRECTIVE_N], | ||
| 880 | [ | ||
| 881 | AC_REQUIRE([AC_PROG_CC]) | ||
| 882 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 883 | AC_CACHE_CHECK([whether printf supports the 'n' directive], | ||
| 884 | [gl_cv_func_printf_directive_n], | ||
| 885 | [ | ||
| 886 | AC_RUN_IFELSE( | ||
| 887 | [AC_LANG_SOURCE([[ | ||
| 888 | #include <stdio.h> | ||
| 889 | #include <stdlib.h> | ||
| 890 | #include <string.h> | ||
| 891 | #ifdef _MSC_VER | ||
| 892 | #include <inttypes.h> | ||
| 893 | /* See page about "Parameter Validation" on msdn.microsoft.com. | ||
| 894 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> | ||
| 895 | <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler> */ | ||
| 896 | static void cdecl | ||
| 897 | invalid_parameter_handler (const wchar_t *expression, | ||
| 898 | const wchar_t *function, | ||
| 899 | const wchar_t *file, unsigned int line, | ||
| 900 | uintptr_t dummy) | ||
| 901 | { | ||
| 902 | exit (1); | ||
| 903 | } | ||
| 904 | #endif | ||
| 905 | static char fmtstring[10]; | ||
| 906 | static char buf[100]; | ||
| 907 | int main () | ||
| 908 | { | ||
| 909 | int count = -1; | ||
| 910 | #ifdef _MSC_VER | ||
| 911 | _set_invalid_parameter_handler (invalid_parameter_handler); | ||
| 912 | #endif | ||
| 913 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | ||
| 914 | support %n in format strings in read-only memory but not in writable | ||
| 915 | memory. */ | ||
| 916 | strcpy (fmtstring, "%d %n"); | ||
| 917 | if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 | ||
| 918 | || strcmp (buf, "123 ") != 0 | ||
| 919 | || count != 4) | ||
| 920 | return 1; | ||
| 921 | return 0; | ||
| 922 | }]])], | ||
| 923 | [gl_cv_func_printf_directive_n=yes], | ||
| 924 | [gl_cv_func_printf_directive_n=no], | ||
| 925 | [case "$host_os" in | ||
| 926 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. | ||
| 927 | *-gnu* | gnu*) AC_COMPILE_IFELSE( | ||
| 928 | [AC_LANG_SOURCE( | ||
| 929 | [[#if _FORTIFY_SOURCE >= 2 | ||
| 930 | error fail | ||
| 931 | #endif | ||
| 932 | ]])], | ||
| 933 | [gl_cv_func_printf_directive_n="guessing yes"], | ||
| 934 | [gl_cv_func_printf_directive_n="guessing no"]) | ||
| 935 | ;; | ||
| 936 | # Guess no on Android. | ||
| 937 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; | ||
| 938 | # Guess no on native Windows. | ||
| 939 | mingw*) gl_cv_func_printf_directive_n="guessing no";; | ||
| 940 | *) gl_cv_func_printf_directive_n="guessing yes";; | ||
| 941 | esac | ||
| 942 | ]) | ||
| 943 | ]) | ||
| 944 | ]) | ||
| 945 | |||
| 946 | dnl Test whether the *printf family of functions supports the %ls format | ||
| 947 | dnl directive and in particular, when a precision is specified, whether | ||
| 948 | dnl the functions stop converting the wide string argument when the number | ||
| 949 | dnl of bytes that have been produced by this conversion equals or exceeds | ||
| 950 | dnl the precision. | ||
| 951 | dnl Result is gl_cv_func_printf_directive_ls. | ||
| 952 | |||
| 953 | AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], | ||
| 954 | [ | ||
| 955 | AC_REQUIRE([AC_PROG_CC]) | ||
| 956 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 957 | AC_CACHE_CHECK([whether printf supports the 'ls' directive], | ||
| 958 | [gl_cv_func_printf_directive_ls], | ||
| 959 | [ | ||
| 960 | AC_RUN_IFELSE( | ||
| 961 | [AC_LANG_SOURCE([[ | ||
| 962 | #include <stdio.h> | ||
| 963 | #include <wchar.h> | ||
| 964 | #include <string.h> | ||
| 965 | int main () | ||
| 966 | { | ||
| 967 | int result = 0; | ||
| 968 | char buf[100]; | ||
| 969 | /* Test whether %ls works at all. | ||
| 970 | This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on | ||
| 971 | Cygwin 1.5. */ | ||
| 972 | { | ||
| 973 | static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; | ||
| 974 | buf[0] = '\0'; | ||
| 975 | if (sprintf (buf, "%ls", wstring) < 0 | ||
| 976 | || strcmp (buf, "abc") != 0) | ||
| 977 | result |= 1; | ||
| 978 | } | ||
| 979 | /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an | ||
| 980 | assertion failure inside libc), but not on OpenBSD 4.0. */ | ||
| 981 | { | ||
| 982 | static const wchar_t wstring[] = { 'a', 0 }; | ||
| 983 | buf[0] = '\0'; | ||
| 984 | if (sprintf (buf, "%ls", wstring) < 0 | ||
| 985 | || strcmp (buf, "a") != 0) | ||
| 986 | result |= 2; | ||
| 987 | } | ||
| 988 | /* Test whether precisions in %ls are supported as specified in ISO C 99 | ||
| 989 | section 7.19.6.1: | ||
| 990 | "If a precision is specified, no more than that many bytes are written | ||
| 991 | (including shift sequences, if any), and the array shall contain a | ||
| 992 | null wide character if, to equal the multibyte character sequence | ||
| 993 | length given by the precision, the function would need to access a | ||
| 994 | wide character one past the end of the array." | ||
| 995 | This test fails on Solaris 10. */ | ||
| 996 | { | ||
| 997 | static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; | ||
| 998 | buf[0] = '\0'; | ||
| 999 | if (sprintf (buf, "%.2ls", wstring) < 0 | ||
| 1000 | || strcmp (buf, "ab") != 0) | ||
| 1001 | result |= 8; | ||
| 1002 | } | ||
| 1003 | return result; | ||
| 1004 | }]])], | ||
| 1005 | [gl_cv_func_printf_directive_ls=yes], | ||
| 1006 | [gl_cv_func_printf_directive_ls=no], | ||
| 1007 | [ | ||
| 1008 | changequote(,)dnl | ||
| 1009 | case "$host_os" in | ||
| 1010 | # Guess yes on OpenBSD >= 6.0. | ||
| 1011 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; | ||
| 1012 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; | ||
| 1013 | irix*) gl_cv_func_printf_directive_ls="guessing no";; | ||
| 1014 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; | ||
| 1015 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; | ||
| 1016 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; | ||
| 1017 | # Guess no on Android. | ||
| 1018 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; | ||
| 1019 | # Guess yes on native Windows. | ||
| 1020 | mingw*) gl_cv_func_printf_directive_ls="guessing yes";; | ||
| 1021 | *) gl_cv_func_printf_directive_ls="guessing yes";; | ||
| 1022 | esac | ||
| 1023 | changequote([,])dnl | ||
| 1024 | ]) | ||
| 1025 | ]) | ||
| 1026 | ]) | ||
| 1027 | |||
| 1028 | dnl Test whether the *printf family of functions supports the %lc format | ||
| 1029 | dnl directive and in particular, when the argument is a null wide character, | ||
| 1030 | dnl whether the functions don't produce a NUL byte. | ||
| 1031 | dnl Result is gl_cv_func_printf_directive_lc. | ||
| 1032 | |||
| 1033 | AC_DEFUN([gl_PRINTF_DIRECTIVE_LC], | ||
| 1034 | [ | ||
| 1035 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1036 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1037 | AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly], | ||
| 1038 | [gl_cv_func_printf_directive_lc], | ||
| 1039 | [ | ||
| 1040 | AC_RUN_IFELSE( | ||
| 1041 | [AC_LANG_SOURCE([[ | ||
| 1042 | #include <stdio.h> | ||
| 1043 | #include <wchar.h> | ||
| 1044 | #include <string.h> | ||
| 1045 | int main () | ||
| 1046 | { | ||
| 1047 | int result = 0; | ||
| 1048 | char buf[100]; | ||
| 1049 | /* This test fails on glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, | ||
| 1050 | macOS 12.5, AIX 7.2, Solaris 11.4. | ||
| 1051 | glibc 2.35 bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=30257> */ | ||
| 1052 | { | ||
| 1053 | buf[0] = '\0'; | ||
| 1054 | if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0 | ||
| 1055 | || strcmp (buf, "az") != 0) | ||
| 1056 | result |= 1; | ||
| 1057 | } | ||
| 1058 | return result; | ||
| 1059 | }]])], | ||
| 1060 | [gl_cv_func_printf_directive_lc=yes], | ||
| 1061 | [gl_cv_func_printf_directive_lc=no], | ||
| 1062 | [ | ||
| 1063 | changequote(,)dnl | ||
| 1064 | case "$host_os" in | ||
| 1065 | # Guess yes on musl libc. | ||
| 1066 | *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing yes";; | ||
| 1067 | # Guess no otherwise. | ||
| 1068 | *) gl_cv_func_printf_directive_lc="guessing no";; | ||
| 1069 | esac | ||
| 1070 | changequote([,])dnl | ||
| 1071 | ]) | ||
| 1072 | ]) | ||
| 1073 | ]) | ||
| 1074 | |||
| 1075 | dnl Test whether the *printf family of functions supports POSIX/XSI format | ||
| 1076 | dnl strings with positions. (POSIX:2001) | ||
| 1077 | dnl Result is gl_cv_func_printf_positions. | ||
| 1078 | |||
| 1079 | AC_DEFUN_ONCE([gl_PRINTF_POSITIONS], | ||
| 1080 | [ | ||
| 1081 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1082 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1083 | AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], | ||
| 1084 | [gl_cv_func_printf_positions], | ||
| 1085 | [ | ||
| 1086 | AC_RUN_IFELSE( | ||
| 1087 | [AC_LANG_SOURCE([[ | ||
| 1088 | #include <stdio.h> | ||
| 1089 | #include <string.h> | ||
| 1090 | /* The string "%2$d %1$d", with dollar characters protected from the shell's | ||
| 1091 | dollar expansion (possibly an autoconf bug). */ | ||
| 1092 | static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; | ||
| 1093 | static char buf[100]; | ||
| 1094 | int main () | ||
| 1095 | { | ||
| 1096 | sprintf (buf, format, 33, 55); | ||
| 1097 | return (strcmp (buf, "55 33") != 0); | ||
| 1098 | }]])], | ||
| 1099 | [gl_cv_func_printf_positions=yes], | ||
| 1100 | [gl_cv_func_printf_positions=no], | ||
| 1101 | [ | ||
| 1102 | changequote(,)dnl | ||
| 1103 | case "$host_os" in | ||
| 1104 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) | ||
| 1105 | gl_cv_func_printf_positions="guessing no";; | ||
| 1106 | beos*) gl_cv_func_printf_positions="guessing no";; | ||
| 1107 | # Guess yes on Android. | ||
| 1108 | linux*-android*) gl_cv_func_printf_positions="guessing yes";; | ||
| 1109 | # Guess no on native Windows. | ||
| 1110 | mingw* | pw*) gl_cv_func_printf_positions="guessing no";; | ||
| 1111 | *) gl_cv_func_printf_positions="guessing yes";; | ||
| 1112 | esac | ||
| 1113 | changequote([,])dnl | ||
| 1114 | ]) | ||
| 1115 | ]) | ||
| 1116 | ]) | ||
| 1117 | |||
| 1118 | dnl Test whether the *printf family of functions supports POSIX/XSI format | ||
| 1119 | dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001) | ||
| 1120 | dnl Result is gl_cv_func_printf_flag_grouping. | ||
| 1121 | |||
| 1122 | AC_DEFUN([gl_PRINTF_FLAG_GROUPING], | ||
| 1123 | [ | ||
| 1124 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1125 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1126 | AC_CACHE_CHECK([whether printf supports the grouping flag], | ||
| 1127 | [gl_cv_func_printf_flag_grouping], | ||
| 1128 | [ | ||
| 1129 | AC_RUN_IFELSE( | ||
| 1130 | [AC_LANG_SOURCE([[ | ||
| 1131 | #include <stdio.h> | ||
| 1132 | #include <string.h> | ||
| 1133 | static char buf[100]; | ||
| 1134 | int main () | ||
| 1135 | { | ||
| 1136 | if (sprintf (buf, "%'d %d", 1234567, 99) < 0 | ||
| 1137 | || buf[strlen (buf) - 1] != '9') | ||
| 1138 | return 1; | ||
| 1139 | return 0; | ||
| 1140 | }]])], | ||
| 1141 | [gl_cv_func_printf_flag_grouping=yes], | ||
| 1142 | [gl_cv_func_printf_flag_grouping=no], | ||
| 1143 | [ | ||
| 1144 | changequote(,)dnl | ||
| 1145 | case "$host_os" in | ||
| 1146 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; | ||
| 1147 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; | ||
| 1148 | # Guess no on Android. | ||
| 1149 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; | ||
| 1150 | # Guess no on native Windows. | ||
| 1151 | mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; | ||
| 1152 | *) gl_cv_func_printf_flag_grouping="guessing yes";; | ||
| 1153 | esac | ||
| 1154 | changequote([,])dnl | ||
| 1155 | ]) | ||
| 1156 | ]) | ||
| 1157 | ]) | ||
| 1158 | |||
| 1159 | dnl Test whether the *printf family of functions supports the - flag correctly. | ||
| 1160 | dnl (ISO C99.) See | ||
| 1161 | dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> | ||
| 1162 | dnl Result is gl_cv_func_printf_flag_leftadjust. | ||
| 1163 | |||
| 1164 | AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], | ||
| 1165 | [ | ||
| 1166 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1167 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1168 | AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], | ||
| 1169 | [gl_cv_func_printf_flag_leftadjust], | ||
| 1170 | [ | ||
| 1171 | AC_RUN_IFELSE( | ||
| 1172 | [AC_LANG_SOURCE([[ | ||
| 1173 | #include <stdio.h> | ||
| 1174 | #include <string.h> | ||
| 1175 | static char buf[100]; | ||
| 1176 | int main () | ||
| 1177 | { | ||
| 1178 | /* Check that a '-' flag is not annihilated by a negative width. */ | ||
| 1179 | if (sprintf (buf, "a%-*sc", -3, "b") < 0 | ||
| 1180 | || strcmp (buf, "ab c") != 0) | ||
| 1181 | return 1; | ||
| 1182 | return 0; | ||
| 1183 | }]])], | ||
| 1184 | [gl_cv_func_printf_flag_leftadjust=yes], | ||
| 1185 | [gl_cv_func_printf_flag_leftadjust=no], | ||
| 1186 | [ | ||
| 1187 | changequote(,)dnl | ||
| 1188 | case "$host_os" in | ||
| 1189 | # Guess yes on HP-UX 11. | ||
| 1190 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | ||
| 1191 | # Guess no on HP-UX 10 and older. | ||
| 1192 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; | ||
| 1193 | # Guess yes on Android. | ||
| 1194 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | ||
| 1195 | # Guess yes on native Windows. | ||
| 1196 | mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | ||
| 1197 | # Guess yes otherwise. | ||
| 1198 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; | ||
| 1199 | esac | ||
| 1200 | changequote([,])dnl | ||
| 1201 | ]) | ||
| 1202 | ]) | ||
| 1203 | ]) | ||
| 1204 | |||
| 1205 | dnl Test whether the *printf family of functions supports padding of non-finite | ||
| 1206 | dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See | ||
| 1207 | dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> | ||
| 1208 | dnl Result is gl_cv_func_printf_flag_zero. | ||
| 1209 | |||
| 1210 | AC_DEFUN([gl_PRINTF_FLAG_ZERO], | ||
| 1211 | [ | ||
| 1212 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1213 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1214 | AC_CACHE_CHECK([whether printf supports the zero flag correctly], | ||
| 1215 | [gl_cv_func_printf_flag_zero], | ||
| 1216 | [ | ||
| 1217 | AC_RUN_IFELSE( | ||
| 1218 | [AC_LANG_SOURCE([[ | ||
| 1219 | #include <stdio.h> | ||
| 1220 | #include <string.h> | ||
| 1221 | static char buf[100]; | ||
| 1222 | static double zero = 0.0; | ||
| 1223 | int main () | ||
| 1224 | { | ||
| 1225 | if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 | ||
| 1226 | || (strcmp (buf, " inf") != 0 | ||
| 1227 | && strcmp (buf, " infinity") != 0)) | ||
| 1228 | return 1; | ||
| 1229 | return 0; | ||
| 1230 | }]])], | ||
| 1231 | [gl_cv_func_printf_flag_zero=yes], | ||
| 1232 | [gl_cv_func_printf_flag_zero=no], | ||
| 1233 | [ | ||
| 1234 | changequote(,)dnl | ||
| 1235 | case "$host_os" in | ||
| 1236 | # Guess yes on glibc systems. | ||
| 1237 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; | ||
| 1238 | # Guess yes on musl systems. | ||
| 1239 | *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";; | ||
| 1240 | # Guess yes on BeOS. | ||
| 1241 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; | ||
| 1242 | # Guess no on Android. | ||
| 1243 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; | ||
| 1244 | # Guess no on native Windows. | ||
| 1245 | mingw*) gl_cv_func_printf_flag_zero="guessing no";; | ||
| 1246 | # If we don't know, obey --enable-cross-guesses. | ||
| 1247 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; | ||
| 1248 | esac | ||
| 1249 | changequote([,])dnl | ||
| 1250 | ]) | ||
| 1251 | ]) | ||
| 1252 | ]) | ||
| 1253 | |||
| 1254 | dnl Test whether the *printf family of functions supports large precisions. | ||
| 1255 | dnl On mingw, precisions larger than 512 are treated like 512, in integer, | ||
| 1256 | dnl floating-point or pointer output. On Solaris 10/x86, precisions larger | ||
| 1257 | dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC, | ||
| 1258 | dnl precisions larger than 510 in floating-point output yield wrong results. | ||
| 1259 | dnl On AIX 7.1, precisions larger than 998 in floating-point output yield | ||
| 1260 | dnl wrong results. On BeOS, precisions larger than 1044 crash the program. | ||
| 1261 | dnl Result is gl_cv_func_printf_precision. | ||
| 1262 | |||
| 1263 | AC_DEFUN([gl_PRINTF_PRECISION], | ||
| 1264 | [ | ||
| 1265 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1266 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1267 | AC_CACHE_CHECK([whether printf supports large precisions], | ||
| 1268 | [gl_cv_func_printf_precision], | ||
| 1269 | [ | ||
| 1270 | AC_RUN_IFELSE( | ||
| 1271 | [AC_LANG_SOURCE([[ | ||
| 1272 | #include <stdio.h> | ||
| 1273 | #include <string.h> | ||
| 1274 | static char buf[5000]; | ||
| 1275 | int main () | ||
| 1276 | { | ||
| 1277 | int result = 0; | ||
| 1278 | #ifdef __BEOS__ | ||
| 1279 | /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ | ||
| 1280 | return 1; | ||
| 1281 | #endif | ||
| 1282 | if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) | ||
| 1283 | result |= 1; | ||
| 1284 | if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) | ||
| 1285 | result |= 2; | ||
| 1286 | if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 | ||
| 1287 | || buf[0] != '1') | ||
| 1288 | result |= 4; | ||
| 1289 | if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 | ||
| 1290 | || buf[0] != '1') | ||
| 1291 | result |= 4; | ||
| 1292 | return result; | ||
| 1293 | }]])], | ||
| 1294 | [gl_cv_func_printf_precision=yes], | ||
| 1295 | [gl_cv_func_printf_precision=no], | ||
| 1296 | [ | ||
| 1297 | changequote(,)dnl | ||
| 1298 | case "$host_os" in | ||
| 1299 | # Guess no only on Solaris, native Windows, and BeOS systems. | ||
| 1300 | solaris*) gl_cv_func_printf_precision="guessing no" ;; | ||
| 1301 | mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; | ||
| 1302 | beos*) gl_cv_func_printf_precision="guessing no" ;; | ||
| 1303 | # Guess yes on Android. | ||
| 1304 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; | ||
| 1305 | *) gl_cv_func_printf_precision="guessing yes" ;; | ||
| 1306 | esac | ||
| 1307 | changequote([,])dnl | ||
| 1308 | ]) | ||
| 1309 | ]) | ||
| 1310 | ]) | ||
| 1311 | |||
| 1312 | dnl Test whether the *printf family of functions recovers gracefully in case | ||
| 1313 | dnl of an out-of-memory condition, or whether it crashes the entire program. | ||
| 1314 | dnl Result is gl_cv_func_printf_enomem. | ||
| 1315 | |||
| 1316 | AC_DEFUN([gl_PRINTF_ENOMEM], | ||
| 1317 | [ | ||
| 1318 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1319 | AC_REQUIRE([gl_MULTIARCH]) | ||
| 1320 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1321 | AC_CACHE_CHECK([whether printf survives out-of-memory conditions], | ||
| 1322 | [gl_cv_func_printf_enomem], | ||
| 1323 | [ | ||
| 1324 | gl_cv_func_printf_enomem="guessing no" | ||
| 1325 | if test "$cross_compiling" = no; then | ||
| 1326 | if test $APPLE_UNIVERSAL_BUILD = 0; then | ||
| 1327 | AC_LANG_CONFTEST([AC_LANG_SOURCE([[ | ||
| 1328 | ]GL_NOCRASH[ | ||
| 1329 | #include <stdio.h> | ||
| 1330 | #include <sys/types.h> | ||
| 1331 | #include <sys/time.h> | ||
| 1332 | #include <sys/resource.h> | ||
| 1333 | #include <errno.h> | ||
| 1334 | int main() | ||
| 1335 | { | ||
| 1336 | struct rlimit limit; | ||
| 1337 | int ret; | ||
| 1338 | nocrash_init (); | ||
| 1339 | /* Some printf implementations allocate temporary space with malloc. */ | ||
| 1340 | /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ | ||
| 1341 | #ifdef RLIMIT_DATA | ||
| 1342 | if (getrlimit (RLIMIT_DATA, &limit) < 0) | ||
| 1343 | return 77; | ||
| 1344 | if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) | ||
| 1345 | limit.rlim_max = 5000000; | ||
| 1346 | limit.rlim_cur = limit.rlim_max; | ||
| 1347 | if (setrlimit (RLIMIT_DATA, &limit) < 0) | ||
| 1348 | return 77; | ||
| 1349 | #endif | ||
| 1350 | /* On Linux systems, malloc() is limited by RLIMIT_AS. */ | ||
| 1351 | #ifdef RLIMIT_AS | ||
| 1352 | if (getrlimit (RLIMIT_AS, &limit) < 0) | ||
| 1353 | return 77; | ||
| 1354 | if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) | ||
| 1355 | limit.rlim_max = 5000000; | ||
| 1356 | limit.rlim_cur = limit.rlim_max; | ||
| 1357 | if (setrlimit (RLIMIT_AS, &limit) < 0) | ||
| 1358 | return 77; | ||
| 1359 | #endif | ||
| 1360 | /* Some printf implementations allocate temporary space on the stack. */ | ||
| 1361 | #ifdef RLIMIT_STACK | ||
| 1362 | if (getrlimit (RLIMIT_STACK, &limit) < 0) | ||
| 1363 | return 77; | ||
| 1364 | if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) | ||
| 1365 | limit.rlim_max = 5000000; | ||
| 1366 | limit.rlim_cur = limit.rlim_max; | ||
| 1367 | if (setrlimit (RLIMIT_STACK, &limit) < 0) | ||
| 1368 | return 77; | ||
| 1369 | #endif | ||
| 1370 | ret = printf ("%.5000000f", 1.0); | ||
| 1371 | return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); | ||
| 1372 | } | ||
| 1373 | ]])]) | ||
| 1374 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | ||
| 1375 | (./conftest 2>&AS_MESSAGE_LOG_FD | ||
| 1376 | result=$? | ||
| 1377 | _AS_ECHO_LOG([\$? = $result]) | ||
| 1378 | if test $result != 0 && test $result != 77; then result=1; fi | ||
| 1379 | exit $result | ||
| 1380 | ) >/dev/null 2>/dev/null | ||
| 1381 | case $? in | ||
| 1382 | 0) gl_cv_func_printf_enomem="yes" ;; | ||
| 1383 | 77) gl_cv_func_printf_enomem="guessing no" ;; | ||
| 1384 | *) gl_cv_func_printf_enomem="no" ;; | ||
| 1385 | esac | ||
| 1386 | else | ||
| 1387 | gl_cv_func_printf_enomem="guessing no" | ||
| 1388 | fi | ||
| 1389 | rm -fr conftest* | ||
| 1390 | else | ||
| 1391 | dnl A universal build on Apple Mac OS X platforms. | ||
| 1392 | dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. | ||
| 1393 | dnl But we need a configuration result that is valid in both modes. | ||
| 1394 | gl_cv_func_printf_enomem="guessing no" | ||
| 1395 | fi | ||
| 1396 | fi | ||
| 1397 | if test "$gl_cv_func_printf_enomem" = "guessing no"; then | ||
| 1398 | changequote(,)dnl | ||
| 1399 | case "$host_os" in | ||
| 1400 | # Guess yes on glibc systems. | ||
| 1401 | *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1402 | # Guess yes on Solaris. | ||
| 1403 | solaris*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1404 | # Guess yes on AIX. | ||
| 1405 | aix*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1406 | # Guess yes on HP-UX/hppa. | ||
| 1407 | hpux*) case "$host_cpu" in | ||
| 1408 | hppa*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1409 | *) gl_cv_func_printf_enomem="guessing no";; | ||
| 1410 | esac | ||
| 1411 | ;; | ||
| 1412 | # Guess yes on IRIX. | ||
| 1413 | irix*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1414 | # Guess yes on OSF/1. | ||
| 1415 | osf*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1416 | # Guess yes on BeOS. | ||
| 1417 | beos*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1418 | # Guess yes on Haiku. | ||
| 1419 | haiku*) gl_cv_func_printf_enomem="guessing yes";; | ||
| 1420 | # Guess no on Android. | ||
| 1421 | linux*-android*) gl_cv_func_printf_enomem="guessing no";; | ||
| 1422 | # If we don't know, obey --enable-cross-guesses. | ||
| 1423 | *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; | ||
| 1424 | esac | ||
| 1425 | changequote([,])dnl | ||
| 1426 | fi | ||
| 1427 | ]) | ||
| 1428 | ]) | ||
| 1429 | |||
| 1430 | dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) | ||
| 1431 | dnl Result is ac_cv_func_snprintf. | ||
| 1432 | |||
| 1433 | AC_DEFUN([gl_SNPRINTF_PRESENCE], | ||
| 1434 | [ | ||
| 1435 | AC_CHECK_FUNCS_ONCE([snprintf]) | ||
| 1436 | ]) | ||
| 1437 | |||
| 1438 | dnl Test whether the string produced by the snprintf function is always NUL | ||
| 1439 | dnl terminated. (ISO C99, POSIX:2001) | ||
| 1440 | dnl Result is gl_cv_func_snprintf_truncation_c99. | ||
| 1441 | |||
| 1442 | AC_DEFUN_ONCE([gl_SNPRINTF_TRUNCATION_C99], | ||
| 1443 | [ | ||
| 1444 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1445 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1446 | AC_REQUIRE([gl_SNPRINTF_PRESENCE]) | ||
| 1447 | AC_CACHE_CHECK([whether snprintf truncates the result as in C99], | ||
| 1448 | [gl_cv_func_snprintf_truncation_c99], | ||
| 1449 | [ | ||
| 1450 | AC_RUN_IFELSE( | ||
| 1451 | [AC_LANG_SOURCE([[ | ||
| 1452 | #include <stdio.h> | ||
| 1453 | #include <string.h> | ||
| 1454 | #if HAVE_SNPRINTF | ||
| 1455 | # define my_snprintf snprintf | ||
| 1456 | #else | ||
| 1457 | # include <stdarg.h> | ||
| 1458 | static int my_snprintf (char *buf, int size, const char *format, ...) | ||
| 1459 | { | ||
| 1460 | va_list args; | ||
| 1461 | int ret; | ||
| 1462 | va_start (args, format); | ||
| 1463 | ret = vsnprintf (buf, size, format, args); | ||
| 1464 | va_end (args); | ||
| 1465 | return ret; | ||
| 1466 | } | ||
| 1467 | #endif | ||
| 1468 | static char buf[100]; | ||
| 1469 | int main () | ||
| 1470 | { | ||
| 1471 | strcpy (buf, "ABCDEF"); | ||
| 1472 | my_snprintf (buf, 3, "%d %d", 4567, 89); | ||
| 1473 | if (memcmp (buf, "45\0DEF", 6) != 0) | ||
| 1474 | return 1; | ||
| 1475 | return 0; | ||
| 1476 | }]])], | ||
| 1477 | [gl_cv_func_snprintf_truncation_c99=yes], | ||
| 1478 | [gl_cv_func_snprintf_truncation_c99=no], | ||
| 1479 | [ | ||
| 1480 | changequote(,)dnl | ||
| 1481 | case "$host_os" in | ||
| 1482 | # Guess yes on glibc systems. | ||
| 1483 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1484 | # Guess yes on musl systems. | ||
| 1485 | *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1486 | # Guess yes on FreeBSD >= 5. | ||
| 1487 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1488 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1489 | midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1490 | # Guess yes on Mac OS X >= 10.3. | ||
| 1491 | darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1492 | darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1493 | # Guess yes on OpenBSD >= 3.9. | ||
| 1494 | openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) | ||
| 1495 | gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1496 | openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1497 | # Guess yes on Solaris >= 2.6. | ||
| 1498 | solaris2.[0-5] | solaris2.[0-5].*) | ||
| 1499 | gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1500 | solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1501 | # Guess yes on AIX >= 4. | ||
| 1502 | aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1503 | aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1504 | # Guess yes on HP-UX >= 11. | ||
| 1505 | hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1506 | hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1507 | # Guess yes on IRIX >= 6.5. | ||
| 1508 | irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1509 | # Guess yes on OSF/1 >= 5. | ||
| 1510 | osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1511 | osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1512 | # Guess yes on NetBSD >= 3. | ||
| 1513 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | ||
| 1514 | gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1515 | netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1516 | # Guess yes on BeOS. | ||
| 1517 | beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1518 | # Guess yes on Android. | ||
| 1519 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | ||
| 1520 | # Guess no on native Windows. | ||
| 1521 | mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; | ||
| 1522 | # If we don't know, obey --enable-cross-guesses. | ||
| 1523 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; | ||
| 1524 | esac | ||
| 1525 | changequote([,])dnl | ||
| 1526 | ]) | ||
| 1527 | ]) | ||
| 1528 | ]) | ||
| 1529 | |||
| 1530 | dnl Test whether the return value of the snprintf function is the number | ||
| 1531 | dnl of bytes (excluding the terminating NUL) that would have been produced | ||
| 1532 | dnl if the buffer had been large enough. (ISO C99, POSIX:2001) | ||
| 1533 | dnl For example, this test program fails on IRIX 6.5: | ||
| 1534 | dnl --------------------------------------------------------------------- | ||
| 1535 | dnl #include <stdio.h> | ||
| 1536 | dnl int main() | ||
| 1537 | dnl { | ||
| 1538 | dnl static char buf[8]; | ||
| 1539 | dnl int retval = snprintf (buf, 3, "%d", 12345); | ||
| 1540 | dnl return retval >= 0 && retval < 3; | ||
| 1541 | dnl } | ||
| 1542 | dnl --------------------------------------------------------------------- | ||
| 1543 | dnl Result is gl_cv_func_snprintf_retval_c99. | ||
| 1544 | |||
| 1545 | AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], | ||
| 1546 | [ | ||
| 1547 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1548 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1549 | AC_REQUIRE([gl_SNPRINTF_PRESENCE]) | ||
| 1550 | AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], | ||
| 1551 | [gl_cv_func_snprintf_retval_c99], | ||
| 1552 | [ | ||
| 1553 | AC_RUN_IFELSE( | ||
| 1554 | [AC_LANG_SOURCE([[ | ||
| 1555 | #include <stdio.h> | ||
| 1556 | #include <string.h> | ||
| 1557 | #if HAVE_SNPRINTF | ||
| 1558 | # define my_snprintf snprintf | ||
| 1559 | #else | ||
| 1560 | # include <stdarg.h> | ||
| 1561 | static int my_snprintf (char *buf, int size, const char *format, ...) | ||
| 1562 | { | ||
| 1563 | va_list args; | ||
| 1564 | int ret; | ||
| 1565 | va_start (args, format); | ||
| 1566 | ret = vsnprintf (buf, size, format, args); | ||
| 1567 | va_end (args); | ||
| 1568 | return ret; | ||
| 1569 | } | ||
| 1570 | #endif | ||
| 1571 | static char buf[100]; | ||
| 1572 | int main () | ||
| 1573 | { | ||
| 1574 | strcpy (buf, "ABCDEF"); | ||
| 1575 | if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) | ||
| 1576 | return 1; | ||
| 1577 | if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) | ||
| 1578 | return 2; | ||
| 1579 | if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) | ||
| 1580 | return 3; | ||
| 1581 | return 0; | ||
| 1582 | }]])], | ||
| 1583 | [gl_cv_func_snprintf_retval_c99=yes], | ||
| 1584 | [gl_cv_func_snprintf_retval_c99=no], | ||
| 1585 | [case "$host_os" in | ||
| 1586 | changequote(,)dnl | ||
| 1587 | # Guess yes on glibc systems. | ||
| 1588 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1589 | # Guess yes on musl systems. | ||
| 1590 | *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1591 | # Guess yes on FreeBSD >= 5. | ||
| 1592 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; | ||
| 1593 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1594 | midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1595 | # Guess yes on Mac OS X >= 10.3. | ||
| 1596 | darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; | ||
| 1597 | darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1598 | # Guess yes on OpenBSD >= 3.9. | ||
| 1599 | openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) | ||
| 1600 | gl_cv_func_snprintf_retval_c99="guessing no";; | ||
| 1601 | openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1602 | # Guess yes on Solaris >= 2.10. | ||
| 1603 | solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; | ||
| 1604 | solaris*) gl_cv_func_printf_sizes_c99="guessing no";; | ||
| 1605 | # Guess yes on AIX >= 4. | ||
| 1606 | aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; | ||
| 1607 | aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1608 | # Guess yes on NetBSD >= 3. | ||
| 1609 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | ||
| 1610 | gl_cv_func_snprintf_retval_c99="guessing no";; | ||
| 1611 | netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1612 | # Guess yes on BeOS. | ||
| 1613 | beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1614 | # Guess yes on Android. | ||
| 1615 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; | ||
| 1616 | changequote([,])dnl | ||
| 1617 | # Guess yes on MSVC, no on mingw. | ||
| 1618 | mingw*) AC_EGREP_CPP([Known], [ | ||
| 1619 | #ifdef _MSC_VER | ||
| 1620 | Known | ||
| 1621 | #endif | ||
| 1622 | ], | ||
| 1623 | [gl_cv_func_snprintf_retval_c99="guessing yes"], | ||
| 1624 | [gl_cv_func_snprintf_retval_c99="guessing no"]) | ||
| 1625 | ;; | ||
| 1626 | # If we don't know, obey --enable-cross-guesses. | ||
| 1627 | *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; | ||
| 1628 | esac | ||
| 1629 | ]) | ||
| 1630 | ]) | ||
| 1631 | ]) | ||
| 1632 | |||
| 1633 | dnl Test whether the snprintf function supports the %n format directive | ||
| 1634 | dnl also in truncated portions of the format string. (ISO C99, POSIX:2001) | ||
| 1635 | dnl Result is gl_cv_func_snprintf_directive_n. | ||
| 1636 | |||
| 1637 | AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], | ||
| 1638 | [ | ||
| 1639 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1640 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1641 | AC_REQUIRE([gl_SNPRINTF_PRESENCE]) | ||
| 1642 | AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], | ||
| 1643 | [gl_cv_func_snprintf_directive_n], | ||
| 1644 | [ | ||
| 1645 | AC_RUN_IFELSE( | ||
| 1646 | [AC_LANG_SOURCE([[ | ||
| 1647 | #include <stdio.h> | ||
| 1648 | #include <string.h> | ||
| 1649 | #if HAVE_SNPRINTF | ||
| 1650 | # define my_snprintf snprintf | ||
| 1651 | #else | ||
| 1652 | # include <stdarg.h> | ||
| 1653 | static int my_snprintf (char *buf, int size, const char *format, ...) | ||
| 1654 | { | ||
| 1655 | va_list args; | ||
| 1656 | int ret; | ||
| 1657 | va_start (args, format); | ||
| 1658 | ret = vsnprintf (buf, size, format, args); | ||
| 1659 | va_end (args); | ||
| 1660 | return ret; | ||
| 1661 | } | ||
| 1662 | #endif | ||
| 1663 | static char fmtstring[10]; | ||
| 1664 | static char buf[100]; | ||
| 1665 | int main () | ||
| 1666 | { | ||
| 1667 | int count = -1; | ||
| 1668 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | ||
| 1669 | support %n in format strings in read-only memory but not in writable | ||
| 1670 | memory. */ | ||
| 1671 | strcpy (fmtstring, "%d %n"); | ||
| 1672 | my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); | ||
| 1673 | if (count != 6) | ||
| 1674 | return 1; | ||
| 1675 | return 0; | ||
| 1676 | }]])], | ||
| 1677 | [gl_cv_func_snprintf_directive_n=yes], | ||
| 1678 | [gl_cv_func_snprintf_directive_n=no], | ||
| 1679 | [ | ||
| 1680 | case "$host_os" in | ||
| 1681 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. | ||
| 1682 | *-gnu* | gnu*) AC_COMPILE_IFELSE( | ||
| 1683 | [AC_LANG_SOURCE( | ||
| 1684 | [[#if _FORTIFY_SOURCE >= 2 | ||
| 1685 | error fail | ||
| 1686 | #endif | ||
| 1687 | ]])], | ||
| 1688 | [gl_cv_func_snprintf_directive_n="guessing yes"], | ||
| 1689 | [gl_cv_func_snprintf_directive_n="guessing no"]) | ||
| 1690 | ;; | ||
| 1691 | changequote(,)dnl | ||
| 1692 | # Guess yes on musl systems. | ||
| 1693 | *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1694 | # Guess yes on FreeBSD >= 5. | ||
| 1695 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1696 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1697 | midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1698 | # Guess yes on Mac OS X >= 10.3. | ||
| 1699 | darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1700 | darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1701 | # Guess yes on Solaris >= 2.6. | ||
| 1702 | solaris2.[0-5] | solaris2.[0-5].*) | ||
| 1703 | gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1704 | solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1705 | # Guess yes on AIX >= 4. | ||
| 1706 | aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1707 | aix*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1708 | # Guess yes on IRIX >= 6.5. | ||
| 1709 | irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1710 | # Guess yes on OSF/1 >= 5. | ||
| 1711 | osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1712 | osf*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1713 | # Guess yes on NetBSD >= 3. | ||
| 1714 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | ||
| 1715 | gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1716 | netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1717 | # Guess yes on BeOS. | ||
| 1718 | beos*) gl_cv_func_snprintf_directive_n="guessing yes";; | ||
| 1719 | # Guess no on Android. | ||
| 1720 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1721 | # Guess no on native Windows. | ||
| 1722 | mingw*) gl_cv_func_snprintf_directive_n="guessing no";; | ||
| 1723 | # If we don't know, obey --enable-cross-guesses. | ||
| 1724 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; | ||
| 1725 | changequote([,])dnl | ||
| 1726 | esac | ||
| 1727 | ]) | ||
| 1728 | ]) | ||
| 1729 | ]) | ||
| 1730 | |||
| 1731 | dnl Test whether the snprintf function, when passed a size = 1, writes any | ||
| 1732 | dnl output without bounds in this case, behaving like sprintf. This is the | ||
| 1733 | dnl case on Linux libc5. | ||
| 1734 | dnl Result is gl_cv_func_snprintf_size1. | ||
| 1735 | |||
| 1736 | AC_DEFUN([gl_SNPRINTF_SIZE1], | ||
| 1737 | [ | ||
| 1738 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1739 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1740 | AC_REQUIRE([gl_SNPRINTF_PRESENCE]) | ||
| 1741 | AC_CACHE_CHECK([whether snprintf respects a size of 1], | ||
| 1742 | [gl_cv_func_snprintf_size1], | ||
| 1743 | [ | ||
| 1744 | AC_RUN_IFELSE( | ||
| 1745 | [AC_LANG_SOURCE([[ | ||
| 1746 | #include <stdio.h> | ||
| 1747 | #if HAVE_SNPRINTF | ||
| 1748 | # define my_snprintf snprintf | ||
| 1749 | #else | ||
| 1750 | # include <stdarg.h> | ||
| 1751 | static int my_snprintf (char *buf, int size, const char *format, ...) | ||
| 1752 | { | ||
| 1753 | va_list args; | ||
| 1754 | int ret; | ||
| 1755 | va_start (args, format); | ||
| 1756 | ret = vsnprintf (buf, size, format, args); | ||
| 1757 | va_end (args); | ||
| 1758 | return ret; | ||
| 1759 | } | ||
| 1760 | #endif | ||
| 1761 | int main() | ||
| 1762 | { | ||
| 1763 | static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; | ||
| 1764 | my_snprintf (buf, 1, "%d", 12345); | ||
| 1765 | return buf[1] != 'E'; | ||
| 1766 | }]])], | ||
| 1767 | [gl_cv_func_snprintf_size1=yes], | ||
| 1768 | [gl_cv_func_snprintf_size1=no], | ||
| 1769 | [case "$host_os" in | ||
| 1770 | # Guess yes on Android. | ||
| 1771 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; | ||
| 1772 | # Guess yes on native Windows. | ||
| 1773 | mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; | ||
| 1774 | *) gl_cv_func_snprintf_size1="guessing yes" ;; | ||
| 1775 | esac | ||
| 1776 | ]) | ||
| 1777 | ]) | ||
| 1778 | ]) | ||
| 1779 | |||
| 1780 | dnl Test whether the vsnprintf function, when passed a zero size, produces no | ||
| 1781 | dnl output. (ISO C99, POSIX:2001) | ||
| 1782 | dnl For example, snprintf nevertheless writes a NUL byte in this case | ||
| 1783 | dnl on OSF/1 5.1: | ||
| 1784 | dnl --------------------------------------------------------------------- | ||
| 1785 | dnl #include <stdio.h> | ||
| 1786 | dnl int main() | ||
| 1787 | dnl { | ||
| 1788 | dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; | ||
| 1789 | dnl snprintf (buf, 0, "%d", 12345); | ||
| 1790 | dnl return buf[0] != 'D'; | ||
| 1791 | dnl } | ||
| 1792 | dnl --------------------------------------------------------------------- | ||
| 1793 | dnl And vsnprintf writes any output without bounds in this case, behaving like | ||
| 1794 | dnl vsprintf, on HP-UX 11 and OSF/1 5.1: | ||
| 1795 | dnl --------------------------------------------------------------------- | ||
| 1796 | dnl #include <stdarg.h> | ||
| 1797 | dnl #include <stdio.h> | ||
| 1798 | dnl static int my_snprintf (char *buf, int size, const char *format, ...) | ||
| 1799 | dnl { | ||
| 1800 | dnl va_list args; | ||
| 1801 | dnl int ret; | ||
| 1802 | dnl va_start (args, format); | ||
| 1803 | dnl ret = vsnprintf (buf, size, format, args); | ||
| 1804 | dnl va_end (args); | ||
| 1805 | dnl return ret; | ||
| 1806 | dnl } | ||
| 1807 | dnl int main() | ||
| 1808 | dnl { | ||
| 1809 | dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; | ||
| 1810 | dnl my_snprintf (buf, 0, "%d", 12345); | ||
| 1811 | dnl return buf[0] != 'D'; | ||
| 1812 | dnl } | ||
| 1813 | dnl --------------------------------------------------------------------- | ||
| 1814 | dnl Result is gl_cv_func_vsnprintf_zerosize_c99. | ||
| 1815 | |||
| 1816 | AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], | ||
| 1817 | [ | ||
| 1818 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1819 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1820 | AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], | ||
| 1821 | [gl_cv_func_vsnprintf_zerosize_c99], | ||
| 1822 | [ | ||
| 1823 | AC_RUN_IFELSE( | ||
| 1824 | [AC_LANG_SOURCE([[ | ||
| 1825 | #include <stdarg.h> | ||
| 1826 | #include <stdio.h> | ||
| 1827 | static int my_snprintf (char *buf, int size, const char *format, ...) | ||
| 1828 | { | ||
| 1829 | va_list args; | ||
| 1830 | int ret; | ||
| 1831 | va_start (args, format); | ||
| 1832 | ret = vsnprintf (buf, size, format, args); | ||
| 1833 | va_end (args); | ||
| 1834 | return ret; | ||
| 1835 | } | ||
| 1836 | int main() | ||
| 1837 | { | ||
| 1838 | static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; | ||
| 1839 | my_snprintf (buf, 0, "%d", 12345); | ||
| 1840 | return buf[0] != 'D'; | ||
| 1841 | }]])], | ||
| 1842 | [gl_cv_func_vsnprintf_zerosize_c99=yes], | ||
| 1843 | [gl_cv_func_vsnprintf_zerosize_c99=no], | ||
| 1844 | [ | ||
| 1845 | changequote(,)dnl | ||
| 1846 | case "$host_os" in | ||
| 1847 | # Guess yes on glibc systems. | ||
| 1848 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1849 | # Guess yes on musl systems. | ||
| 1850 | *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1851 | # Guess yes on FreeBSD >= 5. | ||
| 1852 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | ||
| 1853 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1854 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1855 | # Guess yes on Mac OS X >= 10.3. | ||
| 1856 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | ||
| 1857 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1858 | # Guess yes on Cygwin. | ||
| 1859 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1860 | # Guess yes on Solaris >= 2.6. | ||
| 1861 | solaris2.[0-5] | solaris2.[0-5].*) | ||
| 1862 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | ||
| 1863 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1864 | # Guess yes on AIX >= 4. | ||
| 1865 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | ||
| 1866 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1867 | # Guess yes on IRIX >= 6.5. | ||
| 1868 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1869 | # Guess yes on NetBSD >= 3. | ||
| 1870 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | ||
| 1871 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | ||
| 1872 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1873 | # Guess yes on BeOS. | ||
| 1874 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1875 | # Guess yes on Android. | ||
| 1876 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1877 | # Guess yes on native Windows. | ||
| 1878 | mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | ||
| 1879 | # If we don't know, obey --enable-cross-guesses. | ||
| 1880 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; | ||
| 1881 | esac | ||
| 1882 | changequote([,])dnl | ||
| 1883 | ]) | ||
| 1884 | ]) | ||
| 1885 | ]) | ||
| 1886 | |||
| 1887 | dnl Test whether the swprintf function works correctly when it produces output | ||
| 1888 | dnl that contains null wide characters. | ||
| 1889 | dnl Result is gl_cv_func_swprintf_works. | ||
| 1890 | |||
| 1891 | AC_DEFUN([gl_SWPRINTF_WORKS], | ||
| 1892 | [ | ||
| 1893 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1894 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1895 | AC_CHECK_FUNCS_ONCE([swprintf]) | ||
| 1896 | AC_CACHE_CHECK([whether swprintf works], | ||
| 1897 | [gl_cv_func_swprintf_works], | ||
| 1898 | [ | ||
| 1899 | AC_RUN_IFELSE( | ||
| 1900 | [AC_LANG_SOURCE([[ | ||
| 1901 | #ifndef __USE_MINGW_ANSI_STDIO | ||
| 1902 | # define __USE_MINGW_ANSI_STDIO 1 | ||
| 1903 | #endif | ||
| 1904 | #include <stdio.h> | ||
| 1905 | #include <wchar.h> | ||
| 1906 | int main() | ||
| 1907 | { | ||
| 1908 | int result = 0; | ||
| 1909 | { /* This test fails on musl libc 1.2.3, FreeBSD, NetBSD, OpenBSD, macOS, AIX. */ | ||
| 1910 | wchar_t buf[5] = { 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF }; | ||
| 1911 | int ret = swprintf (buf, 4, L"%cz", '\0'); | ||
| 1912 | /* Expected result: | ||
| 1913 | ret = 2, buf[0] = 0x0, buf[1] = 0x7a, buf[2] = 0x0, buf[3] = 0xbeef | ||
| 1914 | musl libc 1.2.3: | ||
| 1915 | ret = 2, buf[0] = 0x0, buf[1] = 0x0, buf[2] = 0x0, buf[3] = 0x0 | ||
| 1916 | Reported at <https://www.openwall.com/lists/musl/2023/03/22/9>. | ||
| 1917 | FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2: | ||
| 1918 | ret = 2, buf[0] = 0x0, buf[1] = 0xbeef, buf[2] = 0xbeef, buf[3] = 0xbeef | ||
| 1919 | */ | ||
| 1920 | if (ret < 0 || buf[1] != 'z') | ||
| 1921 | result |= 1; | ||
| 1922 | } | ||
| 1923 | { /* This test fails on mingw. */ | ||
| 1924 | wchar_t buf[2]; | ||
| 1925 | int ret = swprintf (buf, 2, L"%lc", (wint_t)0); | ||
| 1926 | /* Expected: ret = 1 | ||
| 1927 | mingw: ret = 0 | ||
| 1928 | */ | ||
| 1929 | if (ret != 1) | ||
| 1930 | result |= 2; | ||
| 1931 | } | ||
| 1932 | return result; | ||
| 1933 | }]])], | ||
| 1934 | [gl_cv_func_swprintf_works=yes], | ||
| 1935 | [gl_cv_func_swprintf_works=no], | ||
| 1936 | [case "$host_os" in | ||
| 1937 | # Guess yes on glibc systems. | ||
| 1938 | *-gnu* | gnu*) gl_cv_func_swprintf_works="guessing yes";; | ||
| 1939 | # Guess no on musl systems. | ||
| 1940 | *-musl* | midipix*) gl_cv_func_swprintf_works="guessing no";; | ||
| 1941 | # Guess no on FreeBSD, NetBSD, OpenBSD, macOS, AIX. | ||
| 1942 | freebsd* | midnightbsd* | netbsd* | openbsd* | darwin* | aix*) | ||
| 1943 | gl_cv_func_swprintf_works="guessing no";; | ||
| 1944 | # Guess no on native Windows. | ||
| 1945 | mingw* | pw*) gl_cv_func_swprintf_works="guessing no";; | ||
| 1946 | # If we don't know, obey --enable-cross-guesses. | ||
| 1947 | *) gl_cv_func_swprintf_works="$gl_cross_guess_normal";; | ||
| 1948 | esac | ||
| 1949 | ]) | ||
| 1950 | ]) | ||
| 1951 | ]) | ||
| 1952 | |||
| 1953 | dnl Test whether the *wprintf family of functions supports the 'a' and 'A' | ||
| 1954 | dnl conversion specifier for hexadecimal output of 'long double' numbers. | ||
| 1955 | dnl (ISO C99, POSIX:2001) | ||
| 1956 | dnl Result is gl_cv_func_swprintf_directive_la. | ||
| 1957 | |||
| 1958 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LA], | ||
| 1959 | [ | ||
| 1960 | AC_REQUIRE([AC_PROG_CC]) | ||
| 1961 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 1962 | AC_CACHE_CHECK([whether swprintf supports the 'La' and 'LA' directives], | ||
| 1963 | [gl_cv_func_swprintf_directive_la], | ||
| 1964 | [ | ||
| 1965 | AC_RUN_IFELSE( | ||
| 1966 | [AC_LANG_SOURCE([[ | ||
| 1967 | #include <stdio.h> | ||
| 1968 | #include <wchar.h> | ||
| 1969 | static wchar_t buf[100]; | ||
| 1970 | int main () | ||
| 1971 | { | ||
| 1972 | int result = 0; | ||
| 1973 | /* This catches a glibc 2.15 and Haiku 2022 bug. */ | ||
| 1974 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
| 1975 | L"%La %d", 3.1416015625L, 33, 44, 55) < 0 | ||
| 1976 | || (wcscmp (buf, L"0x1.922p+1 33") != 0 | ||
| 1977 | && wcscmp (buf, L"0x3.244p+0 33") != 0 | ||
| 1978 | && wcscmp (buf, L"0x6.488p-1 33") != 0 | ||
| 1979 | && wcscmp (buf, L"0xc.91p-2 33") != 0)) | ||
| 1980 | result |= 1; | ||
| 1981 | return result; | ||
| 1982 | }]])], | ||
| 1983 | [gl_cv_func_swprintf_directive_la=yes], | ||
| 1984 | [gl_cv_func_swprintf_directive_la=no], | ||
| 1985 | [case "$host_os" in | ||
| 1986 | # Guess yes on glibc >= 2.17 systems. | ||
| 1987 | *-gnu* | gnu*) | ||
| 1988 | AC_EGREP_CPP([Unlucky], [ | ||
| 1989 | #include <features.h> | ||
| 1990 | #ifdef __GNU_LIBRARY__ | ||
| 1991 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)) && !defined __UCLIBC__ | ||
| 1992 | Unlucky | ||
| 1993 | #endif | ||
| 1994 | #endif | ||
| 1995 | ], | ||
| 1996 | [gl_cv_func_swprintf_directive_la="guessing yes"], | ||
| 1997 | [gl_cv_func_swprintf_directive_la="guessing no"]) | ||
| 1998 | ;; | ||
| 1999 | # Guess yes on musl systems. | ||
| 2000 | *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
| 2001 | # Guess yes on Android. | ||
| 2002 | linux*-android*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
| 2003 | # Guess no on native Windows. | ||
| 2004 | mingw*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
| 2005 | # If we don't know, obey --enable-cross-guesses. | ||
| 2006 | *) gl_cv_func_swprintf_directive_la="$gl_cross_guess_normal";; | ||
| 2007 | esac | ||
| 2008 | ]) | ||
| 2009 | ]) | ||
| 2010 | ]) | ||
| 2011 | |||
| 2012 | dnl Test whether the *wprintf family of functions supports the 'lc' conversion | ||
| 2013 | dnl specifier for all wide characters. | ||
| 2014 | dnl (ISO C11, POSIX:2001) | ||
| 2015 | dnl Result is gl_cv_func_swprintf_directive_lc. | ||
| 2016 | |||
| 2017 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LC], | ||
| 2018 | [ | ||
| 2019 | AC_REQUIRE([AC_PROG_CC]) | ||
| 2020 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 2021 | AC_CACHE_CHECK([whether swprintf supports the 'lc' directive], | ||
| 2022 | [gl_cv_func_swprintf_directive_lc], | ||
| 2023 | [ | ||
| 2024 | AC_RUN_IFELSE( | ||
| 2025 | [AC_LANG_SOURCE([[ | ||
| 2026 | #include <stdio.h> | ||
| 2027 | #include <wchar.h> | ||
| 2028 | static wchar_t buf[100]; | ||
| 2029 | static wint_t L_invalid = (wchar_t) 0x76543210; | ||
| 2030 | int main () | ||
| 2031 | { | ||
| 2032 | int result = 0; | ||
| 2033 | /* This catches a musl libc 1.2.4, Android bug. | ||
| 2034 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/3>. */ | ||
| 2035 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
| 2036 | L"%lc %d", L_invalid, 33, 44, 55) < 0) | ||
| 2037 | result |= 1; | ||
| 2038 | return result; | ||
| 2039 | }]])], | ||
| 2040 | [gl_cv_func_swprintf_directive_lc=yes], | ||
| 2041 | [gl_cv_func_swprintf_directive_lc=no], | ||
| 2042 | [case "$host_os" in | ||
| 2043 | # Guess yes on glibc systems. | ||
| 2044 | *-gnu* | gnu*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
| 2045 | # Guess no on musl systems. | ||
| 2046 | *-musl* | midipix*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
| 2047 | # Guess no on Android. | ||
| 2048 | linux*-android*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
| 2049 | # Guess yes on native Windows. | ||
| 2050 | mingw*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
| 2051 | # If we don't know, obey --enable-cross-guesses. | ||
| 2052 | *) gl_cv_func_swprintf_directive_lc="$gl_cross_guess_normal";; | ||
| 2053 | esac | ||
| 2054 | ]) | ||
| 2055 | ]) | ||
| 2056 | ]) | ||
| 2057 | |||
| 2058 | dnl The results of these tests on various platforms are: | ||
| 2059 | dnl | ||
| 2060 | dnl 1 = gl_PRINTF_SIZES_C99 | ||
| 2061 | dnl 2 = gl_PRINTF_SIZES_C23 | ||
| 2062 | dnl 3 = gl_PRINTF_LONG_DOUBLE | ||
| 2063 | dnl 4 = gl_PRINTF_INFINITE | ||
| 2064 | dnl 5 = gl_PRINTF_INFINITE_LONG_DOUBLE | ||
| 2065 | dnl 6 = gl_PRINTF_DIRECTIVE_A | ||
| 2066 | dnl 7 = gl_PRINTF_DIRECTIVE_B | ||
| 2067 | dnl 8 = gl_PRINTF_DIRECTIVE_UPPERCASE_B | ||
| 2068 | dnl 9 = gl_PRINTF_DIRECTIVE_F | ||
| 2069 | dnl 10 = gl_PRINTF_DIRECTIVE_N | ||
| 2070 | dnl 11 = gl_PRINTF_DIRECTIVE_LS | ||
| 2071 | dnl 12 = gl_PRINTF_DIRECTIVE_LC | ||
| 2072 | dnl 13 = gl_PRINTF_POSITIONS | ||
| 2073 | dnl 14 = gl_PRINTF_FLAG_GROUPING | ||
| 2074 | dnl 15 = gl_PRINTF_FLAG_LEFTADJUST | ||
| 2075 | dnl 16 = gl_PRINTF_FLAG_ZERO | ||
| 2076 | dnl 17 = gl_PRINTF_PRECISION | ||
| 2077 | dnl 18 = gl_PRINTF_ENOMEM | ||
| 2078 | dnl 19 = gl_SNPRINTF_PRESENCE | ||
| 2079 | dnl 20 = gl_SNPRINTF_TRUNCATION_C99 | ||
| 2080 | dnl 21 = gl_SNPRINTF_RETVAL_C99 | ||
| 2081 | dnl 22 = gl_SNPRINTF_DIRECTIVE_N | ||
| 2082 | dnl 23 = gl_SNPRINTF_SIZE1 | ||
| 2083 | dnl 24 = gl_VSNPRINTF_ZEROSIZE_C99 | ||
| 2084 | dnl 25 = gl_SWPRINTF_WORKS | ||
| 2085 | dnl 26 = gl_SWPRINTF_DIRECTIVE_LA | ||
| 2086 | dnl 27 = gl_SWPRINTF_DIRECTIVE_LC | ||
| 2087 | dnl | ||
| 2088 | dnl 1 = checking whether printf supports size specifiers as in C99... | ||
| 2089 | dnl 2 = checking whether printf supports size specifiers as in C23... | ||
| 2090 | dnl 3 = checking whether printf supports 'long double' arguments... | ||
| 2091 | dnl 4 = checking whether printf supports infinite 'double' arguments... | ||
| 2092 | dnl 5 = checking whether printf supports infinite 'long double' arguments... | ||
| 2093 | dnl 6 = checking whether printf supports the 'a' and 'A' directives... | ||
| 2094 | dnl 7 = checking whether printf supports the 'b' directive... | ||
| 2095 | dnl 8 = checking whether printf supports the 'B' directive... | ||
| 2096 | dnl 9 = checking whether printf supports the 'F' directive... | ||
| 2097 | dnl 10 = checking whether printf supports the 'n' directive... | ||
| 2098 | dnl 11 = checking whether printf supports the 'ls' directive... | ||
| 2099 | dnl 12 = checking whether printf supports the 'lc' directive correctly... | ||
| 2100 | dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... | ||
| 2101 | dnl 14 = checking whether printf supports the grouping flag... | ||
| 2102 | dnl 15 = checking whether printf supports the left-adjust flag correctly... | ||
| 2103 | dnl 16 = checking whether printf supports the zero flag correctly... | ||
| 2104 | dnl 17 = checking whether printf supports large precisions... | ||
| 2105 | dnl 18 = checking whether printf survives out-of-memory conditions... | ||
| 2106 | dnl 19 = checking for snprintf... | ||
| 2107 | dnl 20 = checking whether snprintf truncates the result as in C99... | ||
| 2108 | dnl 21 = checking whether snprintf returns a byte count as in C99... | ||
| 2109 | dnl 22 = checking whether snprintf fully supports the 'n' directive... | ||
| 2110 | dnl 23 = checking whether snprintf respects a size of 1... | ||
| 2111 | dnl 24 = checking whether vsnprintf respects a zero size as in C99... | ||
| 2112 | dnl 25 = checking whether swprintf works... | ||
| 2113 | dnl 26 = checking whether swprintf supports the 'La' and 'LA' directives... | ||
| 2114 | dnl 27 = checking whether swprintf supports the 'lc' directive... | ||
| 2115 | dnl | ||
| 2116 | dnl . = yes, # = no. | ||
| 2117 | dnl | ||
| 2118 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ||
| 2119 | dnl musl libc 1.2.3 . # . . . . # # . . . . . . . . . . . . . . . . # . # | ||
| 2120 | dnl glibc 2.35 . # . . . . . . . . . # . . . . . . . . . . . . . . . | ||
| 2121 | dnl glibc 2.5 . # . . . . # # . . . # . . . . . . . . . . . . . # . | ||
| 2122 | dnl glibc 2.3.6 . # . . . # # # . . . # . . . . . . . . . . . . . # . | ||
| 2123 | dnl FreeBSD 13.0 . # . . . # # # . . . # . . . . . # . . . . . . # . # | ||
| 2124 | dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . # . . . # . # . . . . . . # ? ? | ||
| 2125 | dnl Mac OS X 10.13.5 . # . . # # # # . # . # . . . . . . . . . # . . # ? ? | ||
| 2126 | dnl Mac OS X 10.5.8 . # . . # # # # . . . # . . . # . . . . . . . . # ? ? | ||
| 2127 | dnl Mac OS X 10.3.9 . # . . . # # # . . . # . . . # . # . . . . . . # ? ? | ||
| 2128 | dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . # . . . . . # . . . . . . # . # | ||
| 2129 | dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # # . # . # . # . . . . . . # ? ? | ||
| 2130 | dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . . ? . . . . . . ? ? ? | ||
| 2131 | dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . . # . . . . . . ? ? ? | ||
| 2132 | dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # # # . . . . . . ? ? ? | ||
| 2133 | dnl Solaris 11.4 . # . # # # # # . . # # . . . # . . . . . . . . . # . | ||
| 2134 | dnl Solaris 11.3 . # . . . # # # . . # # . . . . . . . . . . . . . # . | ||
| 2135 | dnl Solaris 11.0 . # . # # # # # . . # # . . . # . . . . . . . . ? ? ? | ||
| 2136 | dnl Solaris 10 . # . # # # # # . . # # . . . # # . . . . . . . . # . | ||
| 2137 | dnl Solaris 2.6 ... 9 # # . # # # # # # . # # . . . # # . . . # . . . ? ? ? | ||
| 2138 | dnl Solaris 2.5.1 # # . # # # # # # . # # . . . # . . # # # # # # ? ? ? | ||
| 2139 | dnl AIX 7.1 . # . # # # # # . . . # . . . # # . . . . . . . # . . | ||
| 2140 | dnl AIX 5.2 . # . # # # # # . . . # . . . # . . . . . . . . # ? ? | ||
| 2141 | dnl AIX 4.3.2, 5.1 # # . # # # # # # . . # . . . # . . . . # . . . # ? ? | ||
| 2142 | dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # . . . . # # . . ? ? ? | ||
| 2143 | dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # . . . . # # . # ? ? ? | ||
| 2144 | dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # . . . . # # ? # ? ? ? | ||
| 2145 | dnl IRIX 6.5 # # . # # # # # # . # # . . . # . . . . # . . . # ? ? | ||
| 2146 | dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # . . . . # . . # ? ? ? | ||
| 2147 | dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # . . # # # # # # ? ? ? | ||
| 2148 | dnl NetBSD 9.0 . # . . . # # # . . . # . . . . . . . . . . . . # . # | ||
| 2149 | dnl NetBSD 5.0 . # . . # # # # . . . # . . . # . # . . . . . . # ? ? | ||
| 2150 | dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? # . ? ? ? ? ? . . . ? ? ? # ? ? | ||
| 2151 | dnl NetBSD 3.0 . # . . . # # # # . ? # # # ? # . # . . . . . . # ? ? | ||
| 2152 | dnl Haiku . # . . # # # # # . # ? . . . . . ? . . ? . . . . # . | ||
| 2153 | dnl BeOS # # # . # # # # # . ? ? # . ? . # ? . . ? . . . ? ? ? | ||
| 2154 | dnl Android 4.3 . # . # # # # # # # # ? . # . # . # . . . # . . ? ? ? | ||
| 2155 | dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # # ? . # # # . . # ? ? | ||
| 2156 | dnl MSVC 9 # # # # # # # # # # . ? # # . # # ? # # # # . . # ? ? | ||
| 2157 | dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . . ? . . . . . . # ? ? | ||
| 2158 | dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # # ? . # # # . . # ? ? | ||
diff --git a/m4/signbit.m4 b/m4/signbit.m4 deleted file mode 100644 index 2fea73f854c..00000000000 --- a/m4/signbit.m4 +++ /dev/null | |||
| @@ -1,393 +0,0 @@ | |||
| 1 | # signbit.m4 serial 21 | ||
| 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_SIGNBIT], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_MATH_H_DEFAULTS]) | ||
| 10 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 11 | AC_CACHE_CHECK([for signbit macro], [gl_cv_func_signbit], | ||
| 12 | [ | ||
| 13 | AC_RUN_IFELSE( | ||
| 14 | [AC_LANG_SOURCE([[ | ||
| 15 | #include <math.h> | ||
| 16 | /* If signbit is defined as a function, don't use it, since calling it for | ||
| 17 | 'float' or 'long double' arguments would involve conversions. | ||
| 18 | If signbit is not declared at all but exists as a library function, don't | ||
| 19 | use it, since the prototype may not match. | ||
| 20 | If signbit is not declared at all but exists as a compiler built-in, don't | ||
| 21 | use it, since it's preferable to use __builtin_signbit* (no warnings, | ||
| 22 | no conversions). */ | ||
| 23 | #ifndef signbit | ||
| 24 | # error "signbit should be a macro" | ||
| 25 | #endif | ||
| 26 | #include <string.h> | ||
| 27 | ]gl_SIGNBIT_TEST_PROGRAM | ||
| 28 | ])], | ||
| 29 | [gl_cv_func_signbit=yes], | ||
| 30 | [gl_cv_func_signbit=no], | ||
| 31 | [case "$host_os" in | ||
| 32 | # Guess yes on glibc systems. | ||
| 33 | *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;; | ||
| 34 | # Guess yes on musl systems. | ||
| 35 | *-musl* | midipix*) gl_cv_func_signbit="guessing yes" ;; | ||
| 36 | # Guess yes on native Windows. | ||
| 37 | mingw*) gl_cv_func_signbit="guessing yes" ;; | ||
| 38 | # If we don't know, obey --enable-cross-guesses. | ||
| 39 | *) gl_cv_func_signbit="$gl_cross_guess_normal" ;; | ||
| 40 | esac | ||
| 41 | ]) | ||
| 42 | ]) | ||
| 43 | dnl GCC >= 4.0 and clang provide three built-ins for signbit. | ||
| 44 | dnl They can be used without warnings, also in C++, regardless of <math.h>. | ||
| 45 | dnl But they may expand to calls to functions, which may or may not be in | ||
| 46 | dnl libc. | ||
| 47 | AC_CACHE_CHECK([for signbit compiler built-ins], | ||
| 48 | [gl_cv_func_signbit_builtins], | ||
| 49 | [ | ||
| 50 | AC_RUN_IFELSE( | ||
| 51 | [AC_LANG_SOURCE([[ | ||
| 52 | #if (__GNUC__ >= 4) || (__clang_major__ >= 4) | ||
| 53 | # define signbit(x) \ | ||
| 54 | (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ | ||
| 55 | sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ | ||
| 56 | __builtin_signbitf (x)) | ||
| 57 | #else | ||
| 58 | # error "signbit should be three compiler built-ins" | ||
| 59 | #endif | ||
| 60 | #include <string.h> | ||
| 61 | ]gl_SIGNBIT_TEST_PROGRAM | ||
| 62 | ])], | ||
| 63 | [gl_cv_func_signbit_builtins=yes], | ||
| 64 | [gl_cv_func_signbit_builtins=no], | ||
| 65 | [case "$host_os" in | ||
| 66 | # Guess yes on glibc systems. | ||
| 67 | *-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;; | ||
| 68 | # Guess yes on musl systems. | ||
| 69 | *-musl* | midipix*) gl_cv_func_signbit_builtins="guessing yes" ;; | ||
| 70 | # Guess yes on mingw, no on MSVC. | ||
| 71 | mingw*) if test -n "$GCC"; then | ||
| 72 | gl_cv_func_signbit_builtins="guessing yes" | ||
| 73 | else | ||
| 74 | gl_cv_func_signbit_builtins="guessing no" | ||
| 75 | fi | ||
| 76 | ;; | ||
| 77 | # If we don't know, obey --enable-cross-guesses. | ||
| 78 | *) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;; | ||
| 79 | esac | ||
| 80 | ]) | ||
| 81 | ]) | ||
| 82 | dnl Use the compiler built-ins whenever possible, because they are more | ||
| 83 | dnl efficient than the system library functions (if they exist). | ||
| 84 | case "$gl_cv_func_signbit_builtins" in | ||
| 85 | *yes) | ||
| 86 | REPLACE_SIGNBIT_USING_BUILTINS=1 | ||
| 87 | ;; | ||
| 88 | *) | ||
| 89 | case "$gl_cv_func_signbit" in | ||
| 90 | *yes) ;; | ||
| 91 | *) | ||
| 92 | dnl REPLACE_SIGNBIT=1 makes sure the signbit[fdl] functions get built. | ||
| 93 | REPLACE_SIGNBIT=1 | ||
| 94 | ;; | ||
| 95 | esac | ||
| 96 | ;; | ||
| 97 | esac | ||
| 98 | dnl On Solaris 10, with CC in C++ mode, signbit is not available although | ||
| 99 | dnl is with cc in C mode. This cannot be worked around by defining | ||
| 100 | dnl _XOPEN_SOURCE=600, because the latter does not work in C++ mode on | ||
| 101 | dnl Solaris 11.0. Therefore use the replacement functions on Solaris. | ||
| 102 | case "$host_os" in | ||
| 103 | solaris*) | ||
| 104 | REPLACE_SIGNBIT=1 | ||
| 105 | ;; | ||
| 106 | esac | ||
| 107 | if test $REPLACE_SIGNBIT = 1; then | ||
| 108 | gl_FLOAT_SIGN_LOCATION | ||
| 109 | gl_DOUBLE_SIGN_LOCATION | ||
| 110 | gl_LONG_DOUBLE_SIGN_LOCATION | ||
| 111 | if test "$gl_cv_cc_float_signbit" = unknown; then | ||
| 112 | dnl Test whether copysignf() is declared. | ||
| 113 | AC_CHECK_DECLS([copysignf], , , [[#include <math.h>]]) | ||
| 114 | if test "$ac_cv_have_decl_copysignf" = yes; then | ||
| 115 | dnl Test whether copysignf() can be used without libm. | ||
| 116 | AC_CACHE_CHECK([whether copysignf can be used without linking with libm], | ||
| 117 | [gl_cv_func_copysignf_no_libm], | ||
| 118 | [ | ||
| 119 | AC_LINK_IFELSE( | ||
| 120 | [AC_LANG_PROGRAM( | ||
| 121 | [[#include <math.h> | ||
| 122 | float x, y;]], | ||
| 123 | [[return copysignf (x, y) < 0;]])], | ||
| 124 | [gl_cv_func_copysignf_no_libm=yes], | ||
| 125 | [gl_cv_func_copysignf_no_libm=no]) | ||
| 126 | ]) | ||
| 127 | if test $gl_cv_func_copysignf_no_libm = yes; then | ||
| 128 | AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], [1], | ||
| 129 | [Define if the copysignf function is declared in <math.h> and available in libc.]) | ||
| 130 | fi | ||
| 131 | fi | ||
| 132 | fi | ||
| 133 | if test "$gl_cv_cc_double_signbit" = unknown; then | ||
| 134 | dnl Test whether copysign() is declared. | ||
| 135 | AC_CHECK_DECLS([copysign], , , [[#include <math.h>]]) | ||
| 136 | if test "$ac_cv_have_decl_copysign" = yes; then | ||
| 137 | dnl Test whether copysign() can be used without libm. | ||
| 138 | AC_CACHE_CHECK([whether copysign can be used without linking with libm], | ||
| 139 | [gl_cv_func_copysign_no_libm], | ||
| 140 | [ | ||
| 141 | AC_LINK_IFELSE( | ||
| 142 | [AC_LANG_PROGRAM( | ||
| 143 | [[#include <math.h> | ||
| 144 | double x, y;]], | ||
| 145 | [[return copysign (x, y) < 0;]])], | ||
| 146 | [gl_cv_func_copysign_no_libm=yes], | ||
| 147 | [gl_cv_func_copysign_no_libm=no]) | ||
| 148 | ]) | ||
| 149 | if test $gl_cv_func_copysign_no_libm = yes; then | ||
| 150 | AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], [1], | ||
| 151 | [Define if the copysign function is declared in <math.h> and available in libc.]) | ||
| 152 | fi | ||
| 153 | fi | ||
| 154 | fi | ||
| 155 | if test "$gl_cv_cc_long_double_signbit" = unknown; then | ||
| 156 | dnl Test whether copysignl() is declared. | ||
| 157 | AC_CHECK_DECLS([copysignl], , , [[#include <math.h>]]) | ||
| 158 | if test "$ac_cv_have_decl_copysignl" = yes; then | ||
| 159 | dnl Test whether copysignl() can be used without libm. | ||
| 160 | AC_CACHE_CHECK([whether copysignl can be used without linking with libm], | ||
| 161 | [gl_cv_func_copysignl_no_libm], | ||
| 162 | [ | ||
| 163 | AC_LINK_IFELSE( | ||
| 164 | [AC_LANG_PROGRAM( | ||
| 165 | [[#include <math.h> | ||
| 166 | long double x, y;]], | ||
| 167 | [[return copysignl (x, y) < 0;]])], | ||
| 168 | [gl_cv_func_copysignl_no_libm=yes], | ||
| 169 | [gl_cv_func_copysignl_no_libm=no]) | ||
| 170 | ]) | ||
| 171 | if test $gl_cv_func_copysignl_no_libm = yes; then | ||
| 172 | AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], [1], | ||
| 173 | [Define if the copysignl function is declared in <math.h> and available in libc.]) | ||
| 174 | fi | ||
| 175 | fi | ||
| 176 | fi | ||
| 177 | fi | ||
| 178 | ]) | ||
| 179 | |||
| 180 | AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[ | ||
| 181 | /* Global variables. | ||
| 182 | Needed because GCC 4 constant-folds __builtin_signbitl (literal) | ||
| 183 | but cannot constant-fold __builtin_signbitl (variable). */ | ||
| 184 | float vf; | ||
| 185 | double vd; | ||
| 186 | long double vl; | ||
| 187 | int main () | ||
| 188 | { | ||
| 189 | /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. | ||
| 190 | So we use -p0f and -p0d instead. */ | ||
| 191 | float p0f = 0.0f; | ||
| 192 | float m0f = -p0f; | ||
| 193 | double p0d = 0.0; | ||
| 194 | double m0d = -p0d; | ||
| 195 | /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. | ||
| 196 | So we use another constant expression instead. | ||
| 197 | But that expression does not work on other platforms, such as when | ||
| 198 | cross-compiling to PowerPC on Mac OS X 10.5. */ | ||
| 199 | long double p0l = 0.0L; | ||
| 200 | #if defined __hpux || defined __sgi | ||
| 201 | long double m0l = -LDBL_MIN * LDBL_MIN; | ||
| 202 | #else | ||
| 203 | long double m0l = -p0l; | ||
| 204 | #endif | ||
| 205 | int result = 0; | ||
| 206 | if (signbit (vf)) /* link check */ | ||
| 207 | vf++; | ||
| 208 | { | ||
| 209 | float plus_inf = 1.0f / p0f; | ||
| 210 | float minus_inf = -1.0f / p0f; | ||
| 211 | if (!(!signbit (255.0f) | ||
| 212 | && signbit (-255.0f) | ||
| 213 | && !signbit (p0f) | ||
| 214 | && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) | ||
| 215 | && !signbit (plus_inf) | ||
| 216 | && signbit (minus_inf))) | ||
| 217 | result |= 1; | ||
| 218 | } | ||
| 219 | if (signbit (vd)) /* link check */ | ||
| 220 | vd++; | ||
| 221 | { | ||
| 222 | double plus_inf = 1.0 / p0d; | ||
| 223 | double minus_inf = -1.0 / p0d; | ||
| 224 | if (!(!signbit (255.0) | ||
| 225 | && signbit (-255.0) | ||
| 226 | && !signbit (p0d) | ||
| 227 | && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) | ||
| 228 | && !signbit (plus_inf) | ||
| 229 | && signbit (minus_inf))) | ||
| 230 | result |= 2; | ||
| 231 | } | ||
| 232 | if (signbit (vl)) /* link check */ | ||
| 233 | vl++; | ||
| 234 | { | ||
| 235 | long double plus_inf = 1.0L / p0l; | ||
| 236 | long double minus_inf = -1.0L / p0l; | ||
| 237 | if (signbit (255.0L)) | ||
| 238 | result |= 4; | ||
| 239 | if (!signbit (-255.0L)) | ||
| 240 | result |= 4; | ||
| 241 | if (signbit (p0l)) | ||
| 242 | result |= 8; | ||
| 243 | if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l))) | ||
| 244 | result |= 16; | ||
| 245 | if (signbit (plus_inf)) | ||
| 246 | result |= 32; | ||
| 247 | if (!signbit (minus_inf)) | ||
| 248 | result |= 64; | ||
| 249 | } | ||
| 250 | return result; | ||
| 251 | } | ||
| 252 | ]]) | ||
| 253 | |||
| 254 | AC_DEFUN([gl_FLOAT_SIGN_LOCATION], | ||
| 255 | [ | ||
| 256 | gl_FLOATTYPE_SIGN_LOCATION([float], [gl_cv_cc_float_signbit], [f], [FLT]) | ||
| 257 | ]) | ||
| 258 | |||
| 259 | AC_DEFUN([gl_DOUBLE_SIGN_LOCATION], | ||
| 260 | [ | ||
| 261 | gl_FLOATTYPE_SIGN_LOCATION([double], [gl_cv_cc_double_signbit], [], [DBL]) | ||
| 262 | ]) | ||
| 263 | |||
| 264 | AC_DEFUN([gl_LONG_DOUBLE_SIGN_LOCATION], | ||
| 265 | [ | ||
| 266 | gl_FLOATTYPE_SIGN_LOCATION([long double], [gl_cv_cc_long_double_signbit], [L], [LDBL]) | ||
| 267 | ]) | ||
| 268 | |||
| 269 | AC_DEFUN([gl_FLOATTYPE_SIGN_LOCATION], | ||
| 270 | [ | ||
| 271 | AC_CACHE_CHECK([where to find the sign bit in a '$1'], | ||
| 272 | [$2], | ||
| 273 | [ | ||
| 274 | AC_RUN_IFELSE( | ||
| 275 | [AC_LANG_SOURCE([[ | ||
| 276 | #include <stddef.h> | ||
| 277 | #include <stdio.h> | ||
| 278 | #define NWORDS \ | ||
| 279 | ((sizeof ($1) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) | ||
| 280 | typedef union { $1 value; unsigned int word[NWORDS]; } | ||
| 281 | memory_float; | ||
| 282 | static memory_float plus = { 1.0$3 }; | ||
| 283 | static memory_float minus = { -1.0$3 }; | ||
| 284 | int main () | ||
| 285 | { | ||
| 286 | size_t j, k, i; | ||
| 287 | unsigned int m; | ||
| 288 | FILE *fp = fopen ("conftest.out", "w"); | ||
| 289 | if (fp == NULL) | ||
| 290 | return 1; | ||
| 291 | /* Find the different bit. */ | ||
| 292 | k = 0; m = 0; | ||
| 293 | for (j = 0; j < NWORDS; j++) | ||
| 294 | { | ||
| 295 | unsigned int x = plus.word[j] ^ minus.word[j]; | ||
| 296 | if ((x & (x - 1)) || (x && m)) | ||
| 297 | { | ||
| 298 | /* More than one bit difference. */ | ||
| 299 | fprintf (fp, "unknown"); | ||
| 300 | fclose (fp); | ||
| 301 | return 2; | ||
| 302 | } | ||
| 303 | if (x) | ||
| 304 | { | ||
| 305 | k = j; | ||
| 306 | m = x; | ||
| 307 | } | ||
| 308 | } | ||
| 309 | if (m == 0) | ||
| 310 | { | ||
| 311 | /* No difference. */ | ||
| 312 | fprintf (fp, "unknown"); | ||
| 313 | fclose (fp); | ||
| 314 | return 3; | ||
| 315 | } | ||
| 316 | /* Now m = plus.word[k] ^ ~minus.word[k]. */ | ||
| 317 | if (plus.word[k] & ~minus.word[k]) | ||
| 318 | { | ||
| 319 | /* Oh? The sign bit is set in the positive and cleared in the negative | ||
| 320 | numbers? */ | ||
| 321 | fprintf (fp, "unknown"); | ||
| 322 | fclose (fp); | ||
| 323 | return 4; | ||
| 324 | } | ||
| 325 | for (i = 0; ; i++) | ||
| 326 | if ((m >> i) & 1) | ||
| 327 | break; | ||
| 328 | fprintf (fp, "word %d bit %d", (int) k, (int) i); | ||
| 329 | if (fclose (fp) != 0) | ||
| 330 | return 5; | ||
| 331 | return 0; | ||
| 332 | } | ||
| 333 | ]])], | ||
| 334 | [$2=`cat conftest.out`], | ||
| 335 | [$2="unknown"], | ||
| 336 | [ | ||
| 337 | dnl When cross-compiling, we don't know. It depends on the | ||
| 338 | dnl ABI and compiler version. There are too many cases. | ||
| 339 | $2="unknown" | ||
| 340 | ]) | ||
| 341 | rm -f conftest.out | ||
| 342 | ]) | ||
| 343 | case "$]$2[" in | ||
| 344 | word*bit*) | ||
| 345 | word=`echo "$]$2[" | sed -e 's/word //' -e 's/ bit.*//'` | ||
| 346 | bit=`echo "$]$2[" | sed -e 's/word.*bit //'` | ||
| 347 | AC_DEFINE_UNQUOTED([$4][_SIGNBIT_WORD], [$word], | ||
| 348 | [Define as the word index where to find the sign of '$1'.]) | ||
| 349 | AC_DEFINE_UNQUOTED([$4][_SIGNBIT_BIT], [$bit], | ||
| 350 | [Define as the bit index in the word where to find the sign of '$1'.]) | ||
| 351 | ;; | ||
| 352 | esac | ||
| 353 | ]) | ||
| 354 | |||
| 355 | # Expands to code that defines a function signbitf(float). | ||
| 356 | # It extracts the sign bit of a non-NaN value. | ||
| 357 | AC_DEFUN([gl_FLOAT_SIGNBIT_CODE], | ||
| 358 | [ | ||
| 359 | gl_FLOATTYPE_SIGNBIT_CODE([float], [f], [f]) | ||
| 360 | ]) | ||
| 361 | |||
| 362 | # Expands to code that defines a function signbitd(double). | ||
| 363 | # It extracts the sign bit of a non-NaN value. | ||
| 364 | AC_DEFUN([gl_DOUBLE_SIGNBIT_CODE], | ||
| 365 | [ | ||
| 366 | gl_FLOATTYPE_SIGNBIT_CODE([double], [d], []) | ||
| 367 | ]) | ||
| 368 | |||
| 369 | # Expands to code that defines a function signbitl(long double). | ||
| 370 | # It extracts the sign bit of a non-NaN value. | ||
| 371 | AC_DEFUN([gl_LONG_DOUBLE_SIGNBIT_CODE], | ||
| 372 | [ | ||
| 373 | gl_FLOATTYPE_SIGNBIT_CODE([long double], [l], [L]) | ||
| 374 | ]) | ||
| 375 | |||
| 376 | AC_DEFUN([gl_FLOATTYPE_SIGNBIT_CODE], | ||
| 377 | [[ | ||
| 378 | static int | ||
| 379 | signbit$2 ($1 value) | ||
| 380 | { | ||
| 381 | typedef union { $1 f; unsigned char b[sizeof ($1)]; } float_union; | ||
| 382 | static float_union plus_one = { 1.0$3 }; /* unused bits are zero here */ | ||
| 383 | static float_union minus_one = { -1.0$3 }; /* unused bits are zero here */ | ||
| 384 | /* Compute the sign bit mask as the XOR of plus_one and minus_one. */ | ||
| 385 | float_union u; | ||
| 386 | unsigned int i; | ||
| 387 | u.f = value; | ||
| 388 | for (i = 0; i < sizeof ($1); i++) | ||
| 389 | if (u.b[i] & (plus_one.b[i] ^ minus_one.b[i])) | ||
| 390 | return 1; | ||
| 391 | return 0; | ||
| 392 | } | ||
| 393 | ]]) | ||
diff --git a/m4/size_max.m4 b/m4/size_max.m4 deleted file mode 100644 index 0763366dfc3..00000000000 --- a/m4/size_max.m4 +++ /dev/null | |||
| @@ -1,75 +0,0 @@ | |||
| 1 | # size_max.m4 serial 12 | ||
| 2 | dnl Copyright (C) 2003, 2005-2006, 2008-2023 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Bruno Haible. | ||
| 8 | |||
| 9 | AC_PREREQ([2.61]) | ||
| 10 | |||
| 11 | AC_DEFUN([gl_SIZE_MAX], | ||
| 12 | [ | ||
| 13 | AC_CHECK_HEADERS([stdint.h]) | ||
| 14 | dnl First test whether the system already has SIZE_MAX. | ||
| 15 | AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ | ||
| 16 | gl_cv_size_max=no | ||
| 17 | AC_EGREP_CPP([Found it], [ | ||
| 18 | #include <limits.h> | ||
| 19 | #if HAVE_STDINT_H | ||
| 20 | #include <stdint.h> | ||
| 21 | #endif | ||
| 22 | #ifdef SIZE_MAX | ||
| 23 | Found it | ||
| 24 | #endif | ||
| 25 | ], [gl_cv_size_max=yes]) | ||
| 26 | if test $gl_cv_size_max != yes; then | ||
| 27 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider | ||
| 28 | dnl than the type 'unsigned long'. Try hard to find a definition that can | ||
| 29 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. | ||
| 30 | AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], | ||
| 31 | [#include <stddef.h> | ||
| 32 | #include <limits.h>], [size_t_bits_minus_1=]) | ||
| 33 | AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], | ||
| 34 | [#include <stddef.h>], [fits_in_uint=]) | ||
| 35 | if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then | ||
| 36 | if test $fits_in_uint = 1; then | ||
| 37 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type | ||
| 38 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. | ||
| 39 | AC_COMPILE_IFELSE( | ||
| 40 | [AC_LANG_PROGRAM( | ||
| 41 | [[#include <stddef.h> | ||
| 42 | extern size_t foo; | ||
| 43 | extern unsigned long foo; | ||
| 44 | ]], | ||
| 45 | [[]])], | ||
| 46 | [fits_in_uint=0]) | ||
| 47 | fi | ||
| 48 | dnl We cannot use 'expr' to simplify this expression, because 'expr' | ||
| 49 | dnl works only with 'long' integers in the host environment, while we | ||
| 50 | dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. | ||
| 51 | if test $fits_in_uint = 1; then | ||
| 52 | gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" | ||
| 53 | else | ||
| 54 | gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" | ||
| 55 | fi | ||
| 56 | else | ||
| 57 | dnl Shouldn't happen, but who knows... | ||
| 58 | gl_cv_size_max='((size_t)~(size_t)0)' | ||
| 59 | fi | ||
| 60 | fi | ||
| 61 | ]) | ||
| 62 | if test "$gl_cv_size_max" != yes; then | ||
| 63 | AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], | ||
| 64 | [Define as the maximum value of type 'size_t', if the system doesn't define it.]) | ||
| 65 | fi | ||
| 66 | dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after | ||
| 67 | dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with | ||
| 68 | dnl #define by AC_DEFINE_UNQUOTED. | ||
| 69 | AH_VERBATIM([SIZE_MAX], | ||
| 70 | [/* Define as the maximum value of type 'size_t', if the system doesn't define | ||
| 71 | it. */ | ||
| 72 | #ifndef SIZE_MAX | ||
| 73 | # undef SIZE_MAX | ||
| 74 | #endif]) | ||
| 75 | ]) | ||
diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 deleted file mode 100644 index 70349f6cb21..00000000000 --- a/m4/stdint_h.m4 +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | # stdint_h.m4 serial 9 | ||
| 2 | dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Paul Eggert. | ||
| 8 | |||
| 9 | # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, | ||
| 10 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | ||
| 11 | |||
| 12 | AC_DEFUN([gl_AC_HEADER_STDINT_H], | ||
| 13 | [ | ||
| 14 | AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], | ||
| 15 | [AC_COMPILE_IFELSE( | ||
| 16 | [AC_LANG_PROGRAM( | ||
| 17 | [[#include <sys/types.h> | ||
| 18 | #include <stdint.h>]], | ||
| 19 | [[uintmax_t i = (uintmax_t) -1; return !i;]])], | ||
| 20 | [gl_cv_header_stdint_h=yes], | ||
| 21 | [gl_cv_header_stdint_h=no])]) | ||
| 22 | if test $gl_cv_header_stdint_h = yes; then | ||
| 23 | AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], | ||
| 24 | [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, | ||
| 25 | and declares uintmax_t. ]) | ||
| 26 | fi | ||
| 27 | ]) | ||
diff --git a/m4/vasnprintf.m4 b/m4/vasnprintf.m4 deleted file mode 100644 index df87b9e7986..00000000000 --- a/m4/vasnprintf.m4 +++ /dev/null | |||
| @@ -1,462 +0,0 @@ | |||
| 1 | # vasnprintf.m4 serial 50 | ||
| 2 | dnl Copyright (C) 2002-2004, 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 | AC_DEFUN([gl_FUNC_VASNPRINTF], | ||
| 8 | [ | ||
| 9 | AC_CHECK_FUNCS_ONCE([vasnprintf]) | ||
| 10 | if test $ac_cv_func_vasnprintf = no; then | ||
| 11 | gl_REPLACE_VASNPRINTF | ||
| 12 | fi | ||
| 13 | ]) | ||
| 14 | |||
| 15 | AC_DEFUN([gl_REPLACE_VASNPRINTF], | ||
| 16 | [ | ||
| 17 | AC_CHECK_FUNCS_ONCE([vasnprintf]) | ||
| 18 | AC_LIBOBJ([vasnprintf]) | ||
| 19 | AC_LIBOBJ([printf-args]) | ||
| 20 | AC_LIBOBJ([printf-parse]) | ||
| 21 | AC_LIBOBJ([asnprintf]) | ||
| 22 | if test $ac_cv_func_vasnprintf = yes; then | ||
| 23 | AC_DEFINE([REPLACE_VASNPRINTF], [1], | ||
| 24 | [Define if vasnprintf exists but is overridden by gnulib.]) | ||
| 25 | fi | ||
| 26 | gl_PREREQ_PRINTF_ARGS | ||
| 27 | gl_PREREQ_PRINTF_PARSE | ||
| 28 | gl_PREREQ_VASNPRINTF | ||
| 29 | gl_PREREQ_ASNPRINTF | ||
| 30 | ]) | ||
| 31 | |||
| 32 | AC_DEFUN([gl_FUNC_VASNWPRINTF], | ||
| 33 | [ | ||
| 34 | AC_LIBOBJ([printf-args]) | ||
| 35 | gl_PREREQ_PRINTF_ARGS | ||
| 36 | gl_PREREQ_PRINTF_PARSE | ||
| 37 | gl_PREREQ_VASNWPRINTF | ||
| 38 | gl_PREREQ_ASNPRINTF | ||
| 39 | ]) | ||
| 40 | |||
| 41 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. | ||
| 42 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | ||
| 43 | [ | ||
| 44 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 45 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 46 | ]) | ||
| 47 | |||
| 48 | # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. | ||
| 49 | # Prerequisites of lib/wprintf-parse.h, lib/wprintf-parse.c. | ||
| 50 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | ||
| 51 | [ | ||
| 52 | AC_REQUIRE([gl_FEATURES_H]) | ||
| 53 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 54 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 55 | AC_REQUIRE([AC_TYPE_SIZE_T]) | ||
| 56 | AC_CHECK_TYPE([ptrdiff_t], , | ||
| 57 | [AC_DEFINE([ptrdiff_t], [long], | ||
| 58 | [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) | ||
| 59 | ]) | ||
| 60 | AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) | ||
| 61 | ]) | ||
| 62 | |||
| 63 | # Prerequisites of lib/vasnprintf.c if !WIDE_CHAR_VERSION. | ||
| 64 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], | ||
| 65 | [ | ||
| 66 | AC_CHECK_FUNCS([snprintf strnlen wcrtomb]) | ||
| 67 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | ||
| 68 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | ||
| 69 | AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) | ||
| 70 | dnl We can avoid a lot of code by assuming that snprintf's return value | ||
| 71 | dnl conforms to ISO C99. So check that. | ||
| 72 | AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) | ||
| 73 | case "$gl_cv_func_snprintf_retval_c99" in | ||
| 74 | *yes) | ||
| 75 | AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1], | ||
| 76 | [Define if the return value of the snprintf function is the number of | ||
| 77 | of bytes (excluding the terminating NUL) that would have been produced | ||
| 78 | if the buffer had been large enough.]) | ||
| 79 | ;; | ||
| 80 | esac | ||
| 81 | dnl Additionally, the use of %n can be eliminated by assuming that snprintf | ||
| 82 | dnl always produces NUL-terminated strings (no truncation). | ||
| 83 | AC_REQUIRE([gl_SNPRINTF_TRUNCATION_C99]) | ||
| 84 | case "$gl_cv_func_snprintf_truncation_c99" in | ||
| 85 | *yes) | ||
| 86 | AC_DEFINE([HAVE_SNPRINTF_TRUNCATION_C99], [1], | ||
| 87 | [Define if the string produced by the snprintf function is always NUL | ||
| 88 | terminated.]) | ||
| 89 | ;; | ||
| 90 | esac | ||
| 91 | gl_PREREQ_VASNXPRINTF | ||
| 92 | ]) | ||
| 93 | |||
| 94 | # Prerequisites of lib/vasnwprintf.c. | ||
| 95 | AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF], | ||
| 96 | [ | ||
| 97 | AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc]) | ||
| 98 | AC_CHECK_DECLS([_snwprintf], , , [[#include <stdio.h>]]) | ||
| 99 | AC_CHECK_DECLS([wcsnlen], , , [[#include <wchar.h>]]) | ||
| 100 | gl_SWPRINTF_WORKS | ||
| 101 | case "$gl_cv_func_swprintf_works" in | ||
| 102 | *yes) | ||
| 103 | AC_DEFINE([HAVE_WORKING_SWPRINTF], [1], | ||
| 104 | [Define if the swprintf function works correctly when it produces output | ||
| 105 | that contains null wide characters.]) | ||
| 106 | ;; | ||
| 107 | esac | ||
| 108 | gl_MBRTOWC_C_LOCALE | ||
| 109 | case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
| 110 | *yes) | ||
| 111 | AC_CACHE_CHECK([whether swprintf in the C locale is free of encoding errors], | ||
| 112 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ], | ||
| 113 | [ | ||
| 114 | AC_RUN_IFELSE( | ||
| 115 | [AC_LANG_SOURCE([[ | ||
| 116 | #ifndef __USE_MINGW_ANSI_STDIO | ||
| 117 | # define __USE_MINGW_ANSI_STDIO 1 | ||
| 118 | #endif | ||
| 119 | #include <stdio.h> | ||
| 120 | #include <wchar.h> | ||
| 121 | int main() | ||
| 122 | { | ||
| 123 | int result = 0; | ||
| 124 | { /* This test fails on glibc 2.35, musl libc 1.2.4, FreeBSD 13.2, NetBSD 9.3, | ||
| 125 | OpenBSD 7.2, Cygwin 2.9.0. | ||
| 126 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/2>. */ | ||
| 127 | wchar_t buf[12]; | ||
| 128 | int ret = swprintf (buf, 12, L"%c", '\377'); | ||
| 129 | if (ret < 0) | ||
| 130 | result |= 1; | ||
| 131 | } | ||
| 132 | return result; | ||
| 133 | }]])], | ||
| 134 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ=yes], | ||
| 135 | [gl_cv_func_swprintf_C_locale_sans_EILSEQ=no], | ||
| 136 | [case "$host_os" in | ||
| 137 | # Guess no on glibc systems. | ||
| 138 | *-gnu* | gnu*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing yes";; | ||
| 139 | # Guess no on musl systems. | ||
| 140 | *-musl* | midipix*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing no";; | ||
| 141 | # If we don't know, obey --enable-cross-guesses. | ||
| 142 | *) gl_cv_func_swprintf_C_locale_sans_EILSEQ="$gl_cross_guess_normal";; | ||
| 143 | esac | ||
| 144 | ]) | ||
| 145 | ]) | ||
| 146 | ;; | ||
| 147 | esac | ||
| 148 | if case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in | ||
| 149 | *yes) false ;; | ||
| 150 | *) true ;; | ||
| 151 | esac \ | ||
| 152 | || case "$gl_cv_func_swprintf_C_locale_sans_EILSEQ" in | ||
| 153 | *yes) false ;; | ||
| 154 | *) true ;; | ||
| 155 | esac; then | ||
| 156 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_C], [1], | ||
| 157 | [Define if the vasnwprintf implementation needs special code for | ||
| 158 | the 'c' directive.]) | ||
| 159 | fi | ||
| 160 | gl_SWPRINTF_DIRECTIVE_LA | ||
| 161 | case "$gl_cv_func_swprintf_directive_la" in | ||
| 162 | *yes) ;; | ||
| 163 | *) | ||
| 164 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LA], [1], | ||
| 165 | [Define if the vasnwprintf implementation needs special code for | ||
| 166 | the 'a' directive with 'long double' arguments.]) | ||
| 167 | ;; | ||
| 168 | esac | ||
| 169 | gl_SWPRINTF_DIRECTIVE_LC | ||
| 170 | case "$gl_cv_func_swprintf_directive_lc" in | ||
| 171 | *yes) ;; | ||
| 172 | *) | ||
| 173 | AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LC], [1], | ||
| 174 | [Define if the vasnwprintf implementation needs special code for | ||
| 175 | the 'lc' directive.]) | ||
| 176 | ;; | ||
| 177 | esac | ||
| 178 | gl_MUSL_LIBC | ||
| 179 | gl_PREREQ_VASNXPRINTF | ||
| 180 | ]) | ||
| 181 | |||
| 182 | # Common prerequisites of lib/vasnprintf.c and lib/vasnwprintf.c. | ||
| 183 | AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], | ||
| 184 | [ | ||
| 185 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
| 186 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 187 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 188 | AC_CHECK_FUNCS([wcslen]) | ||
| 189 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization | ||
| 190 | dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. | ||
| 191 | AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) | ||
| 192 | ]) | ||
| 193 | |||
| 194 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' | ||
| 195 | # arguments. | ||
| 196 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], | ||
| 197 | [ | ||
| 198 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) | ||
| 199 | case "$gl_cv_func_printf_long_double" in | ||
| 200 | *yes) | ||
| 201 | ;; | ||
| 202 | *) | ||
| 203 | AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], | ||
| 204 | [Define if the vasnprintf implementation needs special code for | ||
| 205 | 'long double' arguments.]) | ||
| 206 | ;; | ||
| 207 | esac | ||
| 208 | ]) | ||
| 209 | |||
| 210 | # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' | ||
| 211 | # arguments. | ||
| 212 | AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], | ||
| 213 | [ | ||
| 214 | AC_REQUIRE([gl_PRINTF_INFINITE]) | ||
| 215 | case "$gl_cv_func_printf_infinite" in | ||
| 216 | *yes) | ||
| 217 | ;; | ||
| 218 | *) | ||
| 219 | AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1], | ||
| 220 | [Define if the vasnprintf implementation needs special code for | ||
| 221 | infinite 'double' arguments.]) | ||
| 222 | ;; | ||
| 223 | esac | ||
| 224 | ]) | ||
| 225 | |||
| 226 | # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' | ||
| 227 | # arguments. | ||
| 228 | AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], | ||
| 229 | [ | ||
| 230 | AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) | ||
| 231 | dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if | ||
| 232 | dnl NEED_PRINTF_LONG_DOUBLE is already set. | ||
| 233 | AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) | ||
| 234 | case "$gl_cv_func_printf_long_double" in | ||
| 235 | *yes) | ||
| 236 | case "$gl_cv_func_printf_infinite_long_double" in | ||
| 237 | *yes) | ||
| 238 | ;; | ||
| 239 | *) | ||
| 240 | AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1], | ||
| 241 | [Define if the vasnprintf implementation needs special code for | ||
| 242 | infinite 'long double' arguments.]) | ||
| 243 | ;; | ||
| 244 | esac | ||
| 245 | ;; | ||
| 246 | esac | ||
| 247 | ]) | ||
| 248 | |||
| 249 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. | ||
| 250 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], | ||
| 251 | [ | ||
| 252 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) | ||
| 253 | case "$gl_cv_func_printf_directive_a" in | ||
| 254 | *yes) | ||
| 255 | ;; | ||
| 256 | *) | ||
| 257 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], | ||
| 258 | [Define if the vasnprintf implementation needs special code for | ||
| 259 | the 'a' and 'A' directives.]) | ||
| 260 | gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]]) | ||
| 261 | ;; | ||
| 262 | esac | ||
| 263 | ]) | ||
| 264 | |||
| 265 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'b' directive. | ||
| 266 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_B], | ||
| 267 | [ | ||
| 268 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_B]) | ||
| 269 | case "$gl_cv_func_printf_directive_b" in | ||
| 270 | *yes) | ||
| 271 | ;; | ||
| 272 | *) | ||
| 273 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_B], [1], | ||
| 274 | [Define if the vasnprintf implementation needs special code for | ||
| 275 | the 'b' directive.]) | ||
| 276 | ;; | ||
| 277 | esac | ||
| 278 | ]) | ||
| 279 | |||
| 280 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. | ||
| 281 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], | ||
| 282 | [ | ||
| 283 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) | ||
| 284 | case "$gl_cv_func_printf_directive_f" in | ||
| 285 | *yes) | ||
| 286 | ;; | ||
| 287 | *) | ||
| 288 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1], | ||
| 289 | [Define if the vasnprintf implementation needs special code for | ||
| 290 | the 'F' directive.]) | ||
| 291 | ;; | ||
| 292 | esac | ||
| 293 | ]) | ||
| 294 | |||
| 295 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive. | ||
| 296 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], | ||
| 297 | [ | ||
| 298 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) | ||
| 299 | case "$gl_cv_func_printf_directive_ls" in | ||
| 300 | *yes) | ||
| 301 | ;; | ||
| 302 | *) | ||
| 303 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1], | ||
| 304 | [Define if the vasnprintf implementation needs special code for | ||
| 305 | the 'ls' directive.]) | ||
| 306 | ;; | ||
| 307 | esac | ||
| 308 | ]) | ||
| 309 | |||
| 310 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'lc' directive. | ||
| 311 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], | ||
| 312 | [ | ||
| 313 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC]) | ||
| 314 | case "$gl_cv_func_printf_directive_lc" in | ||
| 315 | *yes) | ||
| 316 | ;; | ||
| 317 | *) | ||
| 318 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_LC], [1], | ||
| 319 | [Define if the vasnprintf implementation needs special code for | ||
| 320 | the 'lc' directive.]) | ||
| 321 | ;; | ||
| 322 | esac | ||
| 323 | ]) | ||
| 324 | |||
| 325 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. | ||
| 326 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], | ||
| 327 | [ | ||
| 328 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) | ||
| 329 | case "$gl_cv_func_printf_flag_grouping" in | ||
| 330 | *yes) | ||
| 331 | ;; | ||
| 332 | *) | ||
| 333 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], | ||
| 334 | [Define if the vasnprintf implementation needs special code for the | ||
| 335 | ' flag.]) | ||
| 336 | ;; | ||
| 337 | esac | ||
| 338 | ]) | ||
| 339 | |||
| 340 | # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. | ||
| 341 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], | ||
| 342 | [ | ||
| 343 | AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) | ||
| 344 | case "$gl_cv_func_printf_flag_leftadjust" in | ||
| 345 | *yes) | ||
| 346 | ;; | ||
| 347 | *) | ||
| 348 | AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1], | ||
| 349 | [Define if the vasnprintf implementation needs special code for the | ||
| 350 | '-' flag.]) | ||
| 351 | ;; | ||
| 352 | esac | ||
| 353 | ]) | ||
| 354 | |||
| 355 | # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. | ||
| 356 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], | ||
| 357 | [ | ||
| 358 | AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) | ||
| 359 | case "$gl_cv_func_printf_flag_zero" in | ||
| 360 | *yes) | ||
| 361 | ;; | ||
| 362 | *) | ||
| 363 | AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1], | ||
| 364 | [Define if the vasnprintf implementation needs special code for the | ||
| 365 | 0 flag.]) | ||
| 366 | ;; | ||
| 367 | esac | ||
| 368 | ]) | ||
| 369 | |||
| 370 | # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. | ||
| 371 | AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], | ||
| 372 | [ | ||
| 373 | AC_REQUIRE([gl_PRINTF_PRECISION]) | ||
| 374 | case "$gl_cv_func_printf_precision" in | ||
| 375 | *yes) | ||
| 376 | ;; | ||
| 377 | *) | ||
| 378 | AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1], | ||
| 379 | [Define if the vasnprintf implementation needs special code for | ||
| 380 | supporting large precisions without arbitrary bounds.]) | ||
| 381 | AC_DEFINE([NEED_PRINTF_DOUBLE], [1], | ||
| 382 | [Define if the vasnprintf implementation needs special code for | ||
| 383 | 'double' arguments.]) | ||
| 384 | AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], | ||
| 385 | [Define if the vasnprintf implementation needs special code for | ||
| 386 | 'long double' arguments.]) | ||
| 387 | ;; | ||
| 388 | esac | ||
| 389 | ]) | ||
| 390 | |||
| 391 | # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory | ||
| 392 | # conditions. | ||
| 393 | AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], | ||
| 394 | [ | ||
| 395 | AC_REQUIRE([gl_PRINTF_ENOMEM]) | ||
| 396 | case "$gl_cv_func_printf_enomem" in | ||
| 397 | *yes) | ||
| 398 | ;; | ||
| 399 | *) | ||
| 400 | AC_DEFINE([NEED_PRINTF_ENOMEM], [1], | ||
| 401 | [Define if the vasnprintf implementation needs special code for | ||
| 402 | surviving out-of-memory conditions.]) | ||
| 403 | AC_DEFINE([NEED_PRINTF_DOUBLE], [1], | ||
| 404 | [Define if the vasnprintf implementation needs special code for | ||
| 405 | 'double' arguments.]) | ||
| 406 | AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1], | ||
| 407 | [Define if the vasnprintf implementation needs special code for | ||
| 408 | 'long double' arguments.]) | ||
| 409 | ;; | ||
| 410 | esac | ||
| 411 | ]) | ||
| 412 | |||
| 413 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. | ||
| 414 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS], | ||
| 415 | [ | ||
| 416 | AC_REQUIRE([gl_PREREQ_VASNPRINTF]) | ||
| 417 | gl_PREREQ_VASNPRINTF_LONG_DOUBLE | ||
| 418 | gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE | ||
| 419 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE | ||
| 420 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A | ||
| 421 | gl_PREREQ_VASNPRINTF_DIRECTIVE_B | ||
| 422 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F | ||
| 423 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LS | ||
| 424 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LC | ||
| 425 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING | ||
| 426 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST | ||
| 427 | gl_PREREQ_VASNPRINTF_FLAG_ZERO | ||
| 428 | gl_PREREQ_VASNPRINTF_PRECISION | ||
| 429 | gl_PREREQ_VASNPRINTF_ENOMEM | ||
| 430 | ]) | ||
| 431 | |||
| 432 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'B' directive. | ||
| 433 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B], | ||
| 434 | [ | ||
| 435 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B]) | ||
| 436 | case "$gl_cv_func_printf_directive_uppercase_b" in | ||
| 437 | *yes) | ||
| 438 | ;; | ||
| 439 | *) | ||
| 440 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_UPPERCASE_B], [1], | ||
| 441 | [Define if the vasnprintf implementation needs special code for | ||
| 442 | the 'B' directive.]) | ||
| 443 | ;; | ||
| 444 | esac | ||
| 445 | ]) | ||
| 446 | |||
| 447 | # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance | ||
| 448 | # and GNU compatibility. | ||
| 449 | AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS], | ||
| 450 | [ | ||
| 451 | gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS | ||
| 452 | AC_DEFINE([SUPPORT_GNU_PRINTF_DIRECTIVES], [1], | ||
| 453 | [Define if the vasnprintf implementation should support GNU compatible | ||
| 454 | printf directives.]) | ||
| 455 | gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B | ||
| 456 | ]) | ||
| 457 | |||
| 458 | # Prerequisites of lib/asnprintf.c. | ||
| 459 | # Prerequisites of lib/asnwprintf.c. | ||
| 460 | AC_DEFUN([gl_PREREQ_ASNPRINTF], | ||
| 461 | [ | ||
| 462 | ]) | ||
diff --git a/m4/vasprintf-posix.m4 b/m4/vasprintf-posix.m4 deleted file mode 100644 index 3c7a6540bd1..00000000000 --- a/m4/vasprintf-posix.m4 +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | # vasprintf-posix.m4 serial 17 | ||
| 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_VASPRINTF_POSIX], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_FUNC_VASPRINTF_IS_POSIX]) | ||
| 10 | if test $gl_cv_func_vasprintf_posix = no; then | ||
| 11 | gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS | ||
| 12 | gl_REPLACE_VASNPRINTF | ||
| 13 | gl_REPLACE_VASPRINTF | ||
| 14 | fi | ||
| 15 | ]) | ||
| 16 | |||
| 17 | dnl Test whether vasprintf exists and is POSIX compliant. | ||
| 18 | dnl Result is gl_cv_func_vasprintf_posix. | ||
| 19 | AC_DEFUN([gl_FUNC_VASPRINTF_IS_POSIX], | ||
| 20 | [ | ||
| 21 | AC_REQUIRE([gl_PRINTF_SIZES_C99]) | ||
| 22 | AC_REQUIRE([gl_PRINTF_SIZES_C23]) | ||
| 23 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) | ||
| 24 | AC_REQUIRE([gl_PRINTF_INFINITE]) | ||
| 25 | AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) | ||
| 26 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) | ||
| 27 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_B]) | ||
| 28 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) | ||
| 29 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) | ||
| 30 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) | ||
| 31 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC]) | ||
| 32 | AC_REQUIRE([gl_PRINTF_POSITIONS]) | ||
| 33 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) | ||
| 34 | AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) | ||
| 35 | AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) | ||
| 36 | AC_REQUIRE([gl_PRINTF_PRECISION]) | ||
| 37 | AC_REQUIRE([gl_PRINTF_ENOMEM]) | ||
| 38 | gl_cv_func_vasprintf_posix=no | ||
| 39 | AC_CHECK_FUNCS([vasprintf]) | ||
| 40 | case "$gl_cv_func_printf_sizes_c99" in | ||
| 41 | *yes) | ||
| 42 | case "$gl_cv_func_printf_sizes_c23" in | ||
| 43 | *yes) | ||
| 44 | case "$gl_cv_func_printf_long_double" in | ||
| 45 | *yes) | ||
| 46 | case "$gl_cv_func_printf_infinite" in | ||
| 47 | *yes) | ||
| 48 | case "$gl_cv_func_printf_infinite_long_double" in | ||
| 49 | *yes) | ||
| 50 | case "$gl_cv_func_printf_directive_a" in | ||
| 51 | *yes) | ||
| 52 | case "$gl_cv_func_printf_directive_b" in | ||
| 53 | *yes) | ||
| 54 | case "$gl_cv_func_printf_directive_f" in | ||
| 55 | *yes) | ||
| 56 | case "$gl_cv_func_printf_directive_n" in | ||
| 57 | *yes) | ||
| 58 | case "$gl_cv_func_printf_directive_ls" in | ||
| 59 | *yes) | ||
| 60 | case "$gl_cv_func_printf_directive_lc" in | ||
| 61 | *yes) | ||
| 62 | case "$gl_cv_func_printf_positions" in | ||
| 63 | *yes) | ||
| 64 | case "$gl_cv_func_printf_flag_grouping" in | ||
| 65 | *yes) | ||
| 66 | case "$gl_cv_func_printf_flag_leftadjust" in | ||
| 67 | *yes) | ||
| 68 | case "$gl_cv_func_printf_flag_zero" in | ||
| 69 | *yes) | ||
| 70 | case "$gl_cv_func_printf_precision" in | ||
| 71 | *yes) | ||
| 72 | case "$gl_cv_func_printf_enomem" in | ||
| 73 | *yes) | ||
| 74 | if test $ac_cv_func_vasprintf = yes; then | ||
| 75 | # vasprintf exists and is | ||
| 76 | # already POSIX compliant. | ||
| 77 | gl_cv_func_vasprintf_posix=yes | ||
| 78 | fi | ||
| 79 | ;; | ||
| 80 | esac | ||
| 81 | ;; | ||
| 82 | esac | ||
| 83 | ;; | ||
| 84 | esac | ||
| 85 | ;; | ||
| 86 | esac | ||
| 87 | ;; | ||
| 88 | esac | ||
| 89 | ;; | ||
| 90 | esac | ||
| 91 | ;; | ||
| 92 | esac | ||
| 93 | ;; | ||
| 94 | esac | ||
| 95 | ;; | ||
| 96 | esac | ||
| 97 | ;; | ||
| 98 | esac | ||
| 99 | ;; | ||
| 100 | esac | ||
| 101 | ;; | ||
| 102 | esac | ||
| 103 | ;; | ||
| 104 | esac | ||
| 105 | ;; | ||
| 106 | esac | ||
| 107 | ;; | ||
| 108 | esac | ||
| 109 | ;; | ||
| 110 | esac | ||
| 111 | ;; | ||
| 112 | esac | ||
| 113 | ]) | ||
diff --git a/m4/vasprintf.m4 b/m4/vasprintf.m4 deleted file mode 100644 index 6e6156a7549..00000000000 --- a/m4/vasprintf.m4 +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | # vasprintf.m4 serial 6 | ||
| 2 | dnl Copyright (C) 2002-2003, 2006-2007, 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_FUNC_VASPRINTF], | ||
| 9 | [ | ||
| 10 | AC_CHECK_FUNCS([vasprintf]) | ||
| 11 | if test $ac_cv_func_vasprintf = no; then | ||
| 12 | gl_REPLACE_VASPRINTF | ||
| 13 | fi | ||
| 14 | ]) | ||
| 15 | |||
| 16 | AC_DEFUN([gl_REPLACE_VASPRINTF], | ||
| 17 | [ | ||
| 18 | AC_LIBOBJ([vasprintf]) | ||
| 19 | AC_LIBOBJ([asprintf]) | ||
| 20 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 21 | if test $ac_cv_func_vasprintf = yes; then | ||
| 22 | REPLACE_VASPRINTF=1 | ||
| 23 | else | ||
| 24 | HAVE_VASPRINTF=0 | ||
| 25 | fi | ||
| 26 | gl_PREREQ_VASPRINTF_H | ||
| 27 | gl_PREREQ_VASPRINTF | ||
| 28 | gl_PREREQ_ASPRINTF | ||
| 29 | ]) | ||
| 30 | |||
| 31 | # Prerequisites of the vasprintf portion of lib/stdio.h. | ||
| 32 | AC_DEFUN([gl_PREREQ_VASPRINTF_H], | ||
| 33 | [ | ||
| 34 | dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). | ||
| 35 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 36 | ]) | ||
| 37 | |||
| 38 | # Prerequisites of lib/vasprintf.c. | ||
| 39 | AC_DEFUN([gl_PREREQ_VASPRINTF], | ||
| 40 | [ | ||
| 41 | ]) | ||
| 42 | |||
| 43 | # Prerequisites of lib/asprintf.c. | ||
| 44 | AC_DEFUN([gl_PREREQ_ASPRINTF], | ||
| 45 | [ | ||
| 46 | ]) | ||
diff --git a/m4/vfprintf-posix.m4 b/m4/vfprintf-posix.m4 deleted file mode 100644 index 6b51c50adab..00000000000 --- a/m4/vfprintf-posix.m4 +++ /dev/null | |||
| @@ -1,122 +0,0 @@ | |||
| 1 | # vfprintf-posix.m4 serial 18 | ||
| 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_VFPRINTF_POSIX], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_FUNC_VFPRINTF_IS_POSIX]) | ||
| 10 | if test $gl_cv_func_vfprintf_posix = no; then | ||
| 11 | gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS | ||
| 12 | gl_REPLACE_VASNPRINTF | ||
| 13 | gl_REPLACE_VFPRINTF | ||
| 14 | fi | ||
| 15 | ]) | ||
| 16 | |||
| 17 | dnl Test whether vfprintf is POSIX compliant. | ||
| 18 | dnl Result is gl_cv_func_vfprintf_posix. | ||
| 19 | AC_DEFUN([gl_FUNC_VFPRINTF_IS_POSIX], | ||
| 20 | [ | ||
| 21 | AC_REQUIRE([gl_PRINTF_SIZES_C99]) | ||
| 22 | AC_REQUIRE([gl_PRINTF_SIZES_C23]) | ||
| 23 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) | ||
| 24 | AC_REQUIRE([gl_PRINTF_INFINITE]) | ||
| 25 | AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) | ||
| 26 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) | ||
| 27 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_B]) | ||
| 28 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) | ||
| 29 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) | ||
| 30 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) | ||
| 31 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC]) | ||
| 32 | AC_REQUIRE([gl_PRINTF_POSITIONS]) | ||
| 33 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) | ||
| 34 | AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) | ||
| 35 | AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) | ||
| 36 | AC_REQUIRE([gl_PRINTF_PRECISION]) | ||
| 37 | AC_REQUIRE([gl_PRINTF_ENOMEM]) | ||
| 38 | gl_cv_func_vfprintf_posix=no | ||
| 39 | case "$gl_cv_func_printf_sizes_c99" in | ||
| 40 | *yes) | ||
| 41 | case "$gl_cv_func_printf_sizes_c23" in | ||
| 42 | *yes) | ||
| 43 | case "$gl_cv_func_printf_long_double" in | ||
| 44 | *yes) | ||
| 45 | case "$gl_cv_func_printf_infinite" in | ||
| 46 | *yes) | ||
| 47 | case "$gl_cv_func_printf_infinite_long_double" in | ||
| 48 | *yes) | ||
| 49 | case "$gl_cv_func_printf_directive_a" in | ||
| 50 | *yes) | ||
| 51 | case "$gl_cv_func_printf_directive_b" in | ||
| 52 | *yes) | ||
| 53 | case "$gl_cv_func_printf_directive_f" in | ||
| 54 | *yes) | ||
| 55 | case "$gl_cv_func_printf_directive_n" in | ||
| 56 | *yes) | ||
| 57 | case "$gl_cv_func_printf_directive_ls" in | ||
| 58 | *yes) | ||
| 59 | case "$gl_cv_func_printf_directive_lc" in | ||
| 60 | *yes) | ||
| 61 | case "$gl_cv_func_printf_positions" in | ||
| 62 | *yes) | ||
| 63 | case "$gl_cv_func_printf_flag_grouping" in | ||
| 64 | *yes) | ||
| 65 | case "$gl_cv_func_printf_flag_leftadjust" in | ||
| 66 | *yes) | ||
| 67 | case "$gl_cv_func_printf_flag_zero" in | ||
| 68 | *yes) | ||
| 69 | case "$gl_cv_func_printf_precision" in | ||
| 70 | *yes) | ||
| 71 | case "$gl_cv_func_printf_enomem" in | ||
| 72 | *yes) | ||
| 73 | # vfprintf exists and is | ||
| 74 | # already POSIX compliant. | ||
| 75 | gl_cv_func_vfprintf_posix=yes | ||
| 76 | ;; | ||
| 77 | esac | ||
| 78 | ;; | ||
| 79 | esac | ||
| 80 | ;; | ||
| 81 | esac | ||
| 82 | ;; | ||
| 83 | esac | ||
| 84 | ;; | ||
| 85 | esac | ||
| 86 | ;; | ||
| 87 | esac | ||
| 88 | ;; | ||
| 89 | esac | ||
| 90 | ;; | ||
| 91 | esac | ||
| 92 | ;; | ||
| 93 | esac | ||
| 94 | ;; | ||
| 95 | esac | ||
| 96 | ;; | ||
| 97 | esac | ||
| 98 | ;; | ||
| 99 | esac | ||
| 100 | ;; | ||
| 101 | esac | ||
| 102 | ;; | ||
| 103 | esac | ||
| 104 | ;; | ||
| 105 | esac | ||
| 106 | ;; | ||
| 107 | esac | ||
| 108 | ;; | ||
| 109 | esac | ||
| 110 | ]) | ||
| 111 | |||
| 112 | AC_DEFUN([gl_REPLACE_VFPRINTF], | ||
| 113 | [ | ||
| 114 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 115 | AC_LIBOBJ([vfprintf]) | ||
| 116 | REPLACE_VFPRINTF=1 | ||
| 117 | AC_DEFINE([REPLACE_VFPRINTF_POSIX], [1], | ||
| 118 | [Define if vfprintf is overridden by a POSIX compliant gnulib implementation.]) | ||
| 119 | gl_PREREQ_VFPRINTF | ||
| 120 | ]) | ||
| 121 | |||
| 122 | AC_DEFUN([gl_PREREQ_VFPRINTF], [:]) | ||
diff --git a/m4/xsize.m4 b/m4/xsize.m4 deleted file mode 100644 index 649db9c5eab..00000000000 --- a/m4/xsize.m4 +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | # xsize.m4 serial 5 | ||
| 2 | dnl Copyright (C) 2003-2004, 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_XSIZE], | ||
| 8 | [ | ||
| 9 | dnl Prerequisites of lib/xsize.h. | ||
| 10 | AC_REQUIRE([gl_SIZE_MAX]) | ||
| 11 | AC_CHECK_HEADERS([stdint.h]) | ||
| 12 | ]) | ||