comparison m4/random.m4 @ 40134:cfcc57a4ed05

random: Fix compilation error on Android 4.3. * lib/stdlib.in.h (random, srandom): Test also REPLACE_RANDOM. (initstate): Test REPLACE_INITSTATE and HAVE_INITSTATE, not HAVE_RANDOM. (setstate): Test REPLACE_SETSTATE and HAVE_SETSTATE, not HAVE_RANDOM. * m4/random.m4 (gl_FUNC_RANDOM): Set HAVE_INITSTATE, HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_INITSTATE, HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * modules/stdlib (Makefile.am): Substitute HAVE_INITSTATE, HAVE_SETSTATE, REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * modules/random (Depends-on, configure.ac): Test also REPLACE_RANDOM, REPLACE_INITSTATE, REPLACE_SETSTATE. * doc/posix-functions/random.texi: Correct the description of the situation on Android. * doc/posix-functions/srandom.texi: Likewise. * doc/posix-functions/rand.texi: Likewise. * doc/posix-functions/srand.texi: Likewise.
author Bruno Haible <bruno@clisp.org>
date Fri, 25 Jan 2019 01:36:26 +0100
parents b06060465f09
children
comparison
equal deleted inserted replaced
40133:11b97647fb11 40134:cfcc57a4ed05
1 # random.m4 serial 3 1 # random.m4 serial 4
2 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc. 2 dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
19 [gl_cv_func_random=yes], 19 [gl_cv_func_random=yes],
20 [gl_cv_func_random=no]) 20 [gl_cv_func_random=no])
21 ]) 21 ])
22 if test $gl_cv_func_random = no; then 22 if test $gl_cv_func_random = no; then
23 HAVE_RANDOM=0 23 HAVE_RANDOM=0
24 HAVE_INITSTATE=0
25 HAVE_SETSTATE=0
26 else
27 AC_CHECK_FUNCS([initstate setstate])
28 if test $ac_cv_func_initstate = no; then
29 HAVE_INITSTATE=0
30 fi
31 if test $ac_cv_func_setstate = no; then
32 HAVE_SETSTATE=0
33 fi
34 if test $ac_cv_func_initstate = no || test $ac_cv_func_setstate = no; then
35 dnl In order to define initstate or setstate, we need to define all the
36 dnl functions at once.
37 REPLACE_RANDOM=1
38 if test $ac_cv_func_initstate = yes; then
39 REPLACE_INITSTATE=1
40 fi
41 if test $ac_cv_func_setstate = yes; then
42 REPLACE_SETSTATE=1
43 fi
44 fi
24 fi 45 fi
25 46
26 AC_CHECK_DECLS_ONCE([initstate]) 47 AC_CHECK_DECLS_ONCE([initstate])
27 if test $ac_cv_have_decl_initstate = no; then 48 if test $ac_cv_have_decl_initstate = no; then
28 HAVE_DECL_INITSTATE=0 49 HAVE_DECL_INITSTATE=0