/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
+/* Define to 1 if you have the `initstate_r' function. */
+#undef HAVE_INITSTATE_R
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `random_r' function. */
+#undef HAVE_RANDOM_R
+
+/* Define to 1 if you have the `setstate_r' function. */
+#undef HAVE_SETSTATE_R
+
+/* Define to 1 if you have the `srandom_r' function. */
+#undef HAVE_SRANDOM_R
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
# include <unistd.h>
#endif"
+ac_func_list=
ac_unique_file="Makefile.am"
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
>$cache_file
fi
+as_fn_append ac_func_list " random_r"
+as_fn_append ac_func_list " srandom_r"
+as_fn_append ac_func_list " initstate_r"
+as_fn_append ac_func_list " setstate_r"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12904 "configure"
+#line 12909 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13010 "configure"
+#line 13015 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
+# These are GLIBC
+
+
+
+ for ac_func in $ac_func_list
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+
+
+
+
if test "${multilib}" = "yes"; then
multilib_arg="--enable-multilib"
else
#include <langinfo.h>
#include <string.h>
+#include "config.h"
+
#include "ec.h"
#include "common-defs.h"
#include "io.h"
}
}
+#if HAVE_INITSTATE_R && HAVE_SRANDOM_R && HAVE_RANDOM_R
static struct random_data *buf = NULL;
static char *state = NULL;
static const size_t state_len = 256;
+#else
+static unsigned seed = 0;
+#endif
extern "C"
void
size_t input_offset,
size_t input_size)
{
+ int32_t retval_31;
+ int rdigits;
+#if HAVE_INITSTATE_R && HAVE_SRANDOM_R && HAVE_RANDOM_R
// This creates a thread-safe pseudo-random number generator
// using input as the seed
__gg__clock_gettime(CLOCK_REALTIME, &ts);
initstate_r( ts.tv_nsec, state, state_len, buf);
}
-
- int rdigits;
int seed = (int)__gg__binary_value_from_qualified_field(&rdigits,
input,
input_offset,
input_size);
srandom_r(seed, buf);
- int32_t retval_31;
random_r(buf, &retval_31);
+#else
+ seed = (unsigned)__gg__binary_value_from_qualified_field(&rdigits,
+ input,
+ input_offset,
+ input_size);
+ srandom (seed);
+ retval_31 = random ();
+#endif
// We are going to convert this to a value between zero and not quite one:
double retval = double(retval_31) / double(0x80000000UL);
__gg__double_to_target( dest,
void
__gg__random_next(cblc_field_t *dest)
{
+ int32_t retval_31;
+#if HAVE_INITSTATE_R && HAVE_SRANDOM_R && HAVE_RANDOM_R
// The return value is between zero and not quite one
if( !buf )
__gg__clock_gettime(CLOCK_REALTIME, &ts);
initstate_r( ts.tv_nsec, state, state_len, buf);
}
- int32_t retval_31;
random_r(buf, &retval_31);
-
+#else
+ retval_31 = random ();
+#endif
// We are going to convert this to a value between zero and not quite one:
double retval = double(retval_31) / double(0x80000000UL);
__gg__double_to_target( dest,