diff options
author | Tony Cook <tony@develop-help.com> | 2013-09-09 14:06:35 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2013-09-13 11:33:58 +1000 |
commit | 890c2948b68476f972f9648473ed11faf48e159f (patch) | |
tree | 512070f0635716c5eb6bfc785453c5f55a2bcbb5 | |
parent | e4b87ea5b1e1680899962dea307e569335b79ebe (diff) | |
download | perl-890c2948b68476f972f9648473ed11faf48e159f.tar.gz |
[perl #115928] Configure now selects our internal drand48()
-rwxr-xr-x | Configure | 123 | ||||
-rw-r--r-- | Cross/config.sh-arm-linux | 8 | ||||
-rw-r--r-- | Cross/config.sh-arm-linux-n770 | 8 | ||||
-rw-r--r-- | NetWare/config.wc | 10 | ||||
-rw-r--r-- | uconfig.h | 12 | ||||
-rw-r--r-- | uconfig.sh | 8 | ||||
-rw-r--r-- | win32/config.ce | 10 | ||||
-rw-r--r-- | win32/config.gc | 10 | ||||
-rw-r--r-- | win32/config.vc | 10 |
9 files changed, 44 insertions, 155 deletions
@@ -19489,26 +19489,7 @@ esac : How can we generate normalized random numbers ? echo " " -echo "Looking for a random number function..." >&4 -case "$randfunc" in -'') - if set drand48 val -f; eval $csym; $val; then - dflt="drand48" - echo "Good, found drand48()." >&4 - elif set random val -f; eval $csym; $val; then - dflt="random" - echo "OK, found random()." >&4 - else - dflt="rand" - echo "Yuck, looks like I have to use rand()." >&4 - fi - echo " " - ;; -*) - dflt="$randfunc" - ;; -esac -cont=true +echo "Using our internal random number implementation..." >&4 case "$ccflags" in *-Dmy_rand=*|*-Dmy_srand=*) @@ -19519,103 +19500,11 @@ case "$ccflags" in ;; esac -while $test "$cont"; do - rp="Use which function to generate random numbers?" - . ./myread - if $test "$ans" = "$dflt"; then - : null - else - randbits='' - fi - randfunc="$ans" - if set $ans val -f; eval $csym; $val; then - cont='' - else - dflt=y - rp="I cannot find function $ans. Use that name anyway?" - . ./myread - dflt=rand - case "$ans" in - [yY]*) cont='';; - esac - fi - case "$cont" in - '') - case "$randfunc" in - drand48) - drand01="drand48()" - seedfunc="srand48" - randbits=48 - randseedtype=long - ;; - rand|random) - case "$randbits" in - '') -echo "Checking to see how many bits your $randfunc() function produces..." >&4 - $cat >try.c <<EOCP -#$i_unistd I_UNISTD -#$i_stdlib I_STDLIB -#include <stdio.h> -#ifdef I_UNISTD -# include <unistd.h> -#endif -#ifdef I_STDLIB -# include <stdlib.h> -#endif -int main() -{ - int i; - unsigned long tmp; - unsigned long max = 0L; - - for (i = 1000; i; i--) { - tmp = (unsigned long) $randfunc(); - if (tmp > max) max = tmp; - } - for (i = 0; max; i++) - max /= 2; - printf("%d\n",i); -} -EOCP - set try - if eval $compile_ok; then - dflt=`try` - else - dflt='?' - echo "(I can't seem to compile the test program...)" - fi - ;; - *) - dflt="$randbits" - ;; - esac - rp="How many bits does your $randfunc() function produce?" - . ./myread - randbits="$ans" - $rm_try - drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))" - seedfunc="s$randfunc" - randseedtype=unsigned - ;; - *) - dflt="31" - rp="How many bits does your $randfunc() function produce?" - . ./myread - randbits="$ans" - seedfunc="s$randfunc" - drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))" - if set $seedfunc val -f; eval $csym; $val; then - echo "(Using $seedfunc() to seed random generator)" - else - echo "(Warning: no $seedfunc() to seed random generator)" - seedfunc=rand - fi - randseedtype=unsigned - ;; - esac - ;; - esac -done +randfunc=Perl_drand48 +drand01="Perl_drand48()" +seedfunc="Perl_drand48_init" +randbits=48 +randseedtype=U32 : Check how to flush echo " " diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index fea06f138d..07fc8d211e 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -556,7 +556,7 @@ direntrytype='struct dirent' dlext='so' dlsrc='dl_dlopen.xs' doublesize='8' -drand01='drand48()' +drand01='Perl_drand48()' drand48_r_proto='0' dtrace='' dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap attributes re threads threads/shared' @@ -882,9 +882,9 @@ ptrsize='4' quadkind='3' quadtype='long long' randbits='48' -randfunc='drand48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='long' +randseedtype='U32' ranlib=':' rd_nodata='-1' readdir64_r_proto='0' @@ -915,7 +915,7 @@ sched_yield='sched_yield()' scriptdir='/usr/bin' scriptdirexp='/usr/bin' sed='sed' -seedfunc='srand48' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='fd_set *' sendmail='' diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770 index c3b8dafea5..e3ebe6afa8 100644 --- a/Cross/config.sh-arm-linux-n770 +++ b/Cross/config.sh-arm-linux-n770 @@ -529,7 +529,7 @@ direntrytype='struct dirent' dlext='so' dlsrc='dl_dlopen.xs' doublesize='8' -drand01='drand48()' +drand01='Perl_drand48()' drand48_r_proto='0' dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap attributes re threads threads/shared' eagain='EAGAIN' @@ -852,9 +852,9 @@ ptrsize='4' quadkind='3' quadtype='long long' randbits='48' -randfunc='drand48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='long' +randseedtype='U32' ranlib=':' rd_nodata='-1' readdir64_r_proto='0' @@ -881,7 +881,7 @@ sched_yield='sched_yield()' scriptdir='/usr/bin' scriptdirexp='/usr/bin' sed='sed' -seedfunc='srand48' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='fd_set *' sendmail='' diff --git a/NetWare/config.wc b/NetWare/config.wc index 1182d47d11..016748dd8d 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -547,7 +547,7 @@ direntrytype='DIR' dlext='nlm' dlsrc='dl_netware.xs' doublesize='8' -drand01='(rand()/(double)((unsigned)1<<RANDBITS))' +drand01='Perl_drand48()' drand48_r_proto='0' dtrace='' dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes' @@ -854,10 +854,10 @@ prototype='define' ptrsize='4' quadkind='5' quadtype='__int64' -randbits='15' -randfunc='rand' +randbits='48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='unsigned' +randseedtype='U32' ranlib='rem' rd_nodata='-1' readdir64_r_proto='0' @@ -887,7 +887,7 @@ sched_yield='' scriptdir='~INST_TOP~~INST_VER~\bin' scriptdirexp='~INST_TOP~~INST_VER~\bin' sed='sed' -seedfunc='srand' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='fd_set *' sendmail='blat' @@ -3112,10 +3112,10 @@ * function used to generate normalized random numbers. * Values include 15, 16, 31, and 48. */ -#define Drand01() Perl_drand48() /**/ -#define Rand_seed_t U32 /**/ -#define seedDrand01(x) Perl_drand48_init((Rand_seed_t)x) /**/ -#define RANDBITS 48 /**/ +#define Drand01() Perl_drand48() /**/ +#define Rand_seed_t U32 /**/ +#define seedDrand01(x) Perl_drand48_init((Rand_seed_t)x) /**/ +#define RANDBITS 48 /**/ /* Select_fd_set_t: * This symbol holds the type used for the 2nd, 3rd, and 4th @@ -4753,6 +4753,6 @@ #endif /* Generated from: - * eea5809659d1cac397ca3a1a48f51bcb5bfc60eb2dca2ef00b9b2015ee87729a config_h.SH - * 3dc6c26adfbf4f2e111d90b34d50e317e18555a76a270fbac2899d08a42f2fd1 uconfig.sh + * fd2554fe3bee85bee863afd558a83caa6c1a317e9a044639199eda0827db903e config_h.SH + * 2a46be0c2dea164ef0186898854f667c064d678c6927d13e926c1bb37d9d4d0e uconfig.sh * ex: set ro: */ diff --git a/uconfig.sh b/uconfig.sh index 374e65d302..00f06d6c77 100644 --- a/uconfig.sh +++ b/uconfig.sh @@ -491,7 +491,7 @@ db_version_patch='0' defvoidused=1 direntrytype='struct dirent' doublesize='8' -drand01="((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))" +drand01="Perl_drand48()" drand48_r_proto='0' dtrace='' eagain='EAGAIN' @@ -691,9 +691,9 @@ ptrsize='4' quadkind='4' quadtype='int64_t' randbits='48' -randfunc='drand48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='int' +randseedtype='U32' rd_nodata='-1' readdir64_r_proto='0' readdir_r_proto='0' @@ -717,7 +717,7 @@ sSCNfldbl='"llf"' sched_yield='sched_yield()' scriptdir='/usr/local/bin' scriptdirexp='/usr/local/bin' -seedfunc='srand' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype=int setgrent_r_proto='0' diff --git a/win32/config.ce b/win32/config.ce index c3e36789ae..46c067328f 100644 --- a/win32/config.ce +++ b/win32/config.ce @@ -543,7 +543,7 @@ direntrytype='struct direct' dlext='dll' dlsrc='dl_win32.xs' doublesize='8' -drand01='(rand()/(double)((unsigned)1<<RANDBITS))' +drand01='Perl_drand48()' drand48_r_proto='0' dtrace='' dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes' @@ -844,10 +844,10 @@ prototype='define' ptrsize='4' quadkind='5' quadtype='__int64' -randbits='15' -randfunc='rand' +randbits='48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='unsigned' +randseedtype='U32' ranlib='rem' rd_nodata='-1' readdir64_r_proto='0' @@ -877,7 +877,7 @@ sched_yield='' scriptdir='~INST_TOP~~INST_VER~\bin' scriptdirexp='~INST_TOP~~INST_VER~\bin' sed='sed' -seedfunc='srand' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='Perl_fd_set *' sendmail='blat' diff --git a/win32/config.gc b/win32/config.gc index ca098f33c0..d8167951b9 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -545,7 +545,7 @@ dlext='dll' dlltool='~ARCHPREFIX~dlltool' dlsrc='dl_win32.xs' doublesize='8' -drand01='(rand()/(double)((unsigned)1<<RANDBITS))' +drand01='Perl_drand48()' drand48_r_proto='0' dtrace='' dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes' @@ -877,10 +877,10 @@ prototype='define' ptrsize='4' quadkind='3' quadtype='long long' -randbits='15' -randfunc='rand' +randbits='48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='unsigned' +randseedtype='U32' ranlib='rem' rd_nodata='-1' readdir64_r_proto='0' @@ -912,7 +912,7 @@ sched_yield='' scriptdir='~INST_TOP~~INST_VER~\bin' scriptdirexp='~INST_TOP~~INST_VER~\bin' sed='sed' -seedfunc='srand' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='Perl_fd_set *' sendmail='blat' diff --git a/win32/config.vc b/win32/config.vc index 829e0b4e32..fbfd7cec2b 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -544,7 +544,7 @@ direntrytype='struct direct' dlext='dll' dlsrc='dl_win32.xs' doublesize='8' -drand01='(rand()/(double)((unsigned)1<<RANDBITS))' +drand01='Perl_drand48()' drand48_r_proto='0' dtrace='' dynamic_ext='Socket IO Fcntl Opcode SDBM_File attributes' @@ -876,10 +876,10 @@ prototype='define' ptrsize='4' quadkind='5' quadtype='__int64' -randbits='15' -randfunc='rand' +randbits='48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='unsigned' +randseedtype='U32' ranlib='rem' rd_nodata='-1' readdir64_r_proto='0' @@ -911,7 +911,7 @@ sched_yield='' scriptdir='~INST_TOP~~INST_VER~\bin' scriptdirexp='~INST_TOP~~INST_VER~\bin' sed='sed' -seedfunc='srand' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='Perl_fd_set *' sendmail='blat' |