Avoid redefining 'struct random_data' on OSF/1 5.1.
authorBruno Haible <bruno@clisp.org>
Sun, 25 Jan 2009 20:47:34 +0000 (21:47 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 25 Jan 2009 20:47:34 +0000 (21:47 +0100)
ChangeLog
lib/stdlib.in.h
m4/stdlib_h.m4
modules/stdlib

index 254e1db..7aaf2a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-01-25  Bruno Haible  <bruno@clisp.org>
 
+       Avoid redefining 'struct random_data' on OSF/1 5.1.
+       * lib/stdlib.in.h: Include <random.h> if it exists.
+       * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether <random.h> exists. Set
+       HAVE_RANDOM_H. Include <random.h> when testing whether
+       'struct random_data' exists.
+       * modules/stdlib (Makefile.am): Substitute HAVE_RANDOM_H.
+
+2009-01-25  Bruno Haible  <bruno@clisp.org>
+
        Don't install charset.alias on MacOS X >= 10.3.
        * lib/localcharset.c (DARWIN7): New macro.
        (get_charset_aliases): Hardcode the result for Darwin7.
index 3820b10..f99767f 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 # include <sys/loadavg.h>
 #endif
 
+/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
+   from <stdlib.h> if _REENTRANT is defined.  Include it always.  */
+#if @HAVE_RANDOM_H@
+# include <random.h>
+#endif
+
 #if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@
 # include <stdint.h>
 #endif
index 582db13..515befe 100644 (file)
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 13
-dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 14
+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,
 dnl with or without modifications, as long as this notice is preserved.
@@ -8,9 +8,20 @@ AC_DEFUN([gl_STDLIB_H],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([stdlib.h])
+  AC_CHECK_HEADERS([random.h])
+  if test $ac_cv_header_random_h = yes; then
+    HAVE_RANDOM_H=1
+  else
+    HAVE_RANDOM_H=0
+  fi
+  AC_SUBST([HAVE_RANDOM_H])
   AC_CHECK_TYPES([struct random_data],
     [], [HAVE_STRUCT_RANDOM_DATA=0],
-    [[#include <stdlib.h>]])
+    [[#include <stdlib.h>
+      #if HAVE_RANDOM_H
+      # include <random.h>
+      #endif
+    ]])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
index edd9e45..38cc2be 100644 (file)
@@ -24,6 +24,7 @@ stdlib.h: stdlib.in.h
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
              -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
              -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
              -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \