From: Jarkko Hietaniemi Date: Tue, 29 Sep 1998 00:56:33 +0000 (+0300) Subject: various Configure and hints updates (prefer drand48() or random() X-Git-Tag: perl-5.6.0~2014 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/85ab1d1d99f8dc082af2267b48b9a2c5983f3161 various Configure and hints updates (prefer drand48() or random() over rand(); add -Dusemultiplicity; enhanced 64-bitness); patch applied modulo SCO hints superseded by later patch Message-Id: <199809282156.AAA18615@alpha.hut.fi> Subject: [PATCH] 5.005_52: Configure et al: p4raw-id: //depot/perl@1904 --- diff --git a/Configure b/Configure index c2ca701..4c6f44e 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Fri Sep 11 21:59:48 EET DST 1998 [metaconfig 3.0 PL70] +# Generated on Tue Sep 29 00:08:14 EET DST 1998 [metaconfig 3.0 PL70] # (with additional metaconfig patches by jhi@iki.fi) cat >/tmp/c1$$ <&4 - case "$ans" in - *-thread) echo "...and architecture name already ends in -thread." >&4 - archname="$ans" - ;; - *) archname="$ans-thread" - echo "...setting architecture name to $archname." >&4 - ;; - esac - ;; -*) archname="$ans" ;; +$define) + echo "Threads selected." >&4 + case "$archname" in + *-thread*) echo "...and architecture name already has -thread." >&4 + ;; + *) archname="$archname-thread" + echo "...setting architecture name to $archname." >&4 + ;; + esac + ;; esac -myarchname="$tarch" +case "$usemultiplicity" in +$define) + echo "Multiplicity selected." >&4 + case "$archname" in + *-multi*) echo "...and architecture name already has -multi." >&4 + ;; + *) archname="$archname-multi" + echo "...setting architecture name to $archname." >&4 + ;; + esac + ;; +esac +case "$use64bits" in +$define) + echo "Explicit 64-bitness selected." >&4 + case "$archname64" in + '') + ;; + *) + case "$archname" in + *-$archname64*) echo "...and architecture name already has $archname64." >&4 + ;; + *) archname="$archname-$archname64" + echo "...setting architecture name to $archname." >&4 + ;; + esac + ;; + esac +esac + : is AFS running? echo " " case "$afs" in @@ -3896,6 +3978,16 @@ none|recommended) dflt="$ccflags $dflt" ;; *) dflt="$ccflags";; esac +case "$usemultiplicity" in +$define) + case "$dflt" in + *-DMULTIPLICITY* ) ;; + *) dflt="$dflt -DMULTIPLICITY" + ;; + esac + ;; +esac + case "$dflt" in ''|' ') dflt=none;; esac @@ -6001,30 +6093,6 @@ fi cat <. Versions 5.003_02 and later of perl allow alternate IO mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still @@ -6876,17 +6944,14 @@ while $test $# -ge 2; do shift 2; done > try.c; echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c; -set try; -if eval $cc $optimize $ccflags -c try.c; then - echo "Your struct $struct has field $field."; >&4 +if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then val="$define"; else - echo "Your struct $struct does not have field $field."; >&4 val="$undef"; fi; set $varname; eval $setvar; -$rm -f try.c try' +$rm -f try.c try.o' if $test X"$use64bits" = X"$define"; then @@ -6983,15 +7048,34 @@ EOCP : check for struct flock64 echo " " + echo "Checking to see if your system supports struct flock64..." >&4 if $h_fcntl; then set d_flock64s flock64 l_len define fcntl.h eval $hasfield + else + val="$undef" + set d_flock64s + eval $setvar fi + case "$d_flock64s" in + "$define") echo "Yup, it does." >&4 + ;; + *) echo "Nope, it doesn't." >&4 + ;; + esac : check for struct dirent64 echo " " + echo "Checking to see if your system supports struct dirent64..." >&4 set d_dirent64s dirent64 d_off $i_dirent dirent.h eval $hasfield + case "$d_flock64s" in + "$define") echo "Yup, it does." >&4 + ;; + *) echo "Nope, it doesn't." >&4 + ;; + esac + else val="$undef" for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64t d_ino64t d_flock64s d_dirent64s @@ -7117,6 +7201,30 @@ $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.? set d_dlsymun eval $setvar +hasproto='varname=$1; func=$2; shift; shift; +while $test $# -ge 2; do + case "$1" in + $define) echo "#include <$2>";; + esac ; + shift 2; +done > try.c; +$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null; +if $contains "$func.*(" tryout.c >/dev/null 2>&1; then + echo "$func() prototype found."; + val="$define"; +else + echo "$func() prototype NOT found."; + val="$undef"; +fi; +set $varname; +eval $setvar; +$rm -f try.c tryout.c' + +: see if prototype for drand48 is available +echo " " +set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h +eval $hasproto + : see if dup2 exists set dup2 d_dup2 eval $inlibc @@ -7482,25 +7590,6 @@ eval $inlibc set gethostent d_gethent eval $inlibc -hasproto='varname=$1; func=$2; shift; shift; -while $test $# -ge 2; do - case "$1" in - $define) echo "#include <$2>";; - esac ; - shift 2; -done > try.c; -$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null; -if $contains "$func.*(" tryout.c >/dev/null 2>&1; then - echo "$func() prototype found."; - val="$define"; -else - echo "$func() prototype NOT found."; - val="$undef"; -fi; -set $varname; -eval $setvar; -$rm -f try.c tryout.c' - : see if this is a netdb.h system set netdb.h i_netdb eval $inhdr @@ -7740,9 +7829,11 @@ eval $inlibc set inttypes.h i_inttypes eval $inhdr : check for int64_t -echo " " -echo $n "Checking to see if your system supports int64_t...$c" >&4 -$cat >try.c <&4 + $cat >try.c < #$i_inttypes I_INTTYPES #ifdef I_INTTYPES @@ -7750,14 +7841,18 @@ $cat >try.c </dev/null 2>&1; then - val="$define" - echo " Yup, it does." >&4 -else - val="$undef" - echo " Nope, it doesn't." >&4 -fi -$rm -f try.* + if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then + val="$define" + echo " Yup, it does." >&4 + else + val="$undef" + echo " Nope, it doesn't." >&4 + fi + $rm -f try.* + ;; +*) val="$undef" + ;; +esac set d_int64t eval $setvar @@ -7835,6 +7930,33 @@ eval $inlibc set lockf d_lockf eval $inlibc +: check for length of double +echo " " +case "$doublesize" in +'') + $echo $n "Checking to see how big your double precision numbers are...$c" >&4 + $cat >try.c <<'EOCP' +#include +main() +{ + printf("%d\n", sizeof(double)); +} +EOCP + set try + if eval $compile_ok; then + doublesize=`./try` + $echo " $doublesize bytes." >&4 + else + dflt='8' + echo "(I can't seem to compile the test program. Guessing...)" + rp="What is the size of a double precision number (in bytes)?" + . ./myread + doublesize="$ans" + fi + ;; +esac +$rm -f try.c try + : check for long doubles echo " " echo $n "Checking to see if your system supports long doubles...$c" >&4 @@ -7874,6 +7996,9 @@ EOCP . ./myread longdblsize="$ans" fi + if $test "X$doublesize" = "X$longdblsize"; then + echo "(That isn't any different from an ordinary double.)" + fi ;; esac $rm -f try.c try @@ -7917,6 +8042,9 @@ EOCP . ./myread longlongsize="$ans" fi + if $test "X$longsize" = "X$longlongsize"; then + echo "(That isn't any different from an ordinary long.)" + fi ;; esac $rm -f try.c try @@ -8517,7 +8645,7 @@ else echo "You do not have union semun in ." >&4 val="$undef" fi -$rm -f try try.c +$rm -f try try.c try.h set d_union_semun eval $setvar @@ -8526,6 +8654,31 @@ case "$d_sem" in $define) : see whether semctl IPC_STAT can use union semun echo " " + $cat > try.h <>3) +# define S_IWGRP (S_IWUSR>>3) +# define S_IXGRP (S_IXUSR>>3) +# define S_IROTH (S_IRUSR>>6) +# define S_IWOTH (S_IWUSR>>6) +# define S_IXOTH (S_IXUSR>>6) +#endif +#ifndef S_IRWXU +# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR) +# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP) +# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH) +#endif +END + $cat > try.c < #include @@ -8533,6 +8686,7 @@ $define) #include #include #include +#include "try.h" #ifndef errno extern int errno; #endif @@ -8598,6 +8752,7 @@ END #include #include #include +#include "try.h" #include #include #ifndef errno @@ -8646,6 +8801,7 @@ END *) echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4 ;; esac + $rm -f try.h ;; *) val="$undef" @@ -9919,32 +10075,135 @@ EOM esac $rm -f try.* .out -: check for length of double + +: How can we generate normalized random numbers ? echo " " -case "$doublesize" in +case "$randfunc" in '') - $echo $n "Checking to see how big your double precision numbers are...$c" >&4 - $cat >try.c <<'EOCP' + 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 "Yick, looks like I have to use rand()." >&4 + fi + echo " " + ;; +*) + dflt="$randfunc" + ;; +esac +cont=true + +case "$ccflags" in +*-Dmy_rand=*|*-Dmy_srand=*) + echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4 + ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`" + ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`" + ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`" + ;; +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=n + rp="Function $ans does not exists. 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 < +#ifdef I_UNISTD +# include +#endif +#ifdef I_STDLIB +# include +#endif main() { - printf("%d\n", sizeof(double)); + register int i; + register unsigned long tmp; + register 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 - doublesize=`./try` - $echo " $doublesize bytes." >&4 - else - dflt='8' - echo "(I can't seem to compile the test program. Guessing...)" - rp="What is the size of a double precision number (in bytes)?" - . ./myread - doublesize="$ans" - fi - ;; -esac -$rm -f try.c try + 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 -f try.c 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 echo " " echo "Determining whether or not we are on an EBCDIC system..." >&4 @@ -10336,55 +10595,6 @@ EOCP esac $rm -f try.c try -: check for size of random number generator -echo " " -case "$randbits" in -'') - echo "Checking to see how many bits your rand function produces..." >&4 - $cat >try.c < -#ifdef I_UNISTD -# include -#endif -#ifdef I_STDLIB -# include -#endif -EOCP - $cat >>try.c <<'EOCP' -main() -{ - register int i; - register unsigned long tmp; - register unsigned long max = 0L; - - for (i = 1000; i; i--) { - tmp = (unsigned long)rand(); - 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$_exe` - else - dflt='?' - echo "(I can't seem to compile the test program...)" - fi - ;; -*) - dflt="$randbits" - ;; -esac -rp='How many bits does your rand() function produce?' -. ./myread -randbits="$ans" -$rm -f try.* try - : see if ar generates random libraries by itself echo " " echo "Checking how to generate random libraries on your machine..." >&4 @@ -10643,7 +10853,7 @@ case "$selectminbits" in $define) $cat <try.c < @@ -10700,7 +10910,11 @@ EOCP set try if eval $compile_ok; then selectminbits=`./try` - echo "Your select() operates on $selectminbits bits at a time." >&4 + case "$selectminbits" in + 1) bits="1 bit" ;; + *) bits="$selectminbits bits" ;; + esac + echo "Your select() operates on $bits at a time." >&4 else rp='What is the minimum number of bits your select() operates on?' case "$byteorder" in @@ -11463,7 +11677,7 @@ set stddef.h i_stddef eval $inhdr : see if sys/access.h is available -set sysaccess.h i_sysaccess +set sys/access.h i_sysaccess eval $inhdr : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl @@ -11496,7 +11710,7 @@ set sys/resource.h i_sysresrc eval $inhdr : see if sys/security.h is available -set syssecrt.h i_syssecrt +set sys/security.h i_syssecrt eval $inhdr : see if this is a sys/un.h system @@ -11865,6 +12079,7 @@ apiversion='$apiversion' ar='$ar' archlib='$archlib' archlibexp='$archlibexp' +archname64='$archname64' archname='$archname' archobjs='$archobjs' awk='$awk' @@ -11937,6 +12152,7 @@ d_dlerror='$d_dlerror' d_dlopen='$d_dlopen' d_dlsymun='$d_dlsymun' d_dosuid='$d_dosuid' +d_drand48proto='$d_drand48proto' d_dup2='$d_dup2' d_eaccess='$d_eaccess' d_endgrent='$d_endgrent' @@ -12169,6 +12385,7 @@ direntrytype='$direntrytype' dlext='$dlext' dlsrc='$dlsrc' doublesize='$doublesize' +drand01='$drand01' dynamic_ext='$dynamic_ext' eagain='$eagain' ebcdic='$ebcdic' @@ -12356,6 +12573,8 @@ privlibexp='$privlibexp' prototype='$prototype' ptrsize='$ptrsize' randbits='$randbits' +randfunc='$randfunc' +randseedtype='$randseedtype' ranlib='$ranlib' rd_nodata='$rd_nodata' rm='$rm' @@ -12364,6 +12583,7 @@ runnm='$runnm' scriptdir='$scriptdir' scriptdirexp='$scriptdirexp' sed='$sed' +seedfunc='$seedfunc' selectminbits='$selectminbits' selecttype='$selecttype' sendmail='$sendmail' @@ -12424,6 +12644,7 @@ uname='$uname' uniq='$uniq' use64bits='$use64bits' usedl='$usedl' +usemultiplicity='$usemultiplicity' usemymalloc='$usemymalloc' usenm='$usenm' useopcode='$useopcode' @@ -12518,26 +12739,26 @@ if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then *) $cat < makedepend.out &" +Now you need to generate make dependencies by running "$make depend". +You might prefer to run it in background: "$make depend > makedepend.out &" It can take a while, so you might not want to run it right now. EOM ;; esac - rp="Run make depend now?" + rp="Run $make depend now?" . UU/myread case "$ans" in y*) - make depend && echo "Now you must run a make." + $make depend && echo "Now you must run a $make." ;; *) - echo "You must run 'make depend' then 'make'." + echo "You must run '$make depend' then '$make'." ;; esac elif test -f [Mm]akefile; then echo " " - echo "Now you must run a make." + echo "Now you must run a $make." else echo "Done." fi diff --git a/INSTALL b/INSTALL index a892e7d..9c0e96e 100644 --- a/INSTALL +++ b/INSTALL @@ -771,20 +771,10 @@ you can change a number of factors in the way perl is built by adding appropriate -D directives to your ccflags variable in config.sh. -For example, you can replace the rand() and srand() functions in the -perl source by any other random number generator by a trick such as the -following (this should all be on one line): - - sh Configure -Dccflags='-Dmy_rand=random -Dmy_srand=srandom' \ - -Drandbits=31 - -or you can use the drand48 family of functions with - - sh Configure -Dccflags='-Dmy_rand=lrand48 -Dmy_srand=srand48' \ - -Drandbits=31 - -or by adding the -D flags to your ccflags at the appropriate Configure -prompt. (Read pp.c to see how this works.) +Starting from Perl 5.005_53 you no more need to replace the rand() and +srand() functions in the perl source by any other random number +generator because Configure chooses the widest one available +(drand48(), srandom(), or rand()). You should also run Configure interactively to verify that a hint file doesn't inadvertently override your ccflags setting. (Hints files diff --git a/MANIFEST b/MANIFEST index 62aa460..a2d35e9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -228,6 +228,7 @@ ext/IO/lib/IO/Seekable.pm IO::Seekable extension Perl module ext/IO/lib/IO/Select.pm IO::Select extension Perl module ext/IO/lib/IO/Socket.pm IO::Socket extension Perl module ext/IPC/SysV/ChangeLog IPC::SysV extension Perl module +ext/IPC/SysV/hints/next_3.pl Hint for IPC::SysV for named architecture ext/IPC/SysV/MANIFEST IPC::SysV extension Perl module ext/IPC/SysV/Makefile.PL IPC::SysV extension Perl module ext/IPC/SysV/Msg.pm IPC::SysV extension Perl module diff --git a/config_h.SH b/config_h.SH index 4a6d8f6..37b3ebf 100644 --- a/config_h.SH +++ b/config_h.SH @@ -1050,7 +1050,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- /* I_SYS_ACCESS: * This symbol, if defined, indicates to the C program that it should - * include . + * include . */ #$i_sysaccess I_SYS_ACCESS /**/ @@ -1361,11 +1361,30 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define PTRSIZE $ptrsize /**/ +/* Drand01: + * This macro is to be used to generate uniformly distributed + * random numbers over the range [0., 1.[. You may have to supply + * an 'extern double drand48();' in your program since SunOS 4.1.3 + * doesn't provide you with anything relevant in it's headers. + * See HAS_DRAND48_PROTO. + */ +/* Rand_seed_t: + * This symbol defines the type of the argument of the + * random seed function. + */ +/* seedDrand01: + * This symbol defines the macro to be used in seeding the + * random number generator (see Drand01). + */ /* RANDBITS: - * This symbol contains the number of bits of random number the rand() - * function produces. Usual values are 15, 16, and 31. + * This symbol indicates how many bits are produced by the + * function used to generate normalized random numbers. + * Values include 15, 16, 31, and 48. */ -#define RANDBITS $randbits /**/ +#define Drand01() $drand01 /**/ +#define Rand_seed_t $randseedtype /**/ +#define seedDrand01(x) $seedfunc((Rand_seed_t)x) /**/ +#define RANDBITS $randbits /**/ /* SSize_t: * This symbol holds the type used by functions that return @@ -1679,7 +1698,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- * This symbol is defined if this system has a stat structure declaring * st_blksize and st_blocks. */ -#$d_statblks USE_STAT_BLOCKS /* backward compatibility */ +#$d_statblks USE_STAT_BLOCKS /**/ /* HAS_STRERROR: * This symbol, if defined, indicates that the strerror routine is @@ -2019,7 +2038,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- * available to seekdir files larger than 2 gigabytes. */ /* HAS_STAT64: - * This symbol, if defined, indicates that the fstat64 routine is + * This symbol, if defined, indicates that the stat64 routine is * available to stat files larger than 2 gigabytes. */ /* HAS_TELLDIR64: @@ -2158,8 +2177,8 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #$d_tmpfile64 HAS_TMPFILE64 /**/ /* USE_64_BITS: - * This symbol, if defined, indicates that 64-bit APIs should - * be used when available. If not defined, the native default APIs + * This symbol, if defined, indicates that 64-bit interfaces should + * be used when available. If not defined, the native default interfaces * will be used (be they 32 or 64 bits). */ #$use64bits USE_64_BITS /**/ @@ -2171,6 +2190,14 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$useperlio USE_PERLIO /**/ +/* HAS_DRAND48_PROTO: + * This symbol, if defined, indicates that the system provides + * a prototype for the drand48() function. Otherwise, it is up + * to the program to supply one. A good guess is + * extern double drand48 _((void)); + */ +#$d_drand48proto HAS_DRAND48_PROTO /**/ + /* HAS_GETHOST_PROTOS: * This symbol, if defined, indicates that includes * prototypes for gethostent(), gethostbyname(), and diff --git a/ext/IPC/SysV/SysV.xs b/ext/IPC/SysV/SysV.xs index 0fbf783..cda7170 100644 --- a/ext/IPC/SysV/SysV.xs +++ b/ext/IPC/SysV/SysV.xs @@ -32,6 +32,18 @@ # include #endif +#ifndef S_IRWXU +# ifdef S_IRUSR +# define S_IRWXU (S_IRUSR|S_IWUSR|S_IWUSR) +# define S_IRWXG (S_IRGRP|S_IWGRP|S_IWGRP) +# define S_IRWXO (S_IROTH|S_IWOTH|S_IWOTH) +# else +# define S_IRWXU 0700 +# define S_IRWXG 0070 +# define S_IRWXO 0007 +# endif +#endif + MODULE=IPC::SysV PACKAGE=IPC::Msg::stat PROTOTYPES: ENABLE diff --git a/ext/IPC/SysV/hints/next_3.pl b/ext/IPC/SysV/hints/next_3.pl new file mode 100644 index 0000000..2290ac7 --- /dev/null +++ b/ext/IPC/SysV/hints/next_3.pl @@ -0,0 +1 @@ +$self->{CCFLAGS} = $Config{ccflags} . ' -D_POSIX_SOURCE' ; diff --git a/hints/dec_osf.sh b/hints/dec_osf.sh index 0c6056e..971dd89 100644 --- a/hints/dec_osf.sh +++ b/hints/dec_osf.sh @@ -202,9 +202,10 @@ fi # new.) useshrplib="$define" ;; #esac -# The EFF_ONLY_OK from is dysfunctional for [RWX]_OK -# as of Digital UNIX 4.0[A-D]?. If and when this gets fixed, adjust -# this appropriately. +# The EFF_ONLY_OK from is present but dysfunctional for +# [RWX]_OK as of Digital UNIX 4.0[A-D]?. If and when this gets fixed, +# please adjust this appropriately. See also pp_sys.c just before the +# emulate_eaccess(). pp_sys_cflags='ccflags="$ccflags -DNO_EFF_ONLY_OK"' @@ -218,11 +219,17 @@ unset _DEC_uname_r # # History: # +# perl5.005_51: +# +# September-1998 Jarkko Hietaniemi +# +# * Added the -DNO_EFF_ONLY_OK flag ('use filetest;' support). +# # perl5.004_57: # # 19-Dec-1997 Spider Boardman # -# * Newer Digial UNIX compilers enforce signaling for NaN without +# * Newer Digital UNIX compilers enforce signaling for NaN without # -ieee. Added -fprm d at the same time since it's friendlier for # embedding. # diff --git a/hints/irix_6.sh b/hints/irix_6.sh index c19dd05..0f6637b 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -227,7 +227,20 @@ if [ "X$use64bits" = "X$define" ]; then case "$ccflags" in *-n32*) ccflags="$ccflags -DUSE_LONG_LONG" + archname64="-n32" + d_open64="$undef" + # In -n32 mode (ILP32LL64) we use the standard open(). + # In -64 we will use the open64(). + cat << 'EOM' >&2 + +You will see a *** WHOA THERE!!! *** message from Configure for +d_open64. Keep the recommended value. See hints/irix6_2.sh +for more information. + +EOM ;; + *-64*) + ;; esac - ccflags="$ccflags -DUSE_64_BIT_FILES -DNO_OPEN64" + ccflags="$ccflags -DUSE_64_BIT_FILES" fi diff --git a/hints/next_3.sh b/hints/next_3.sh index 43340c0..99adf50 100644 --- a/hints/next_3.sh +++ b/hints/next_3.sh @@ -129,3 +129,13 @@ ranlib='sleep 5; /bin/ranlib' # This is true whether we're on an HPPA machine or cross-compiling # for one. pp_cflags='optimize=""' + +# The SysV IPC is optional (ftp://ftp.nluug.nl/pub/comp/next/SysVIPC/) +# Gerben_Wierda@RnA.nl +if [ -f /usr/local/lib/libIPC.a ]; then + libswanted="$libswanted IPC" + # As of Sep 1998 d_msg wasn't supported in that library, + # only d_sem and d_shm, but Configure should be able to + # figure that out. --jhi + # Note also the next3 ext/IPC/SysV hints file. +fi diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh index 856f801..7bee52a 100644 --- a/hints/solaris_2.sh +++ b/hints/solaris_2.sh @@ -306,6 +306,25 @@ EOM fi fi +# 64-bitness +# jhi@iki.fi, inspired by Alan Burlison. + +if [ "X$use64bits" = "X$define" ]; then + uname_r=`uname -r` + case "$uname_r" in + 1.*|2.[1-5]) + echo >&4 "Solaris $uname_r does not support 64-bit types." + echo >&4 "You should upgrade to at least Solaris 2.6." + exit 1 + ;; + esac + ccflags="$ccflags `getconf LFS_CFLAGS` -DUSE_LONG_LONG" + ldflags="$ldflags `getconf LFS_LDFLAGS`" + libswanted="$libswanted `getconf LFS_LIBS`" + # When a 64-bit cc becomes available $archname64 may need setting + # so that $archname gets it attached. +fi + # This is just a trick to include some useful notes. cat > /dev/null <<'End_of_Solaris_Notes' diff --git a/perl.h b/perl.h index c9ec37a..2871d80 100644 --- a/perl.h +++ b/perl.h @@ -836,9 +836,7 @@ Free_t Perl_free _((Malloc_t where)); because then IV/UV have been 32 bits, too. Which, in turn means that even if the system has quads (e.g. long long), IV cannot be a quad. Introducing a 64-bit IV (because of long long existing) - would introduce binary incompatibility. Therefore the - USE_LONG_LONG guard below when probing for quads and the check for - PTRSIZE further down when defining IV/UV. + will introduce binary incompatibility. Summary: a long long system needs to add -DUSE_LONG_LONG to $ccflags to get quads -- and if its pointers are still 32 bits, this will break @@ -889,7 +887,7 @@ Free_t Perl_free _((Malloc_t where)); #endif /* See above note on LP32 about the PTRSIZE test. --jhi */ -#if defined(HAS_QUAD) && PTRSIZE > 4 +#if defined(HAS_QUAD) && (PTRSIZE > 4 || defined(USE_LONG_LONG)) typedef Quad_t IV; typedef unsigned Quad_t UV; # if defined(PERL_QUAD_IS_INT64_T) && defined(INT64_MAX) @@ -1194,8 +1192,9 @@ typedef union any ANY; # endif /* Some systems have open64() in libc but use that only * for true LP64 mode, in mixed mode (ILP32LL64, for example) - * they use the vanilla open(). --jhi */ -# if defined(HAS_OPEN64) && !defined(NO_OPEN64) + * they use the vanilla open(). Such systems should undefine + * d_open64 in their hints files. --jhi */ +# if defined(HAS_OPEN64) # define open open64 # endif # ifdef HAS_OPENDIR64 diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 37bcf1a..73b48a9 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1096,14 +1096,9 @@ unlikely to be what you want. (F) An untrapped exception was raised while executing an END subroutine. The interpreter is immediately exited. -=item effective %s access is not implemented +=item entering effective %s failed -(F) We cannot switch the real and effective uids or gids. -The C pragma is unavailable in this system. - -=item entering effective %s access failed - -(F) While under the C pragma, switching the real and +(F) While under the C pragma, switching the real and effective uids or gids failed. =item Error converting file specification %s @@ -1486,9 +1481,9 @@ L. that name, not even if you count where you were called from. See L. -=item leaving effective %s access failed +=item leaving effective %s failed -(F) While under the C pragma, switching the real and +(F) While under the C pragma, switching the real and effective uids or gids failed. =item listen() on closed fd @@ -2474,6 +2469,11 @@ of an assignment or as a subroutine argument for example). (F) Your Perl was compiled with B<-D>SETUID_SCRIPTS_ARE_SECURE_NOW, but a version of the setuid emulator somehow got run anyway. +=item switching effective %s is not implemented + +(F) While under the C pragma, we cannot switch the +real and effective uids or gids. + =item syntax error (F) Probably means you had a syntax error. Common reasons include: diff --git a/pp.c b/pp.c index e1c9d66..998cf93 100644 --- a/pp.c +++ b/pp.c @@ -1560,11 +1560,13 @@ PP(pp_cos) compatibility by calling rand() but allow the user to override it. See INSTALL for details. --Andy Dougherty 15 July 1998 */ -#ifndef my_rand -# define my_rand rand -#endif -#ifndef my_srand -# define my_srand srand +/* Now it's after 5.005, and Configure supports drand48() and random(), + in addition to rand(). So the overrides should not be needed any more. + --Jarkko Hietaniemi 27 September 1998 + */ + +#ifndef HAS_DRAND48_PROTO +extern double drand48 _((void)); #endif PP(pp_rand) @@ -1578,22 +1580,10 @@ PP(pp_rand) if (value == 0.0) value = 1.0; if (!srand_called) { - (void)my_srand((unsigned)seed()); + (void)seedDrand01((Rand_seed_t)seed()); srand_called = TRUE; } -#if RANDBITS == 31 - value = my_rand() * value / 2147483648.0; -#else -#if RANDBITS == 16 - value = my_rand() * value / 65536.0; -#else -#if RANDBITS == 15 - value = my_rand() * value / 32768.0; -#else - value = my_rand() * value / (double)(((unsigned long)1) << RANDBITS); -#endif -#endif -#endif + value *= Drand01(); XPUSHn(value); RETURN; } @@ -1606,7 +1596,7 @@ PP(pp_srand) anum = seed(); else anum = POPu; - (void)my_srand((unsigned)anum); + (void)seedDrand01((Rand_seed_t)anum); srand_called = TRUE; EXTEND(SP, 1); RETPUSHYES; @@ -1619,9 +1609,9 @@ seed(void) * This is really just a quick hack which grabs various garbage * values. It really should be a real hash algorithm which * spreads the effect of every input bit onto every output bit, - * if someone who knows about such tings would bother to write it. + * if someone who knows about such things would bother to write it. * Might be a good idea to add that function to CORE as well. - * No numbers below come from careful analysis or anyting here, + * No numbers below come from careful analysis or anything here, * except they are primes and SEED_C1 > 1E6 to get a full-width * value from (tv_sec * SEED_C1 + tv_usec). The multipliers should * probably be bigger too. diff --git a/pp_sys.c b/pp_sys.c index d775619..2eb8a16 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -173,6 +173,17 @@ static int dooneliner _((char *cmd, char *filename)); #endif /* no flock() */ +#ifndef MAXPATHLEN +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN 1024 +# endif +#endif + +#define ZBTLEN 10 +static char zero_but_true[ZBTLEN + 1] = "0 but true"; + #if defined(I_SYS_ACCESS) && !defined(R_OK) # include #endif @@ -184,7 +195,7 @@ static int dooneliner _((char *cmd, char *filename)); /* F_OK unused: if stat() cannot find it... */ #if !defined(PERL_EFF_ACCESS_R_OK) && defined(HAS_ACCESS) && defined(EFF_ONLY_OK) && !defined(NO_EFF_ONLY_OK) -/* Digital UNIX, UnixWare */ +/* Digital UNIX (when the EFF_ONLY_OK gets fixed), UnixWare */ # define PERL_EFF_ACCESS_R_OK(p) (access((p), R_OK | EFF_ONLY_OK)) # define PERL_EFF_ACCESS_W_OK(p) (access((p), W_OK | EFF_ONLY_OK)) # define PERL_EFF_ACCESS_X_OK(p) (access((p), X_OK | EFF_ONLY_OK)) @@ -221,7 +232,7 @@ emulate_eaccess (const char* path, int mode) { MUTEX_LOCK(&PL_cred_mutex); #if !defined(HAS_SETREUID) && !defined(HAS_SETRESUID) - croak("effective uid access is not implemented"); + croak("switching effective uid is not implemented"); #else #ifdef HAS_SETREUID if (setreuid(euid, ruid)) @@ -230,11 +241,11 @@ emulate_eaccess (const char* path, int mode) { if (setresuid(euid, ruid, (Uid_t)-1)) #endif #endif - croak("entering effective uid access failed"); + croak("entering effective uid failed"); #endif #if !defined(HAS_SETREGID) && !defined(HAS_SETRESGID) - croak("effective gid access is not implemented"); + croak("switching effective gid is not implemented"); #else #ifdef HAS_SETREGID if (setregid(egid, rgid)) @@ -243,7 +254,7 @@ emulate_eaccess (const char* path, int mode) { if (setresgid(egid, rgid, (Gid_t)-1)) #endif #endif - croak("entering effective gid access failed"); + croak("entering effective gid failed"); #endif res = access(path, mode); @@ -255,7 +266,7 @@ emulate_eaccess (const char* path, int mode) { if (setresuid(ruid, euid, (Uid_t)-1)) #endif #endif - croak("leaving effective uid access failed"); + croak("leaving effective uid failed"); #ifdef HAS_SETREGID if (setregid(rgid, egid)) @@ -264,7 +275,7 @@ emulate_eaccess (const char* path, int mode) { if (setresgid(rgid, egid, (Gid_t)-1)) #endif #endif - croak("leaving effective gid access failed"); + croak("leaving effective gid failed"); MUTEX_UNLOCK(&PL_cred_mutex); return res; @@ -277,23 +288,12 @@ emulate_eaccess (const char* path, int mode) { #if !defined(PERL_EFF_ACCESS_R_OK) STATIC int emulate_eaccess (const char* path, int mode) { - croak("effective uid access is not implemented"); + croak("switching effective uid is not implemented"); /*NOTREACHED*/ return -1; } #endif -#ifndef MAXPATHLEN -# ifdef PATH_MAX -# define MAXPATHLEN PATH_MAX -# else -# define MAXPATHLEN 1024 -# endif -#endif - -#define ZBTLEN 10 -static char zero_but_true[ZBTLEN + 1] = "0 but true"; - PP(pp_backtick) { djSP; dTARGET;