From 9ce0a22eb1a1880d49152ecc15a38f7850c875b8 Mon Sep 17 00:00:00 2001
From: Paolo Carlini <paolo.carlini@oracle.com>
Date: Sun, 24 Aug 2008 23:47:35 +0000
Subject: [PATCH] acinclude.m4 ([GLIBCXX_CHECK_RANDOM_TR1]): Simplify, just use
 two test -r instead of an AC_TRY_RUN.

2008-08-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* acinclude.m4 ([GLIBCXX_CHECK_RANDOM_TR1]): Simplify, just use
	two test -r instead of an AC_TRY_RUN.
	* configure: Regenerate.
	* config.h.in: Likewise.

From-SVN: r139549
---
 libstdc++-v3/ChangeLog    |  7 ++++++
 libstdc++-v3/acinclude.m4 | 21 +++++++----------
 libstdc++-v3/config.h.in  |  4 ++--
 libstdc++-v3/configure    | 49 +++++++--------------------------------
 4 files changed, 26 insertions(+), 55 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 48e035231df0..623948a828bf 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-24  Paolo Carlini  <paolo.carlini@oracle.com>
+
+	* acinclude.m4 ([GLIBCXX_CHECK_RANDOM_TR1]): Simplify, just use
+	two test -r instead of an AC_TRY_RUN.
+	* configure: Regenerate.
+	* config.h.in: Likewise.
+
 2008-08-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
 	* acinclude.m4 ([GLIBCXX_ENABLE_CLOCK_GETTIME]): Improve documentation.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 7c854ecff4c4..8ea21ceebbad 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1549,27 +1549,24 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
 ])
 
 dnl
-dnl Check whether "dev/random" and "dev/urandom" are available for the
+dnl Check whether "/dev/random" and "/dev/urandom" are available for the
 dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
 dnl
 AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
 
-  AC_MSG_CHECKING([for "dev/random" and "dev/urandom" for TR1 random_device])
+  AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device])
   AC_CACHE_VAL(glibcxx_cv_random_tr1, [
-  AC_TRY_RUN([#include <stdio.h>
-	      int main()
-	      {
-                return !(fopen("/dev/random", "r")
-                         && fopen("/dev/urandom", "r"));
-	      }	      
-	     ],
-             [glibcxx_cv_random_tr1=yes], [glibcxx_cv_random_tr1=no],
-	     [glibcxx_cv_random_tr1=no])
+    if test -r /dev/random && test -r /dev/urandom; then
+      glibcxx_cv_random_tr1=yes;
+    else
+      glibcxx_cv_random_tr1=no;
+    fi
   ])
   AC_MSG_RESULT($glibcxx_cv_random_tr1)
+
   if test x"$glibcxx_cv_random_tr1" = x"yes"; then
     AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1,
-              [Define if dev/random and dev/urandom are available for
+              [Define if /dev/random and /dev/urandom are available for
 	       the random_device of TR1 (Chapter 5.1).])
   fi
 
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 20f298df6d7d..ae11784e71a7 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -829,8 +829,8 @@
 /* Define if NLS translations are to be used. */
 #undef _GLIBCXX_USE_NLS
 
-/* Define if dev/random and dev/urandom are available for the random_device of
-   TR1 (Chapter 5.1). */
+/* Define if /dev/random and /dev/urandom are available for the random_device
+   of TR1 (Chapter 5.1). */
 #undef _GLIBCXX_USE_RANDOM_TR1
 
 /* Define if standard layout types are supported in C++200x. */
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 97d943044c8c..98b0934b5a2c 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -42631,56 +42631,23 @@ done
   # For dev/random and dev/urandom for TR1.
 
 
-  echo "$as_me:$LINENO: checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device" >&5
-echo $ECHO_N "checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device... $ECHO_C" >&6
+  echo "$as_me:$LINENO: checking for \"/dev/random\" and \"/dev/urandom\" for TR1 random_device" >&5
+echo $ECHO_N "checking for \"/dev/random\" and \"/dev/urandom\" for TR1 random_device... $ECHO_C" >&6
   if test "${glibcxx_cv_random_tr1+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-  if test "$cross_compiling" = yes; then
-  glibcxx_cv_random_tr1=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-	      int main()
-	      {
-                return !(fopen("/dev/random", "r")
-                         && fopen("/dev/urandom", "r"));
-	      }
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  glibcxx_cv_random_tr1=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-glibcxx_cv_random_tr1=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+    if test -r /dev/random && test -r /dev/urandom; then
+      glibcxx_cv_random_tr1=yes;
+    else
+      glibcxx_cv_random_tr1=no;
+    fi
 
 fi
 
   echo "$as_me:$LINENO: result: $glibcxx_cv_random_tr1" >&5
 echo "${ECHO_T}$glibcxx_cv_random_tr1" >&6
+
   if test x"$glibcxx_cv_random_tr1" = x"yes"; then
 
 cat >>confdefs.h <<\_ACEOF
-- 
GitLab