changeset 10719:620520e8b04c

stdlib: Provide struct random_data. * m4/stdlib_h.m4: Check for struct random_data. Initialize and substitute HAVE_STRUCT_RANDOM_DATA. * lib/stdlib.in.h [!HAVE_STRUCT_RANDOM_DATA]: Provide struct random_data. * modules/stdlib (Makefile.am): Substitute HAVE_STRUCT_RANDOM_DATA.
author Simon Josefsson <simon@josefsson.org>
date Sun, 26 Oct 2008 11:04:17 +0100
parents a60fbd64e287
children 6230d1dc400e
files ChangeLog lib/stdlib.in.h m4/stdlib_h.m4 modules/stdlib
diffstat 4 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 26 09:38:56 2008 +0100
+++ b/ChangeLog	Sun Oct 26 11:04:17 2008 +0100
@@ -1,3 +1,12 @@
+2008-10-26  Simon Josefsson  <simon@josefsson.org>
+
+	* m4/stdlib_h.m4: Check for struct random_data.  Initialize and
+	substitute HAVE_STRUCT_RANDOM_DATA.
+	* lib/stdlib.in.h [!HAVE_STRUCT_RANDOM_DATA]: Provide struct
+	random_data.
+	* modules/stdlib (Makefile.am): Substitute
+	HAVE_STRUCT_RANDOM_DATA.
+
 2008-10-26  Simon Josefsson  <simon@josefsson.org>
 
 	* doc/gnulib.texi (@copying): Use GFDLv1.2+.
--- a/lib/stdlib.in.h	Sun Oct 26 09:38:56 2008 +0100
+++ b/lib/stdlib.in.h	Sun Oct 26 11:04:17 2008 +0100
@@ -41,10 +41,23 @@
 # include <sys/loadavg.h>
 #endif
 
-#if @GNULIB_RANDOM_R@
+#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@
 # include <stdint.h>
 #endif
 
+#if !@HAVE_STRUCT_RANDOM_DATA@
+struct random_data
+{
+  int32_t *fptr;		/* Front pointer.  */
+  int32_t *rptr;		/* Rear pointer.  */
+  int32_t *state;		/* Array of state values.  */
+  int rand_type;		/* Type of random number generator.  */
+  int rand_deg;		/* Degree of random number generator.  */
+  int rand_sep;		/* Distance between front and rear.  */
+  int32_t *end_ptr;		/* Pointer behind state table.  */
+};
+#endif
+
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 
--- a/m4/stdlib_h.m4	Sun Oct 26 09:38:56 2008 +0100
+++ b/m4/stdlib_h.m4	Sun Oct 26 11:04:17 2008 +0100
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 11
+# stdlib_h.m4 serial 12
 dnl Copyright (C) 2007, 2008 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,6 +8,7 @@
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([stdlib.h])
+  AC_CHECK_TYPES([struct random_data], [], [], [[#include <stdlib.h>]])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -48,6 +49,7 @@
   HAVE_STRTOD=1;          AC_SUBST([HAVE_STRTOD])
   HAVE_STRTOLL=1;         AC_SUBST([HAVE_STRTOLL])
   HAVE_STRTOULL=1;        AC_SUBST([HAVE_STRTOULL])
+  HAVE_STRUCT_RANDOM_DATA=0;   AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
   HAVE_SYS_LOADAVG_H=0;   AC_SUBST([HAVE_SYS_LOADAVG_H])
   HAVE_UNSETENV=1;        AC_SUBST([HAVE_UNSETENV])
   HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
--- a/modules/stdlib	Sun Oct 26 09:38:56 2008 +0100
+++ b/modules/stdlib	Sun Oct 26 11:04:17 2008 +0100
@@ -52,6 +52,7 @@
 	      -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
 	      -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
 	      -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
+	      -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
 	      -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
 	      -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
 	      -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \