summaryrefslogtreecommitdiff
path: root/gl/m4
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-02-27 09:23:52 +0100
committerSimon Josefsson <simon@josefsson.org>2009-02-27 09:23:52 +0100
commita13df3057a9d99f45a29fa874d4cc2a63bf8d7a0 (patch)
tree907c10d8576bed86fc0f1a6b78acc9c59b63b959 /gl/m4
parentde49e9f7685d086d07f8595553c25ca2d501aeab (diff)
downloadgnutls-a13df3057a9d99f45a29fa874d4cc2a63bf8d7a0.tar.gz
Update gnulib files.
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/gnulib-comp.m43
-rw-r--r--gl/m4/printf.m4182
-rw-r--r--gl/m4/stdint.m472
-rw-r--r--gl/m4/stdlib_h.m44
-rw-r--r--gl/m4/vasnprintf.m420
5 files changed, 225 insertions, 56 deletions
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 42a1e8dfdf..f2cc584c8a 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -221,6 +221,7 @@ AC_SUBST([LTALLOCA])
m4_pushdef([gltests_LIBSOURCES_DIR], [])
gl_COMMON
gl_source_base='gl/tests'
+ gl_FUNC_UNGETC_WORKS
gl_FUNC_GETTIMEOFDAY
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
@@ -470,6 +471,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
+ m4/ungetc.m4
m4/unistd_h.m4
m4/vasnprintf.m4
m4/warnings.m4
@@ -483,6 +485,7 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-errno.c
tests/test-fseeko.c
tests/test-fseeko.sh
+ tests/test-fseeko2.sh
tests/test-getaddrinfo.c
tests/test-getdelim.c
tests/test-getline.c
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index a1d4dadd7b..4207ace49f 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 28
+# printf.m4 serial 31
dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -125,7 +125,8 @@ changequote([,])dnl
])
dnl Test whether the *printf family of functions supports infinite and NaN
-dnl 'double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
+dnl 'double' arguments and negative zero arguments in the %f, %e, %g
+dnl directives. (ISO C99, POSIX:2001)
dnl Result is gl_cv_func_printf_infinite.
AC_DEFUN([gl_PRINTF_INFINITE],
@@ -156,6 +157,13 @@ strisnan (const char *string, size_t start_index, size_t end_index)
}
return 0;
}
+static int
+have_minus_zero ()
+{
+ static double plus_zero = 0.0;
+ double minus_zero = - plus_zero;
+ return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+}
static char buf[10000];
static double zero = 0.0;
int main ()
@@ -187,6 +195,11 @@ int main ()
if (sprintf (buf, "%g", zero / zero) < 0
|| !strisnan (buf, 0, strlen (buf)))
return 1;
+ /* This test fails on HP-UX 10.20. */
+ if (have_minus_zero ())
+ if (sprintf (buf, "%g", - zero) < 0
+ || strcmp (buf, "-0") != 0)
+ return 1;
return 0;
}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no],
[
@@ -612,6 +625,73 @@ changequote([,])dnl
])
])
+dnl Test whether the *printf family of functions supports the %ls format
+dnl directive and in particular, when a precision is specified, whether
+dnl the functions stop converting the wide string argument when the number
+dnl of bytes that have been produced by this conversion equals or exceeds
+dnl the precision.
+dnl Result is gl_cv_func_printf_directive_ls.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether printf supports the 'ls' directive],
+ [gl_cv_func_printf_directive_ls],
+ [
+ AC_TRY_RUN([
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+ included before <wchar.h>. */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+#include <string.h>
+int main ()
+{
+ char buf[100];
+ /* Test whether %ls works at all.
+ This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku. */
+ {
+ static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
+ buf[0] = '\0';
+ if (sprintf (buf, "%ls", wstring) < 0
+ || strcmp (buf, "abc") != 0)
+ return 1;
+ }
+ /* Test whether precisions in %ls are supported as specified in ISO C 99
+ section 7.19.6.1:
+ "If a precision is specified, no more than that many bytes are written
+ (including shift sequences, if any), and the array shall contain a
+ null wide character if, to equal the multibyte character sequence
+ length given by the precision, the function would need to access a
+ wide character one past the end of the array."
+ This test fails on Solaris 10. */
+ {
+ static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 };
+ buf[0] = '\0';
+ if (sprintf (buf, "%.2ls", wstring) < 0
+ || strcmp (buf, "ab") != 0)
+ return 1;
+ }
+ return 0;
+}], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no],
+ [
+changequote(,)dnl
+ case "$host_os" in
+ openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
+ solaris*) gl_cv_func_printf_directive_ls="guessing no";;
+ irix*) 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";;
+ esac
+changequote([,])dnl
+ ])
+ ])
+])
+
dnl Test whether the *printf family of functions supports POSIX/XSI format
dnl strings with positions. (POSIX:2001)
dnl Result is gl_cv_func_printf_positions.
@@ -1261,18 +1341,19 @@ dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE
dnl 5 = gl_PRINTF_DIRECTIVE_A
dnl 6 = gl_PRINTF_DIRECTIVE_F
dnl 7 = gl_PRINTF_DIRECTIVE_N
-dnl 8 = gl_PRINTF_POSITIONS
-dnl 9 = gl_PRINTF_FLAG_GROUPING
-dnl 10 = gl_PRINTF_FLAG_LEFTADJUST
-dnl 11 = gl_PRINTF_FLAG_ZERO
-dnl 12 = gl_PRINTF_PRECISION
-dnl 13 = gl_PRINTF_ENOMEM
-dnl 14 = gl_SNPRINTF_PRESENCE
-dnl 15 = gl_SNPRINTF_TRUNCATION_C99
-dnl 16 = gl_SNPRINTF_RETVAL_C99
-dnl 17 = gl_SNPRINTF_DIRECTIVE_N
-dnl 18 = gl_SNPRINTF_SIZE1
-dnl 19 = gl_VSNPRINTF_ZEROSIZE_C99
+dnl 8 = gl_PRINTF_DIRECTIVE_LS
+dnl 9 = gl_PRINTF_POSITIONS
+dnl 10 = gl_PRINTF_FLAG_GROUPING
+dnl 11 = gl_PRINTF_FLAG_LEFTADJUST
+dnl 12 = gl_PRINTF_FLAG_ZERO
+dnl 13 = gl_PRINTF_PRECISION
+dnl 14 = gl_PRINTF_ENOMEM
+dnl 15 = gl_SNPRINTF_PRESENCE
+dnl 16 = gl_SNPRINTF_TRUNCATION_C99
+dnl 17 = gl_SNPRINTF_RETVAL_C99
+dnl 18 = gl_SNPRINTF_DIRECTIVE_N
+dnl 19 = gl_SNPRINTF_SIZE1
+dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99
dnl
dnl 1 = checking whether printf supports size specifiers as in C99...
dnl 2 = checking whether printf supports 'long double' arguments...
@@ -1281,42 +1362,43 @@ dnl 4 = checking whether printf supports infinite 'long double' arguments...
dnl 5 = checking whether printf supports the 'a' and 'A' directives...
dnl 6 = checking whether printf supports the 'F' directive...
dnl 7 = checking whether printf supports the 'n' directive...
-dnl 8 = checking whether printf supports POSIX/XSI format strings with positions...
-dnl 9 = checking whether printf supports the grouping flag...
-dnl 10 = checking whether printf supports the left-adjust flag correctly...
-dnl 11 = checking whether printf supports the zero flag correctly...
-dnl 12 = checking whether printf supports large precisions...
-dnl 13 = checking whether printf survives out-of-memory conditions...
-dnl 14 = checking for snprintf...
-dnl 15 = checking whether snprintf truncates the result as in C99...
-dnl 16 = checking whether snprintf returns a byte count as in C99...
-dnl 17 = checking whether snprintf fully supports the 'n' directive...
-dnl 18 = checking whether snprintf respects a size of 1...
-dnl 19 = checking whether vsnprintf respects a zero size as in C99...
+dnl 8 = checking whether printf supports the 'ls' directive...
+dnl 9 = checking whether printf supports POSIX/XSI format strings with positions...
+dnl 10 = checking whether printf supports the grouping flag...
+dnl 11 = checking whether printf supports the left-adjust flag correctly...
+dnl 12 = checking whether printf supports the zero flag correctly...
+dnl 13 = checking whether printf supports large precisions...
+dnl 14 = checking whether printf survives out-of-memory conditions...
+dnl 15 = checking for snprintf...
+dnl 16 = checking whether snprintf truncates the result as in C99...
+dnl 17 = checking whether snprintf returns a byte count as in C99...
+dnl 18 = checking whether snprintf fully supports the 'n' directive...
+dnl 19 = checking whether snprintf respects a size of 1...
+dnl 20 = checking whether vsnprintf respects a zero size as in C99...
dnl
dnl . = yes, # = no.
dnl
-dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
-dnl glibc 2.5 . . . . . . . . . . . . . . . . . . .
-dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . .
-dnl FreeBSD 5.4, 6.1 . . . . # . . . . . # . # . . . . . .
-dnl MacOS X 10.3.9 . . . . # . . . . . # . # . . . . . .
-dnl OpenBSD 3.9, 4.0 . . # # # # . . # . # . # . . . . . .
-dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . ? # ? ? . . . . . .
-dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . . # ? # ? ? . . . . . .
-dnl Solaris 10 . . # # # . . . . . # . . . . . . . .
-dnl Solaris 2.6 ... 9 # . # # # # . . . . # . . . . . . . .
-dnl Solaris 2.5.1 # . # # # # . . . . # . . # # # # # #
-dnl AIX 5.2 . . # # # . . . . . # . . . . . . . .
-dnl AIX 4.3.2, 5.1 # . # # # # . . . . # . . . . . . . .
-dnl HP-UX 11.31 . . . . # . . . . . # . . . . # # . .
-dnl HP-UX 11.{00,11,23} # . . . # # . . . . # . . . . # # . #
-dnl HP-UX 10.20 # . . . # # . . . # # . . . . # # ? #
-dnl IRIX 6.5 # . # # # # . . . . # . . . . # . . .
-dnl OSF/1 5.1 # . # # # # . . . . # . . . . # . . #
-dnl OSF/1 4.0d # . # # # # . . . . # . . # # # # # #
-dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? ? ? ? . . . ? ? ?
-dnl NetBSD 3.0 . . . . # # . # # ? # . # . . . . . .
-dnl Haiku . . . # # # . . . . . . ? . . . . . .
-dnl BeOS # # . # # # . # . ? . # ? . . . . . .
-dnl mingw # # # # # # . # # . # # ? . # # # . .
+dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
+dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
+dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
+dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . .
+dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . .
+dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . . ? # ? ? . . . . . .
+dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . ? . # ? # ? ? . . . . . .
+dnl Solaris 10 . . # # # . . # . . . # . . . . . . . .
+dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . .
+dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
+dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . .
+dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . .
+dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
+dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
+dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? #
+dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . .
+dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . #
+dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # #
+dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
+dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
+dnl Haiku . . . # # # . # . . . . . ? . . . . . .
+dnl BeOS # # . # # # . ? # . ? . # ? . . . . . .
+dnl mingw # # # # # # . . # # . # # ? . # # # . .
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index b4194c8adc..a2e8bdd628 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 33
+# stdint.m4 serial 34
dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -201,7 +201,75 @@ struct s {
int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
};
]])],
- [gl_cv_header_working_stdint_h=yes])])
+ [dnl Determine whether the various *_MIN, *_MAX macros are usable
+ dnl in preprocessor expression. We could do it by compiling a test
+ dnl program for each of these macros. It is faster to run a program
+ dnl that inspects the macro expansion.
+ dnl This detects a bug on HP-UX 11.23/ia64.
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
+#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#include <stdint.h>
+]
+gl_STDINT_INCLUDES
+[
+#include <stdio.h>
+#include <string.h>
+#define MVAL(macro) MVAL1(macro)
+#define MVAL1(expression) #expression
+static const char *macro_values[] =
+ {
+#ifdef INT8_MAX
+ MVAL (INT8_MAX),
+#endif
+#ifdef INT16_MAX
+ MVAL (INT16_MAX),
+#endif
+#ifdef INT32_MAX
+ MVAL (INT32_MAX),
+#endif
+#ifdef INT64_MAX
+ MVAL (INT64_MAX),
+#endif
+#ifdef UINT8_MAX
+ MVAL (UINT8_MAX),
+#endif
+#ifdef UINT16_MAX
+ MVAL (UINT16_MAX),
+#endif
+#ifdef UINT32_MAX
+ MVAL (UINT32_MAX),
+#endif
+#ifdef UINT64_MAX
+ MVAL (UINT64_MAX),
+#endif
+ NULL
+ };
+]], [[
+ const char **mv;
+ for (mv = macro_values; *mv != NULL; mv++)
+ {
+ const char *value = *mv;
+ /* Test whether it looks like a cast expression. */
+ if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
+ || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
+ || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
+ || strncmp (value, "((int)"/*)*/, 6) == 0
+ || strncmp (value, "((signed short)"/*)*/, 15) == 0
+ || strncmp (value, "((signed char)"/*)*/, 14) == 0)
+ return 1;
+ }
+ return 0;
+]])],
+ [gl_cv_header_working_stdint_h=yes],
+ [],
+ [dnl When cross-compiling, assume it works.
+ gl_cv_header_working_stdint_h=yes
+ ])
+ ])
+ ])
fi
if test "$gl_cv_header_working_stdint_h" = yes; then
STDINT_H=
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index 515befeb7e..b295f16b27 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 14
+# stdlib_h.m4 serial 15
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,7 @@ AC_DEFUN([gl_STDLIB_H],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([stdlib.h])
- AC_CHECK_HEADERS([random.h])
+ AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT])
if test $ac_cv_header_random_h = yes; then
HAVE_RANDOM_H=1
else
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
index 9e839d2bc8..01e8772f11 100644
--- a/gl/m4/vasnprintf.m4
+++ b/gl/m4/vasnprintf.m4
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 26
+# vasnprintf.m4 serial 28
dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -58,7 +58,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF],
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
- AC_CHECK_FUNCS([snprintf wcslen])
+ AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
dnl Use the _snprintf function only if it is declared (because on NetBSD it
dnl is defined as a weak alias of snprintf; we prefer to use the latter).
AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
@@ -150,6 +150,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
esac
])
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
+[
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ case "$gl_cv_func_printf_directive_ls" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
+ [Define if the vasnprintf implementation needs special code for
+ the 'ls' directive.])
+ ;;
+ esac
+])
+
# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
[
@@ -247,6 +262,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO