http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54419

--- Comment #25 from Dominique d'Humieres <dominiq at lps dot ens.fr> 
2012-09-04 16:14:01 UTC ---
I am now at stage 2 with

--- ../_clean/libstdc++-v3/configure    2012-08-29 10:19:44.000000000 +0200
+++ ../p_work/libstdc++-v3/configure    2012-09-04 17:51:54.000000000 +0200
@@ -3523,11 +3523,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}ma

 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'

-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'



@@ -70621,6 +70621,31 @@ $as_echo "#define _GLIBCXX_LONG_DOUBLE_C
 esac


+ac_cv_x86_rdrand=no
+case "$target" in
+  i?86-*-* | \
+  x86_64-*-*)
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+int
+main ()
+{
+  asm("rdrand %eax");
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_x86_rdrand=yes
+else
+  ac_cv_x86_rdrand=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+esac
+if test $ac_cv_x86_rdrand = yes; then
+
+$as_echo "#define _GLIBCXX_X86_RDRAND 1" >>confdefs.h
+
+fi
+
 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.

   if $GLIBCXX_IS_NATIVE ; then
--- ../_clean/libstdc++-v3/src/c++11/random.cc    2012-08-30 00:56:27.000000000
+0200
+++ ../p_work/libstdc++-v3/src/c++11/random.cc    2012-09-04 16:25:54.000000000
+0200
@@ -50,7 +50,7 @@ namespace std _GLIBCXX_VISIBILITY(defaul
       return __ret;
     }

-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
     unsigned int
     __attribute__ ((target("rdrnd")))
     __x86_rdrand(void)
@@ -75,7 +75,7 @@ namespace std _GLIBCXX_VISIBILITY(defaul

     if (token == "default")
       {
-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
     unsigned int eax, ebx, ecx, edx;
     __cpuid(0, eax, ebx, ecx, edx);
     // Check for "GenuineIntel"
@@ -119,7 +119,7 @@ namespace std _GLIBCXX_VISIBILITY(defaul
   random_device::result_type
   random_device::_M_getval()
   {
-#if (defined __i386__ || defined __x86_64__)
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
     if (! _M_file)
       return __x86_rdrand();
 #endif

Jack can you try it on you mac(s)?

Reply via email to