2 dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_RANDOM],
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
11 dnl We can't use AC_CHECK_FUNC here, because random() is defined as a
12 dnl static inline function when compiling for Android 4.4 or older.
13 AC_CACHE_CHECK([for random], [gl_cv_func_random],
16 [[#include <stdlib.h>]],
17 [[return random() == 0;]])
19 [gl_cv_func_random=yes],
20 [gl_cv_func_random=no])
22 if test $gl_cv_func_random = no; then
26 AC_CHECK_DECLS_ONCE([initstate])
27 if test $ac_cv_have_decl_initstate = no; then
31 AC_CHECK_DECLS_ONCE([setstate])
32 if test $ac_cv_have_decl_setstate = no; then
37 # Prerequisites of lib/random.c.
38 AC_DEFUN([gl_PREREQ_RANDOM], [