]> Savannah Git Hosting - gnulib.git/commitdiff
random: Fix test compilation failure on Cygwin 1.5.25.
authorBruno Haible <bruno@clisp.org>
Thu, 17 Aug 2017 12:17:58 +0000 (14:17 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 17 Aug 2017 12:17:58 +0000 (14:17 +0200)
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_INITSTATE,
HAVE_DECL_SETSTATE.
* m4/random.m4 (gl_FUNC_RANDOM): Test whether initstate and setstate are
declared.
* modules/stdlib (Makefile.am): Substitute HAVE_DECL_INITSTATE,
HAVE_DECL_SETSTATE.
* lib/stdlib.in.h (initstate): Declare also if HAVE_DECL_INITSTATE is 0.
(setstate): Declare also if HAVE_DECL_SETSTATE is 0.
* doc/posix-functions/initstate.texi: Mention the Cygwin 1.5.x problem.
* doc/posix-functions/random.texi: Likewise.
* doc/posix-functions/setstate.texi: Likewise.
* doc/posix-functions/srandom.texi: Likewise.

ChangeLog
doc/posix-functions/initstate.texi
doc/posix-functions/random.texi
doc/posix-functions/setstate.texi
doc/posix-functions/srandom.texi
lib/stdlib.in.h
m4/random.m4
m4/stdlib_h.m4
modules/stdlib

index d073889887e29eb0158fc8a4cc8d6a687acc669d..5d618bca86c217bbd5d533979e37efc9f688747b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2017-08-17  Bruno Haible  <bruno@clisp.org>
+
+       random: Fix test compilation failure on Cygwin 1.5.25.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_INITSTATE,
+       HAVE_DECL_SETSTATE.
+       * m4/random.m4 (gl_FUNC_RANDOM): Test whether initstate and setstate are
+       declared.
+       * modules/stdlib (Makefile.am): Substitute HAVE_DECL_INITSTATE,
+       HAVE_DECL_SETSTATE.
+       * lib/stdlib.in.h (initstate): Declare also if HAVE_DECL_INITSTATE is 0.
+       (setstate): Declare also if HAVE_DECL_SETSTATE is 0.
+       * doc/posix-functions/initstate.texi: Mention the Cygwin 1.5.x problem.
+       * doc/posix-functions/random.texi: Likewise.
+       * doc/posix-functions/setstate.texi: Likewise.
+       * doc/posix-functions/srandom.texi: Likewise.
+
 2017-08-16  Bruno Haible  <bruno@clisp.org>
 
        stdnoreturn: Fix test compilation failure on Cygwin.
index aca7e7bbc360724b61a34356b812089ddcb48002..0ddfebf56a1d2d973ac9f034f5ac45211033c77c 100644 (file)
@@ -11,6 +11,9 @@ Portability problems fixed by Gnulib:
 @item
 This function is missing on some platforms:
 Solaris 2.4, mingw, MSVC 14.
+@item
+This function is not declared on some platforms:
+Cygwin 1.5.25.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 93093df3ee0fe8c36c25ec33257addbf274b3dac..88d36f92b6acb2c1e2d2a9e8a63bed34e73a7617 100644 (file)
@@ -15,4 +15,8 @@ Solaris 2.4, mingw, MSVC 14.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+This function has a slightly incompatible declaration (the return type being
+@samp{int} instead of @samp{long}) on some platforms:
+Cygwin 1.5.25.
 @end itemize
index bc4a01e75259def42c1cb24ffd16d470518a16b6..23935745e9b1a3ced1cfd56aa3f4b2ebfe16f427 100644 (file)
@@ -11,6 +11,9 @@ Portability problems fixed by Gnulib:
 @item
 This function is missing on some platforms:
 Solaris 2.4, mingw, MSVC 14.
+@item
+This function is not declared on some platforms:
+Cygwin 1.5.25.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index db0eaefc0acde2c539ebdb2d85fe97426836730b..74770f78ca5f6c866ab271f7491d1802fb64fce3 100644 (file)
@@ -15,4 +15,8 @@ Solaris 2.4, mingw, MSVC 14.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+This function has a slightly incompatible declaration (the return type being
+@samp{long} instead of @samp{void) on some platforms:
+Cygwin 1.5.25.
 @end itemize
index c6e68fddc481fa63b0d67f10af9b7654b408a74b..ef41c992df5e16868e57c9db4748a7c2f5439edf 100644 (file)
@@ -597,7 +597,7 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
 #endif
 
 #if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
+# if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@
 _GL_FUNCDECL_SYS (initstate, char *,
                   (unsigned int seed, char *buf, size_t buf_size)
                   _GL_ARG_NONNULL ((2)));
@@ -614,7 +614,7 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
 #endif
 
 #if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
+# if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@
 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
 # endif
 _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
index acd093ddab2803bc47e441a8f60a2e961a1af2e3..f5cf0b54b07141ecfaece4e1e4fc1e17a77f4677 100644 (file)
@@ -1,4 +1,4 @@
-# random.m4 serial 1
+# random.m4 serial 2
 dnl Copyright (C) 2012-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,
@@ -12,6 +12,16 @@ AC_DEFUN([gl_FUNC_RANDOM],
   if test $ac_cv_func_random = no; then
     HAVE_RANDOM=0
   fi
+
+  AC_CHECK_DECLS_ONCE([initstate])
+  if test $ac_cv_have_decl_initstate = no; then
+    HAVE_DECL_INITSTATE=0
+  fi
+
+  AC_CHECK_DECLS_ONCE([setstate])
+  if test $ac_cv_have_decl_setstate = no; then
+    HAVE_DECL_SETSTATE=0
+  fi
 ])
 
 # Prerequisites of lib/random.c.
index ec4a058154bbbdcd94a9229994b50c719fcba641..35373463682e560327c92ceb785e8ce4cd1a4337 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 43
+# stdlib_h.m4 serial 44
 dnl Copyright (C) 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,
@@ -78,6 +78,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
   HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
   HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
+  HAVE_DECL_INITSTATE=1;     AC_SUBST([HAVE_DECL_INITSTATE])
   HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
   HAVE_MKOSTEMP=1;           AC_SUBST([HAVE_MKOSTEMP])
   HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
@@ -96,6 +97,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_SECURE_GETENV=1;      AC_SUBST([HAVE_SECURE_GETENV])
   HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
   HAVE_DECL_SETENV=1;        AC_SUBST([HAVE_DECL_SETENV])
+  HAVE_DECL_SETSTATE=1;      AC_SUBST([HAVE_DECL_SETSTATE])
   HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
   HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
   HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
index 257b5dbd697f8aa56824cc4b372594f2d4fd17af..62224e89f397bf6f2e9f4ece42710f688d1914e9 100644 (file)
@@ -72,6 +72,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
+             -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
              -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
@@ -89,6 +90,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
              -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
              -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
+             -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
              -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
              -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \