summaryrefslogtreecommitdiff
path: root/gnulib-m4/printf.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-m4/printf.m4')
-rw-r--r--gnulib-m4/printf.m4156
1 files changed, 115 insertions, 41 deletions
diff --git a/gnulib-m4/printf.m4 b/gnulib-m4/printf.m4
index c7a14b20..3b167ecb 100644
--- a/gnulib-m4/printf.m4
+++ b/gnulib-m4/printf.m4
@@ -1,5 +1,5 @@
-# printf.m4 serial 52
-dnl Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
+# printf.m4 serial 57
+dnl Copyright (C) 2003, 2007-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -58,8 +58,8 @@ int main ()
[gl_cv_func_printf_sizes_c99=yes],
[gl_cv_func_printf_sizes_c99=no],
[
-changequote(,)dnl
case "$host_os" in
+changequote(,)dnl
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
# Guess yes on FreeBSD >= 5.
@@ -79,10 +79,19 @@ changequote(,)dnl
netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
gl_cv_func_printf_sizes_c99="guessing no";;
netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+changequote([,])dnl
+ # Guess yes on MSVC, no on mingw.
+ mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+ ],
+ [gl_cv_func_printf_sizes_c99="guessing yes"],
+ [gl_cv_func_printf_sizes_c99="guessing no"])
+ ;;
# If we don't know, assume the worst.
*) gl_cv_func_printf_sizes_c99="guessing no";;
esac
-changequote([,])dnl
])
])
])
@@ -122,14 +131,19 @@ int main ()
}]])],
[gl_cv_func_printf_long_double=yes],
[gl_cv_func_printf_long_double=no],
- [
-changequote(,)dnl
- case "$host_os" in
- beos*) gl_cv_func_printf_long_double="guessing no";;
- mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
- *) gl_cv_func_printf_long_double="guessing yes";;
+ [case "$host_os" in
+ beos*) gl_cv_func_printf_long_double="guessing no";;
+ # Guess yes on MSVC, no on mingw.
+ mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+ ],
+ [gl_cv_func_printf_long_double="guessing yes"],
+ [gl_cv_func_printf_long_double="guessing no"])
+ ;;
+ *) gl_cv_func_printf_long_double="guessing yes";;
esac
-changequote([,])dnl
])
])
])
@@ -217,8 +231,8 @@ int main ()
[gl_cv_func_printf_infinite=yes],
[gl_cv_func_printf_infinite=no],
[
-changequote(,)dnl
case "$host_os" in
+changequote(,)dnl
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_printf_infinite="guessing yes";;
# Guess yes on FreeBSD >= 6.
@@ -236,10 +250,19 @@ changequote(,)dnl
netbsd*) gl_cv_func_printf_infinite="guessing yes";;
# Guess yes on BeOS.
beos*) gl_cv_func_printf_infinite="guessing yes";;
+changequote([,])dnl
+ # Guess yes on MSVC, no on mingw.
+ mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+ ],
+ [gl_cv_func_printf_infinite="guessing yes"],
+ [gl_cv_func_printf_infinite="guessing no"])
+ ;;
# If we don't know, assume the worst.
*) gl_cv_func_printf_infinite="guessing no";;
esac
-changequote([,])dnl
])
])
])
@@ -419,13 +442,12 @@ int main ()
}]])],
[gl_cv_func_printf_infinite_long_double=yes],
[gl_cv_func_printf_infinite_long_double=no],
- [
-changequote(,)dnl
- case "$host_cpu" in
+ [case "$host_cpu" in
# Guess no on ia64, x86_64, i386.
ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
*)
case "$host_os" in
+changequote(,)dnl
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# Guess yes on FreeBSD >= 6.
@@ -434,12 +456,21 @@ changequote(,)dnl
# Guess yes on HP-UX >= 11.
hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+changequote([,])dnl
+ # Guess yes on MSVC, no on mingw.
+ mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+ ],
+ [gl_cv_func_printf_infinite_long_double="guessing yes"],
+ [gl_cv_func_printf_infinite_long_double="guessing no"])
+ ;;
# If we don't know, assume the worst.
*) gl_cv_func_printf_infinite_long_double="guessing no";;
esac
;;
esac
-changequote([,])dnl
])
])
;;
@@ -489,8 +520,15 @@ int main ()
&& strcmp (buf, "0x6.0ap-2 33") != 0
&& strcmp (buf, "0xc.14p-3 33") != 0))
result |= 4;
+ /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */
+ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
+ || (strcmp (buf, "0x2p+0 33") != 0
+ && strcmp (buf, "0x3p-1 33") != 0
+ && strcmp (buf, "0x6p-2 33") != 0
+ && strcmp (buf, "0xcp-3 33") != 0))
+ result |= 4;
/* This catches a FreeBSD 6.1 bug. See
- <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
+ <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
|| buf[0] == '0')
result |= 8;
@@ -502,7 +540,7 @@ int main ()
&& strcmp (buf, "0x8.0p-2") != 0))
result |= 16;
/* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
- glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
+ glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
if (sprintf (buf, "%.1La", 1.999L) < 0
|| (strcmp (buf, "0x1.0p+1") != 0
&& strcmp (buf, "0x2.0p+0") != 0
@@ -528,6 +566,8 @@ int main ()
[gl_cv_func_printf_directive_a="guessing yes"],
[gl_cv_func_printf_directive_a="guessing no"])
;;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_printf_directive_a="guessing no";;
# If we don't know, assume the worst.
*) gl_cv_func_printf_directive_a="guessing no";;
esac
@@ -570,8 +610,8 @@ int main ()
[gl_cv_func_printf_directive_f=yes],
[gl_cv_func_printf_directive_f=no],
[
-changequote(,)dnl
case "$host_os" in
+changequote(,)dnl
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
# Guess yes on FreeBSD >= 6.
@@ -581,12 +621,21 @@ changequote(,)dnl
darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
darwin*) gl_cv_func_printf_directive_f="guessing yes";;
# Guess yes on Solaris >= 2.10.
- solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
+ solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";;
+ solaris*) gl_cv_func_printf_directive_f="guessing no";;
+changequote([,])dnl
+ # Guess yes on MSVC, no on mingw.
+ mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+ ],
+ [gl_cv_func_printf_directive_f="guessing yes"],
+ [gl_cv_func_printf_directive_f="guessing no"])
+ ;;
# If we don't know, assume the worst.
*) gl_cv_func_printf_directive_f="guessing no";;
esac
-changequote([,])dnl
])
])
])
@@ -638,13 +687,11 @@ int main ()
}]])],
[gl_cv_func_printf_directive_n=yes],
[gl_cv_func_printf_directive_n=no],
- [
-changequote(,)dnl
- case "$host_os" in
+ [case "$host_os" in
+ # Guess no on native Windows.
mingw*) gl_cv_func_printf_directive_n="guessing no";;
*) gl_cv_func_printf_directive_n="guessing yes";;
esac
-changequote([,])dnl
])
])
])
@@ -719,12 +766,14 @@ int main ()
[
changequote(,)dnl
case "$host_os" in
- openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
- irix*) gl_cv_func_printf_directive_ls="guessing no";;
- solaris*) gl_cv_func_printf_directive_ls="guessing no";;
- cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
- beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
- *) gl_cv_func_printf_directive_ls="guessing yes";;
+ openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
+ irix*) gl_cv_func_printf_directive_ls="guessing no";;
+ solaris*) gl_cv_func_printf_directive_ls="guessing no";;
+ cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
+ beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_printf_directive_ls="guessing yes";;
+ *) gl_cv_func_printf_directive_ls="guessing yes";;
esac
changequote([,])dnl
])
@@ -763,6 +812,7 @@ changequote(,)dnl
netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
gl_cv_func_printf_positions="guessing no";;
beos*) gl_cv_func_printf_positions="guessing no";;
+ # Guess no on native Windows.
mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
*) gl_cv_func_printf_positions="guessing yes";;
esac
@@ -801,6 +851,7 @@ changequote(,)dnl
case "$host_os" in
cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
+ # Guess no on native Windows.
mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
*) gl_cv_func_printf_flag_grouping="guessing yes";;
esac
@@ -811,7 +862,7 @@ changequote([,])dnl
dnl Test whether the *printf family of functions supports the - flag correctly.
dnl (ISO C99.) See
-dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
+dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
dnl Result is gl_cv_func_printf_flag_leftadjust.
AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
@@ -843,6 +894,8 @@ changequote(,)dnl
hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
# Guess no on HP-UX 10 and older.
hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";;
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
# Guess yes otherwise.
*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
esac
@@ -853,7 +906,7 @@ changequote([,])dnl
dnl Test whether the *printf family of functions supports padding of non-finite
dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
-dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
+dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html>
dnl Result is gl_cv_func_printf_flag_zero.
AC_DEFUN([gl_PRINTF_FLAG_ZERO],
@@ -886,6 +939,8 @@ changequote(,)dnl
*-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
# Guess yes on BeOS.
beos*) gl_cv_func_printf_flag_zero="guessing yes";;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_printf_flag_zero="guessing no";;
# If we don't know, assume the worst.
*) gl_cv_func_printf_flag_zero="guessing no";;
esac
@@ -1153,6 +1208,8 @@ changequote(,)dnl
netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
# Guess yes on BeOS.
beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";;
# If we don't know, assume the worst.
*) gl_cv_func_snprintf_truncation_c99="guessing no";;
esac
@@ -1216,9 +1273,8 @@ int main ()
}]])],
[gl_cv_func_snprintf_retval_c99=yes],
[gl_cv_func_snprintf_retval_c99=no],
- [
+ [case "$host_os" in
changequote(,)dnl
- case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
# Guess yes on FreeBSD >= 5.
@@ -1243,10 +1299,19 @@ changequote(,)dnl
netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
# Guess yes on BeOS.
beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+changequote([,])dnl
+ # Guess yes on MSVC, no on mingw.
+ mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+ ],
+ [gl_cv_func_snprintf_retval_c99="guessing yes"],
+ [gl_cv_func_snprintf_retval_c99="guessing no"])
+ ;;
# If we don't know, assume the worst.
*) gl_cv_func_snprintf_retval_c99="guessing no";;
esac
-changequote([,])dnl
])
])
])
@@ -1326,6 +1391,8 @@ changequote(,)dnl
netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
# Guess yes on BeOS.
beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_snprintf_directive_n="guessing no";;
# If we don't know, assume the worst.
*) gl_cv_func_snprintf_directive_n="guessing no";;
esac
@@ -1342,6 +1409,7 @@ dnl Result is gl_cv_func_snprintf_size1.
AC_DEFUN([gl_SNPRINTF_SIZE1],
[
AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_SNPRINTF_PRESENCE])
AC_CACHE_CHECK([whether snprintf respects a size of 1],
[gl_cv_func_snprintf_size1],
@@ -1371,7 +1439,12 @@ int main()
}]])],
[gl_cv_func_snprintf_size1=yes],
[gl_cv_func_snprintf_size1=no],
- [gl_cv_func_snprintf_size1="guessing yes"])
+ [case "$host_os" in
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_snprintf_size1="guessing yes" ;;
+ *) gl_cv_func_snprintf_size1="guessing yes" ;;
+ esac
+ ])
])
])
@@ -1467,7 +1540,7 @@ changequote(,)dnl
netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
# Guess yes on BeOS.
beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on mingw.
+ # Guess yes on native Windows.
mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
# If we don't know, assume the worst.
*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
@@ -1533,7 +1606,8 @@ dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # .
dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . .
dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . .
dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
-dnl Solaris 11 2011-11 . . # # # . . # . . . # . . . . . . . .
+dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . .
+dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . .
dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . .
dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #