StateSize<std::mersenne_twister_engine<UIntType, w, n, m, r,
a, u, d, s, b, t, c, l, f>>::value;
-#if FOLLY_USE_SIMD_PRNG
+#if FOLLY_HAVE_EXTRANDOM_SFMT19937
template <class UIntType, size_t m, size_t pos1, size_t sl1, size_t sl2,
size_t sr1, size_t sr2, uint32_t msk1, uint32_t msk2, uint32_t msk3,
#include <stdint.h>
#include <folly/ThreadLocal.h>
-#if __GNUC_PREREQ(4, 8) && !defined(ANDROID)
+#if FOLLY_HAVE_EXTRANDOM_SFMT19937
#include <ext/random>
-#define FOLLY_USE_SIMD_PRNG 1
#endif
namespace folly {
public:
// Default generator type.
-#if FOLLY_USE_SIMD_PRNG
+#if FOLLY_HAVE_EXTRANDOM_SFMT19937
typedef __gnu_cxx::sfmt19937 DefaultGenerator;
#else
typedef std::mt19937 DefaultGenerator;
[folly_cv_prog_cc_xsi_strerror_r=yes],
[folly_cv_prog_cc_xsi_strerror_r=no])])
+AC_CACHE_CHECK(
+ [for ext/random and __gnu_cxx::sfmt19937],
+ [folly_cv_prog_cc_have_extrandom_sfmt19937],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE[
+ #include <ext/random>
+ int main(int argc, char** argv) {
+ __gnu_cxx::sfmt19937 rng;
+ return 0;
+ }
+ ]],
+ [folly_cv_prog_cc_have_extrandom_sfmt19937=yes],
+ [folly_cv_prog_cc_have_extrandom_sfmt19937=no])])
+
if test "$folly_cv_prog_cc_xsi_strerror_r" = "yes"; then
AC_DEFINE([HAVE_XSI_STRERROR_R], [1], [Define to 1 if the runtime supports XSI-style strerror_r])
fi
AM_CONDITIONAL([HAVE_WEAK_SYMBOLS],
[test "$folly_cv_prog_cc_weak_symbols" = "yes"])
AM_CONDITIONAL([HAVE_BITS_FUNCTEXCEPT], [test "$ac_cv_header_bits_functexcept_h" = "yes"])
+AM_CONDITIONAL([HAVE_EXTRANDOM_SFMT19937],
+ [test "$folly_cv_prog_cc_have_extrandom_sfmt19937" = "yes"])
# Output
AC_CONFIG_FILES([Makefile
EXPECT_EQ(sizeof(uint_fast32_t) / 4 + 3,
StateSize<std::minstd_rand0>::value);
EXPECT_EQ(624, StateSize<std::mt19937>::value);
-#if FOLLY_USE_SIMD_PRNG
+#if FOLLY_HAVE_EXTRANDOM_SFMT19937
EXPECT_EQ(624, StateSize<__gnu_cxx::sfmt19937>::value);
#endif
EXPECT_EQ(24, StateSize<std::ranlux24_base>::value);