From: Jarkko Hietaniemi Date: Fri, 29 Oct 1999 22:09:01 +0000 (+0000) Subject: Move the IV, UV, I8, U8, ..., and NV to metaconfig X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8175356b4402d90d1aa6427725992225d7ec9fd1;p=p5sagit%2Fp5-mst-13.2.git Move the IV, UV, I8, U8, ..., and NV to metaconfig from perl.h and handy.h. p4raw-id: //depot/cfgperl@4494 --- diff --git a/Configure b/Configure index c0e5e24..3bd3a06 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 Oct 29 17:37:33 EET DST 1999 [metaconfig 3.0 PL70] +# Generated on Sat Oct 30 01:07:44 EET DST 1999 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <&4 - $cat >intsize.c <<'EOCP' -#include -int main() -{ - printf("intsize=%d;\n", sizeof(int)); - printf("longsize=%d;\n", sizeof(long)); - printf("shortsize=%d;\n", sizeof(short)); - exit(0); -} -EOCP - set intsize - if eval $compile_ok && ./intsize > /dev/null; then - eval `./intsize` - echo "Your integers are $intsize bytes long." - echo "Your long integers are $longsize bytes long." - echo "Your short integers are $shortsize bytes long." - else - $cat >&4 <&4 -echo 'int main() { long long x = 7; }' > try.c -set try -if eval $compile; then - val="$define" - echo " Yes, it does." >&4 -else - val="$undef" - echo " No, it doesn't." >&4 -fi -$rm try.* -set d_longlong -eval $setvar - -: check for length of long long -case "${d_longlong}${longlongsize}" in -$define) - echo " " - $echo $n "Checking to see how big your long longs are..." $c >&4 - $cat >try.c <<'EOCP' -#include -int main() -{ - printf("%d\n", sizeof(long long)); -} -EOCP - set try - if eval $compile_ok; then - longlongsize=`./try$exe_ext` - $echo " $longlongsize bytes." >&4 - else - dflt='8' - echo " " - echo "(I can't seem to compile the test program. Guessing...)" - rp="What is the size of a long long (in bytes)?" - . ./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.* try - -: see if inttypes.h is available -: we want a real compile instead of Inhdr because some systems -: have an inttypes.h which includes non-existent headers -echo " " -$cat >try.c < -int main() { - static int32_t foo32 = 0x12345678; -} -EOCP -set try -if eval $compile; then - echo " found." >&4 - val="$define" -else - echo " NOT found." >&4 - val="$undef" -fi -$rm -f try.c try -set i_inttypes -eval $setvar - -: check for int64_t -case "$use64bits" in -"$define" ) - echo " " - $echo $n "Checking to see if your system supports int64_t...$c" >&4 - $cat >try.c < -#$i_inttypes I_INTTYPES -#ifdef I_INTTYPES -#include -#endif -int main() { int64_t x = 7; } -EOCP - set try - if eval $compile; then - val="$define" - echo " Yes, it does." >&4 - else - val="$undef" - echo " No, it doesn't." >&4 - fi - $rm -f try try.* - ;; -*) val="$undef" - ;; -esac -set d_int64t -eval $setvar - - - -echo " " -echo "Checking which 64-bit integer type to use..." >&4 - -case "$intsize" in -8) val=int - set quadtype - eval $setvar - val='"unsigned int"' - set uquadtype - eval $setvar - quadcase=1 - ;; -*) case "$longsize" in - 8) val=long - set quadtype - eval $setvar - val='"unsigned long"' - set uquadtype - eval $setvar - quadcase=2 - ;; - *) case "$uselonglong:$d_longlong:$longlongsize" in - define:define:8) - val='"long long"' - set quadtype - eval $setvar - val='"unsigned long long"' - set uquadtype - eval $setvar - quadcase=3 - ;; - *) case "$d_int64t" in - define) - val=int64_t - set quadtype - eval $setvar - val=uint64_t - set uquadtype - eval $setvar - quadcase=4 - ;; - esac - ;; - esac - ;; - esac - ;; -esac - -case "$quadtype" in -'') echo "Alas, no 64-bit integer types in sight." >&4 ;; -*) echo "Using '$quadtype' for 64-bit integers." >&4 ;; -esac - -echo " " - -if $test X"$quadtype" != X; then - -echo "Checking how to print 64-bit integers..." >&4 - -if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then - $cat >try.c <<'EOCP' -#include -#include -int main() { - int q = 12345678901; - printf("%ld\n", q); -} -EOCP - set try - if eval $compile; then - yyy=`./try$exe_ext` - case "$yyy" in - 12345678901) - sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"'; - sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"'; - echo "We will use %d." - ;; - esac - fi -fi - -if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then - $cat >try.c <<'EOCP' -#include -#include -int main() { - long q = 12345678901; - printf("%ld\n", q); -} -EOCP - set try - if eval $compile; then - yyy=`./try$exe_ext` - case "$yyy" in - 12345678901) - sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"'; - sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"'; - echo "We will use %ld." - ;; - esac - fi -fi - -if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then - $cat >try.c <<'EOCP' -#include -#include -#include -int main() { - int64_t q = 12345678901; - printf("%" PRId64 "\n", q); -} -EOCP - set try - if eval $compile; then - yyy=`./try$exe_ext` - case "$yyy" in - 12345678901) - sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64; - sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64; - echo "We will use the C9X style." - ;; - esac - fi -fi - -if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then - $cat >try.c <<'EOCP' -#include -#include -int main() { - long long q = 12345678901LL; /* AIX cc requires the LL prefix. */ - printf("%lld\n", q); -} -EOCP - set try - if eval $compile; then - yyy=`./try$exe_ext` - case "$yyy" in - 12345678901) - sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"'; - sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"'; - echo "We will use the %lld style." - ;; - esac - fi -fi - -if $test X"$sPRId64" = X -a X"$quadtype" != X; then - $cat >try.c < -#include -int main() { - $quadtype q = 12345678901; - printf("%Ld\n", q); -} -EOCP - set try - if eval $compile; then - yyy=`./try$exe_ext` - case "$yyy" in - 12345678901) - sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"'; - sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"'; - echo "We will use %Ld." - ;; - esac - fi -fi - -if $test X"$sPRId64" = X -a X"$quadtype" != X; then - $cat >try.c < -#include -int main() { - $quadtype q = 12345678901; - printf("%qd\n", q); -} -EOCP - set try - if eval $compile; then - yyy=`./try$exe_ext` - case "$yyy" in - 12345678901) - sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"'; - sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"'; - echo "We will use %qd." - ;; - esac - fi -fi - -if $test X"$sPRId64" = X; then - echo "Cannot figure out how to print 64-bit integers." >&4 -fi - -$rm -f try try.* - -fi - -case "$sPRId64" in -'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; - d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; - ;; -*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; - d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; - ;; -esac - : check for length of double echo " " case "$doublesize" in @@ -7563,6 +7233,52 @@ $rm -f set set.c set bzero d_bzero eval $inlibc +: check for lengths of integral types +echo " " +case "$intsize" in +'') + echo "Checking to see how big your integers are..." >&4 + $cat >intsize.c <<'EOCP' +#include +int main() +{ + printf("intsize=%d;\n", sizeof(int)); + printf("longsize=%d;\n", sizeof(long)); + printf("shortsize=%d;\n", sizeof(short)); + exit(0); +} +EOCP + set intsize + if eval $compile_ok && ./intsize > /dev/null; then + eval `./intsize` + echo "Your integers are $intsize bytes long." + echo "Your long integers are $longsize bytes long." + echo "Your short integers are $shortsize bytes long." + else + $cat >&4 <&4 +$cat >try.c < +#include +int main() +{ + printf("%d\n", sizeof($lseektype)); +} +EOCP +set try +if eval $compile_ok; then + lseeksize=`./try` + $echo " $lseeksize bytes." >&4 +else + dflt='4' + echo " " + echo "(I can't seem to compile the test program. Guessing...)" + rp="What is the size of your file offsets (in bytes)?" + . ./myread + lseeksize="$ans" +fi +$rm -f try.c try -: see if pathconf exists -set pathconf d_pathconf -eval $inlibc +: see what type file positions are declared as in the library +rp="What is the type for file position used by fsetpos()?" +set fpos_t fpostype long stdio.h sys/types.h +eval $typedef_ask -: see if fpathconf exists -set fpathconf d_fpathconf -eval $inlibc +echo " " +case "$fpostype" in +*_t) zzz="$fpostype" ;; +*) zzz="fpos_t" ;; +esac +echo "Checking the size of $zzz..." >&4 +cat > try.c < +#include +int main() { + printf("%d\n", sizeof($fpostype)); +} +EOCP +set try +if eval $compile_ok; then + yyy=`./try` + case "$yyy" in + '') fpossize=4 + echo "(I can't execute the test program--guessing $fpossize.)" >&4 + ;; + *) fpossize=$yyy + echo "Your $zzz size is $fpossize bytes." + ;; + esac +else + fpossize=4 + echo "(I can't compile the test program--guessing $fpossize.)" >&4 +fi -: see if llseek exists -set llseek d_llseek -eval $inlibc : check for off64_t echo " " -$echo $n "Checking to see if your system supports off64_t...$c" >&4 +echo "Checking to see if your system supports off64_t..." >&4 $cat >try.c < #include -off64_t foo() { off64_t x; x = 7; return x; }' +int main() { off64_t x = 7; }' EOCP -if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then +set try +if eval $compile; then val="$define" - echo " Yup, it does." >&4 + echo " Yup, it does." else val="$undef" - echo " Nope, it doesn't." >&4 + echo " Nope, it doesn't." + case "$lseeksize" in + 8) echo "(This is okay because your off_t is 64 bits wide.)" ;; + esac fi -$rm -f try.* +$rm -f try.* try set d_off64_t eval $setvar : check for fpos64_t echo " " -$echo $n "Checking to see if your system supports fpos64_t...$c" >&4 +echo "Checking to see if your system supports fpos64_t..." >&4 $cat >try.c < -fpos64_t foo() { fpos64_t x; x = 7; return x; }' +int main() { fpos64_t x x = 7; }' EOCP -if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then +set try +if eval $compile; then val="$define" - echo " Yup, it does." >&4 + echo " Yup, it does." else val="$undef" - echo " Nope, it doesn't." >&4 + echo " Nope, it doesn't." + case "$fpossize" in + 8) echo "(This is okay because your fpos_t is 64 bits wide.)" ;; + esac fi -$rm -f try.* +$rm -f try.* try set d_fpos64_t eval $setvar @@ -8763,12 +8603,12 @@ eval $inhdr echo " " -$echo $n "Checking to see if your system supports struct fs_data..." $c >&4 +echo "Checking to see if your system supports struct fs_data..." >&4 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h eval $hasstruct case "$d_fs_data_s" in -"$define") echo "Yup, it does." >&4 ;; -*) echo "Nope, it doesn't." >&4 ;; +"$define") echo "Yup, it does." ;; +*) echo "Nope, it doesn't." ;; esac : see if fseeko exists @@ -9154,6 +8994,58 @@ set d_index; eval $setvar set inet_aton d_inetaton eval $inlibc +: see if inttypes.h is available +: we want a real compile instead of Inhdr because some systems +: have an inttypes.h which includes non-existent headers +echo " " +$cat >try.c < +int main() { + static int32_t foo32 = 0x12345678; +} +EOCP +set try +if eval $compile; then + echo " found." >&4 + val="$define" +else + echo " NOT found." >&4 + val="$undef" +fi +$rm -f try.c try +set i_inttypes +eval $setvar + +: check for int64_t +case "$use64bits" in +"$define" ) + echo " " + $echo $n "Checking to see if your system supports int64_t...$c" >&4 + $cat >try.c < +#$i_inttypes I_INTTYPES +#ifdef I_INTTYPES +#include +#endif +int main() { int64_t x = 7; } +EOCP + set try + if eval $compile; then + val="$define" + echo " Yes, it does." >&4 + else + val="$undef" + echo " No, it doesn't." >&4 + fi + $rm -f try try.* + ;; +*) val="$undef" + ;; +esac +set d_int64t +eval $setvar + + : Look for isascii echo " " $cat >isascii.c <<'EOCP' @@ -9254,6 +9146,53 @@ eval $inlibc set lockf d_lockf eval $inlibc +: check for long long +echo " " +$echo $n "Checking to see if your system supports long long..." $c >&4 +echo 'int main() { long long x = 7; }' > try.c +set try +if eval $compile; then + val="$define" + echo " Yes, it does." >&4 +else + val="$undef" + echo " No, it doesn't." >&4 +fi +$rm try.* +set d_longlong +eval $setvar + +: check for length of long long +case "${d_longlong}${longlongsize}" in +$define) + echo " " + $echo $n "Checking to see how big your long longs are..." $c >&4 + $cat >try.c <<'EOCP' +#include +int main() +{ + printf("%d\n", sizeof(long long)); +} +EOCP + set try + if eval $compile_ok; then + longlongsize=`./try$exe_ext` + $echo " $longlongsize bytes." >&4 + else + dflt='8' + echo " " + echo "(I can't seem to compile the test program. Guessing...)" + rp="What is the size of a long long (in bytes)?" + . ./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.* try + : see if lstat exists set lstat d_lstat eval $inlibc @@ -10403,12 +10342,12 @@ eval $inhdr echo " " -$echo $n "Checking to see if your system supports struct statfs..." $c >&4 +echo "Checking to see if your system supports struct statfs..." >&4 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h eval $hasstruct case "$d_statfs_s" in -"$define") echo "Yup, it does." >&4 ;; -*) echo "Nope, it doesn't." >&4 ;; +"$define") echo "Yup, it does." ;; +*) echo "Nope, it doesn't." ;; esac @@ -10417,7 +10356,7 @@ esac case "$d_statfs_s" in define) echo " " - $echo $n "Checking to see if your struct statfs has f_flags field..." $c >&4 + echo "Checking to see if your struct statfs has f_flags field..." >&4 set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h eval $hasfield ;; @@ -10427,8 +10366,8 @@ define) ;; esac case "$d_statfs_f_flags" in -"$define") echo "Yup, it does." >&4 ;; -*) echo "Nope, it doesn't." >&4 ;; +"$define") echo "Yup, it does." ;; +*) echo "Nope, it doesn't." ;; esac : see if _ptr and _cnt from stdio act std @@ -10680,90 +10619,34 @@ eval $inlibc set strxfrm d_strxfrm eval $inlibc -: see if symlink exists -set symlink d_symlink -eval $inlibc - -: see if syscall exists -set syscall d_syscall -eval $inlibc - -: see if sysconf exists -set sysconf d_sysconf -eval $inlibc - -: see if system exists -set system d_system -eval $inlibc - -: see if tcgetpgrp exists -set tcgetpgrp d_tcgetpgrp -eval $inlibc - -: see if tcsetpgrp exists -set tcsetpgrp d_tcsetpgrp -eval $inlibc - -: see if prototype for telldir is available -echo " " -set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h -eval $hasproto - -: define an is-a-typedef? function -typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; -case "$inclist" in -"") inclist="sys/types.h";; -esac; -eval "varval=\$$var"; -case "$varval" in -"") - $rm -f temp.c; - for inc in $inclist; do - echo "#include <$inc>" >>temp.c; - done; - echo "#ifdef $type" >> temp.c; - echo "printf(\"We have $type\");" >> temp.c; - echo "#endif" >> temp.c; - $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; - if $contains $type temp.E >/dev/null 2>&1; then - eval "$var=\$type"; - else - eval "$var=\$def"; - fi; - $rm -f temp.?;; -*) eval "$var=\$varval";; -esac' - -: define an is-a-typedef? function that prompts if the type is not available. -typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; -case "$inclist" in -"") inclist="sys/types.h";; -esac; -eval "varval=\$$var"; -case "$varval" in -"") - $rm -f temp.c; - for inc in $inclist; do - echo "#include <$inc>" >>temp.c; - done; - echo "#ifdef $type" >> temp.c; - echo "printf(\"We have $type\");" >> temp.c; - echo "#endif" >> temp.c; - $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; - echo " " ; - echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./"; - if $contains $type temp.E >/dev/null 2>&1; then - echo "$type found." >&4; - eval "$var=\$type"; - else - echo "$type NOT found." >&4; - dflt="$def"; - . ./myread ; - eval "$var=\$ans"; - fi; - $rm -f temp.?;; -*) eval "$var=\$varval";; -esac' +: see if symlink exists +set symlink d_symlink +eval $inlibc + +: see if syscall exists +set syscall d_syscall +eval $inlibc + +: see if sysconf exists +set sysconf d_sysconf +eval $inlibc + +: see if system exists +set system d_system +eval $inlibc + +: see if tcgetpgrp exists +set tcgetpgrp d_tcgetpgrp +eval $inlibc + +: see if tcsetpgrp exists +set tcsetpgrp d_tcsetpgrp +eval $inlibc + +: see if prototype for telldir is available +echo " " +set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h +eval $hasproto : see if this is a sys/times.h system set sys/times.h i_systimes @@ -11754,11 +11637,6 @@ EOM esac $rm -f try.* try$exe_ext -: see what type file positions are declared as in the library -rp="What is the type for file position used by fsetpos()?" -set fpos_t fpostype long stdio.h sys/types.h -eval $typedef_ask - : Store the full pathname to the ar program for use in the C program : Respect a hint or command line value for full_ar. case "$full_ar" in @@ -11782,140 +11660,540 @@ xxx) *) dflt="$1" ;; esac ;; -*) dflt="$gidtype";; +*) dflt="$gidtype";; +esac +case "$gidtype" in +gid_t) echo "gid_t found." ;; +*) rp="What is the type for group ids returned by getgid()?" + . ./myread + gidtype="$ans" + ;; +esac + +echo " " +case "$gidtype" in +*_t) zzz="$gidtype" ;; +*) zzz="gid" ;; +esac +echo "Checking the sign of $zzz..." >&4 +cat > try.c < +#include +int main() { + $gidtype foo = -1; + if (foo < 0) + printf("-1\n"); + else + printf("1\n"); +} +EOCP +set try +if eval $compile; then + yyy=`./try` + case "$yyy" in + '') gidsign=1 + echo "(I can't execute the test program--guessing unsigned.)" >&4 + ;; + *) gidsign=$yyy + case "$gidsign" in + 1) echo "Your $zzz is unsigned." ;; + -1) echo "Your $zzz is signed." ;; + esac + ;; + esac +else + gidsign=1 + echo "(I can't compile the test program--guessing unsigned.)" >&4 +fi + + +echo " " +case "$gidtype" in +*_t) zzz="$gidtype" ;; +*) zzz="gid" ;; +esac +echo "Checking the size of $zzz..." >&4 +cat > try.c < +#include +int main() { + printf("%d\n", sizeof($gidtype)); +} +EOCP +set try +if eval $compile_ok; then + yyy=`./try` + case "$yyy" in + '') gidsize=4 + echo "(I can't execute the test program--guessing $gidsize.)" >&4 + ;; + *) gidsize=$yyy + echo "Your $zzz size is $gidsize bytes." + ;; + esac +else + gidsize=4 + echo "(I can't compile the test program--guessing $gidsize.)" >&4 +fi + + +: see if getgroups exists +set getgroups d_getgrps +eval $inlibc + +: see if setgroups exists +set setgroups d_setgrps +eval $inlibc + + +: Find type of 2nd arg to 'getgroups()' and 'setgroups()' +echo " " +case "$d_getgrps$d_setgrps" in +*define*) + case "$groupstype" in + '') dflt="$gidtype" ;; + *) dflt="$groupstype" ;; + esac + $cat <&4 + +case "$intsize" in +8) val=int + set quadtype + eval $setvar + val='"unsigned int"' + set uquadtype + eval $setvar + quadcase=1 + ;; +*) case "$longsize" in + 8) val=long + set quadtype + eval $setvar + val='"unsigned long"' + set uquadtype + eval $setvar + quadcase=2 + ;; + *) case "$uselonglong:$d_longlong:$longlongsize" in + define:define:8) + val='"long long"' + set quadtype + eval $setvar + val='"unsigned long long"' + set uquadtype + eval $setvar + quadcase=3 + ;; + *) case "$d_int64t" in + define) + val=int64_t + set quadtype + eval $setvar + val=uint64_t + set uquadtype + eval $setvar + quadcase=4 + ;; + esac + ;; + esac + ;; + esac + ;; +esac + +case "$quadtype" in +'') echo "Alas, no 64-bit integer types in sight." >&4 ;; +*) echo "Using '$quadtype' for 64-bit integers." >&4 ;; +esac + +: check for length of character +echo " " +case "$charsize" in +'') + echo "Checking to see how big your characters are..." >&4 + $cat >try.c <<'EOCP' +#include +int main() +{ + printf("%d\n", sizeof(char)); +} +EOCP + set try + if eval $compile_ok; then + dflt=`./try` + else + dflt='1' + echo "(I can't seem to compile the test program. Guessing...)" + fi + ;; +*) + dflt="$charsize" + ;; +esac +rp="What is the size of a character (in bytes)?" +. ./myread +charsize="$ans" +$rm -f try.c try + + +echo " " +$echo "Choosing the C types to be used for Perl's internal types..." >&4 + +case "$use64bits:$quadtype" in +define:?*) + ivtype="$quadtype" + uvtype="$uquadtype" + ivsize=8 + uvsize=8 + ;; +*) ivtype="long" + uvtype="unsigned long" + ivsize=$longsize + uvsize=$longsize + ;; +esac + +case "$uselongdouble:$d_longdbl" in +define:define) + nvtype="long double" + nvsize=$longdblsize + ;; +*) nvtype=double + nvsize=$doublesize + ;; +esac + +echo "(IV will be "$ivtype", $ivsize bytes)" +echo "(UV will be "$uvtype", $uvsize bytes)" +echo "(NV will be "$nvtype", $nvsize bytes)" + +$cat >try.c < +#endif +#include +int main() { +#ifdef INT8 + int8_t i = INT8_MAX; + uint8_t u = UINT8_MAX; + printf("int8_t\n"); +#endif +#ifdef INT16 + int16_t i = INT16_MAX; + uint16_t i = UINT16_MAX; + printf("int16_t\n"); +#endif +#ifdef INT32 + int32_t i = INT32_MAX; + uint32_t u = UINT32_MAX; + printf("int32_t\n"); +#endif +#ifdef INT64 + int64_t i = INT64_MAX; + uint64_t u = UINT64_MAX; + printf("int64_t\n"); +#endif +} +EOCP +set try -DINT8 +if eval $compile; then + case "`./try$exe_ext`" in + int8_t) i8type=int8_t + u8type=uint8_t + i8size=1 + u8size=1 + ;; + esac +fi +case "$i8type" in +'') i8type=char + u8type="unsigned char" + i8size=$charsize + u8size=$charsize + ;; +esac +set try -DINT16 +if eval $compile; then + case "`./try$exe_ext`" in + int16_t) + i16type=int16_t + u16type=uint16_t + i16size=2 + u16size=2 + ;; + esac +fi +case "$i16type" in +'') i16type=short + u16type="unsigned short" + i16size=$shortsize + u16size=$shortsize + ;; +esac +set try -DINT32 +if eval $compile; then + case "`./try$exe_ext`" in + int32_t) + i32type=int32_t + u32type=uint32_t + i32size=4 + u32size=4 + ;; + esac +fi +case "$i32type" in +'') case "$longsize" in + 4) i32type=long + u32type="unsigned long" + i32size=longsize + u32size=$longsize + ;; + *) case "$intsize" in + 4) i32type=int + u32type="unsigned int" + i32size=$intsize + u32size=$intsize + ;; + esac + ;; + esac + ;; esac -case "$gidtype" in -gid_t) echo "gid_t found." ;; -*) rp="What is the type for group ids returned by getgid()?" - . ./myread - gidtype="$ans" +set try -DINT64 +if eval $compile; then + case "`./try$exe_ext`" in + int64_t) + i64type=int64_t + u64type=uint64_t + i64size=8 + u64size=8 + ;; + esac +fi +case "$i64type" in +'') case "$quadtype" in + '') ;; + *) i64type="$quadtype" + u64type="$uquadtype" + i64size=8 + u64size=8 + ;; + esac ;; esac +$rm -f try.* try + echo " " -case "$gidtype" in -*_t) zzz="$gidtype" ;; -*) zzz="gid" ;; -esac -echo "Checking the sign of $zzz..." >&4 -cat > try.c <&4 + +if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then + $cat >try.c <<'EOCP' #include #include int main() { - $gidtype foo = -1; - if (foo < 0) - printf("-1\n"); - else - printf("1\n"); + int q = 12345678901; + printf("%ld\n", q); } EOCP -set try -if eval $compile; then - yyy=`./try` - case "$yyy" in - '') gidsign=1 - echo "(I can't execute the test program--guessing unsigned.)" >&4 - ;; - *) gidsign=$yyy - case "$gidsign" in - 1) echo "Your $zzz is unsigned." ;; - -1) echo "Your $zzz is signed." ;; + set try + if eval $compile; then + yyy=`./try$exe_ext` + case "$yyy" in + 12345678901) + sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"'; + sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"'; + echo "We will use %d." + ;; esac - ;; - esac -else - gidsign=1 - echo "(I can't compile the test program--guessing unsigned.)" >&4 + fi fi +if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then + $cat >try.c <<'EOCP' +#include +#include +int main() { + long q = 12345678901; + printf("%ld\n", q); +} +EOCP + set try + if eval $compile; then + yyy=`./try$exe_ext` + case "$yyy" in + 12345678901) + sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"'; + sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"'; + echo "We will use %ld." + ;; + esac + fi +fi -echo " " -case "$gidtype" in -*_t) zzz="$gidtype" ;; -*) zzz="gid" ;; -esac -echo "Checking the size of $zzz..." >&4 -cat > try.c <try.c <<'EOCP' #include +#include #include int main() { - printf("%d\n", sizeof($gidtype)); + int64_t q = 12345678901; + printf("%" PRId64 "\n", q); } EOCP -set try -if eval $compile_ok; then - yyy=`./try` - case "$yyy" in - '') gidsize=4 - echo "(I can't execute the test program--guessing $gidsize.)" >&4 - ;; - *) gidsize=$yyy - echo "Your $zzz size is $gidsize bytes." - ;; - esac -else - gidsize=4 - echo "(I can't compile the test program--guessing $gidsize.)" >&4 + set try + if eval $compile; then + yyy=`./try$exe_ext` + case "$yyy" in + 12345678901) + sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64; + sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64; + echo "We will use the C9X style." + ;; + esac + fi +fi + +if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then + $cat >try.c <<'EOCP' +#include +#include +int main() { + long long q = 12345678901LL; /* AIX cc requires the LL prefix. */ + printf("%lld\n", q); +} +EOCP + set try + if eval $compile; then + yyy=`./try$exe_ext` + case "$yyy" in + 12345678901) + sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"'; + sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"'; + echo "We will use the %lld style." + ;; + esac + fi fi +if $test X"$sPRId64" = X -a X"$quadtype" != X; then + $cat >try.c < +#include +int main() { + $quadtype q = 12345678901; + printf("%Ld\n", q); +} +EOCP + set try + if eval $compile; then + yyy=`./try$exe_ext` + case "$yyy" in + 12345678901) + sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"'; + sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"'; + echo "We will use %Ld." + ;; + esac + fi +fi -: see if getgroups exists -set getgroups d_getgrps -eval $inlibc +if $test X"$sPRId64" = X -a X"$quadtype" != X; then + $cat >try.c < +#include +int main() { + $quadtype q = 12345678901; + printf("%qd\n", q); +} +EOCP + set try + if eval $compile; then + yyy=`./try$exe_ext` + case "$yyy" in + 12345678901) + sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"'; + sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"'; + echo "We will use %qd." + ;; + esac + fi +fi -: see if setgroups exists -set setgroups d_setgrps -eval $inlibc +if $test X"$sPRId64" = X; then + echo "Cannot figure out how to print 64-bit integers." >&4 +fi +$rm -f try try.* -: Find type of 2nd arg to 'getgroups()' and 'setgroups()' -echo " " -case "$d_getgrps$d_setgrps" in -*define*) - case "$groupstype" in - '') dflt="$gidtype" ;; - *) dflt="$groupstype" ;; - esac - $cat <&4 -$cat >try.c < -#include -int main() -{ - printf("%d\n", sizeof($lseektype)); -} -EOCP -set try -if eval $compile_ok; then - lseeksize=`./try` - $echo " $lseeksize bytes." >&4 +$echo "Checking the format strings to be used for Perl's internal types..." >&4 + +if $test X"$ivsize" = X8; then + ivdformat="$sPRId64" + uvuformat="$sPRIu64" + uvoformat="$sPRIo64" + uvxformat="$sPRIx64" else - dflt='4' - echo " " - echo "(I can't seem to compile the test program. Guessing...)" - rp="What is the size of your file offsets (in bytes)?" - . ./myread - lseeksize="$ans" + if $test X"$ivsize" = X"$longsize"; then + ivdformat='"ld"' + uvuformat='"lu"' + uvoformat='"lo"' + uvxformat='"lx"' + else + if $test X"$ivsize" = X"$intsize"; then + ivdformat='"d"' + uvuformat='"u"' + uvoformat='"o"' + uvxformat='"x"' + else + : far out + if $test X"$ivsize" = X"$shortsize"; then + ivdformat='"hd"' + uvuformat='"hu"' + uvoformat='"ho"' + uvxformat='"hx"' + fi + fi + fi fi -$rm -f try.c try + +case "$ivdformat" in +'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4 + exit 1 + ;; +esac echo " " echo "Checking if your $make program sets \$(MAKE)..." >&4 @@ -13284,16 +13562,6 @@ eval $inhdr set sys/uio.h i_sysuio eval $inhdr -echo "Checking to see if your system supports struct iovec..." >&4 -set d_iovec_s iovec iov_base $i_sysuio sys/uio.h -eval $hasfield -case "$d_iovec_s" in -"$define") echo "Yup, it does." >&4 - ;; -*) echo "Nope, it doesn't." >&4 - ;; -esac - : see if this is a sys/un.h system set sys/un.h i_sysun eval $inhdr @@ -13689,6 +13957,7 @@ ccsymbols='$ccsymbols' cf_by='$cf_by' cf_email='$cf_email' cf_time='$cf_time' +charsize='$charsize' chgrp='$chgrp' chmod='$chmod' chown='$chown' @@ -13824,13 +14093,11 @@ d_htonl='$d_htonl' d_index='$d_index' d_inetaton='$d_inetaton' d_int64t='$d_int64t' -d_iovec_s='$d_iovec_s' d_isascii='$d_isascii' d_killpg='$d_killpg' d_lchown='$d_lchown' d_ldbl_dig='$d_ldbl_dig' d_link='$d_link' -d_llseek='$d_llseek' d_locconv='$d_locconv' d_lockf='$d_lockf' d_longdbl='$d_longdbl' @@ -14008,6 +14275,7 @@ fflushall='$fflushall' find='$find' firstmakefile='$firstmakefile' flex='$flex' +fpossize='$fpossize' fpostype='$fpostype' freetype='$freetype' full_ar='$full_ar' @@ -14027,6 +14295,14 @@ h_sysfile='$h_sysfile' hint='$hint' hostcat='$hostcat' huge='$huge' +i16size='$i16size' +i16type='$i16type' +i32size='$i32size' +i32type='$i32type' +i64size='$i64size' +i64type='$i64type' +i8size='$i8size' +i8type='$i8type' i_arpainet='$i_arpainet' i_bsdioctl='$i_bsdioctl' i_db='$i_db' @@ -14116,6 +14392,9 @@ installusrbinperl='$installusrbinperl' installvendorbin='$installvendorbin' installvendorlib='$installvendorlib' intsize='$intsize' +ivdformat='$ivdformat' +ivsize='$ivsize' +ivtype='$ivtype' known_extensions='$known_extensions' ksh='$ksh' large='$large' @@ -14180,6 +14459,8 @@ nm_opt='$nm_opt' nm_so_opt='$nm_so_opt' nonxs_ext='$nonxs_ext' nroff='$nroff' +nvsize='$nvsize' +nvtype='$nvtype' o_nonblock='$o_nonblock' obj_ext='$obj_ext' old_pthread_create_joinable='$old_pthread_create_joinable' @@ -14297,6 +14578,14 @@ touch='$touch' tr='$tr' trnl='$trnl' troff='$troff' +u16size='$u16size' +u16type='$u16type' +u32size='$u32size' +u32type='$u32type' +u64size='$u64size' +u64type='$u64type' +u8size='$u8size' +u8type='$u8type' uidsign='$uidsign' uidsize='$uidsize' uidtype='$uidtype' @@ -14323,6 +14612,11 @@ usevendorprefix='$usevendorprefix' usevfork='$usevfork' usrinc='$usrinc' uuname='$uuname' +uvoformat='$uvoformat' +uvsize='$uvsize' +uvtype='$uvtype' +uvuformat='$uvuformat' +uvxformat='$uvxformat' vendorbin='$vendorbin' vendorbinexp='$vendorbinexp' vendorlib='$vendorlib' diff --git a/config_h.SH b/config_h.SH index 5cadb29..65e6eb4 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2385,26 +2385,89 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #$d_PRIfldbl PERL_PRIfldbl $sPRIfldbl /**/ #$d_PRIgldbl PERL_PRIgldbl $sPRIgldbl /**/ -/* PERL_PRId64: - * This symbol, if defined, contains the string used by stdio to - * format 64-bit decimal numbers (format 'd') for output. +/* IVTYPE: + * This symbol defines the C type used for Perl's IV. */ -/* PERL_PRIu64: - * This symbol, if defined, contains the string used by stdio to - * format 64-bit unsigned decimal numbers (format 'u') for output. +/* UVTYPE: + * This symbol defines the C type used for Perl's UV. */ -/* PERL_PRIo64: - * This symbol, if defined, contains the string used by stdio to - * format 64-bit octal numbers (format 'o') for output. +/* I8TYPE: + * This symbol defines the C type used for Perl's I8. */ -/* PERL_PRIx64: - * This symbol, if defined, contains the string used by stdio to - * format 64-bit hexadecimal numbers (format 'x') for output. +/* U8TYPE: + * This symbol defines the C type used for Perl's U8. + */ +/* I16TYPE: + * This symbol defines the C type used for Perl's I16. + */ +/* U16TYPE: + * This symbol defines the C type used for Perl's U16. + */ +/* I32TYPE: + * This symbol defines the C type used for Perl's I32. + */ +/* U32TYPE: + * This symbol defines the C type used for Perl's U32. + */ +/* I64TYPE: + * This symbol defines the C type used for Perl's I64. + */ +/* U64TYPE: + * This symbol defines the C type used for Perl's U64. + */ +/* NVTYPE: + * This symbol defines the C type used for Perl's NV. + */ +/* IVSIZE: + * This symbol contains the sizeof(IV). + */ +/* UVSIZE: + * This symbol contains the sizeof(UV). + */ +/* NVSIZE: + * This symbol contains the sizeof(NV). + */ +#define IVTYPE $ivtype /**/ +#define UVTYPE $uvtype /**/ +#define I8TYPE $i8type /**/ +#define U8TYPE $u8type /**/ +#define I16TYPE $i16type /**/ +#define U16TYPE $u16type /**/ +#define I32TYPE $i32type /**/ +#define U32TYPE $u32type /**/ +#ifdef Quad_t +#define I64TYPE $i64type /**/ +#define U64TYPE $u64type /**/ +#endif +#define NVTYPE $nvtype /**/ +#define IVSIZE $ivsize /**/ +#define UVSIZE $uvsize /**/ +#ifdef Quad_t +#define I64SIZE $i64size /**/ +#define U64SIZE $u64size /**/ +#endif +#define NVSIZE $nvsize /**/ + +/* IVdf: + * This symbol defines the format string used for printing a Perl IV + * as a signed decimal integer. + */ +/* UVuf: + * This symbol defines the format string used for printing a Perl UV + * as an unsigned decimal integer. + */ +/* UVof: + * This symbol defines the format string used for printing a Perl UV + * as an unsigned octal integer. + */ +/* UVxf: + * This symbol defines the format string used for printing a Perl UV + * as an unsigned hexadecimal integer. */ -#$d_PRId64 PERL_PRId64 $sPRId64 /**/ -#$d_PRIu64 PERL_PRIu64 $sPRIu64 /**/ -#$d_PRIo64 PERL_PRIo64 $sPRIo64 /**/ -#$d_PRIx64 PERL_PRIx64 $sPRIx64 /**/ +#define IVdf $ivdformat /**/ +#define UVuf $uvuformat /**/ +#define UVof $uvoformat /**/ +#define UVxf $uvxformat /**/ /* SELECT_MIN_BITS: * This symbol holds the minimum number of bits operated by select. diff --git a/handy.h b/handy.h index 5ffd01d..cd94988 100644 --- a/handy.h +++ b/handy.h @@ -91,6 +91,7 @@ For dealing with issues that may arise from various 32/64-bit systems, we will ask Configure to check out + SHORTSIZE == sizeof(short) INTSIZE == sizeof(int) LONGSIZE == sizeof(long) @@ -98,31 +99,34 @@ PTRSIZE == sizeof(void *) DOUBLESIZE == sizeof(double) LONG_DOUBLESIZE == sizeof(long double) (if HAS_LONG_DOUBLE). - Most of these are currently unused, but they are mentioned here so - metaconfig will include the appropriate tests in Configure and - we can then start to consider how best to deal with long long - variables. - Andy Dougherty April 1998 + */ +typedef I8TYPE I8; +typedef U8TYPE U8; +typedef I16TYPE I16; +typedef U16TYPE U16; +typedef I32TYPE I32; +typedef U32TYPE U32; +typedef I32TYPE I32; +typedef U32TYPE U32; +#ifdef Quad_t +typedef I64TYPE I64; +typedef U64TYPE U64; +#endif + #if defined(UINT8_MAX) && defined(INT16_MAX) && defined(INT32_MAX) -typedef int8_t I8; -typedef uint8_t U8; /* I8_MAX and I8_MIN constants are not defined, as I8 is an ambiguous type. Please search CHAR_MAX in perl.h for further details. */ #define U8_MAX UINT8_MAX #define U8_MIN UINT8_MIN -typedef int16_t I16; -typedef uint16_t U16; #define I16_MAX INT16_MAX #define I16_MIN INT16_MIN #define U16_MAX UINT16_MAX #define U16_MIN UINT16_MIN -typedef int32_t I32; -typedef uint32_t U32; #define I32_MAX INT32_MAX #define I32_MIN INT32_MIN #define U32_MAX UINT32_MAX @@ -130,31 +134,22 @@ typedef uint32_t U32; #else -typedef char I8; -typedef unsigned char U8; /* I8_MAX and I8_MIN constants are not defined, as I8 is an ambiguous type. Please search CHAR_MAX in perl.h for further details. */ #define U8_MAX PERL_UCHAR_MAX #define U8_MIN PERL_UCHAR_MIN -/* Beware. SHORTSIZE > 2 in Cray C90ties. */ -typedef short I16; -typedef unsigned short U16; #define I16_MAX PERL_SHORT_MAX #define I16_MIN PERL_SHORT_MIN #define U16_MAX PERL_USHORT_MAX #define U16_MIN PERL_USHORT_MIN #if LONGSIZE > 4 - typedef int I32; - typedef unsigned int U32; # define I32_MAX PERL_INT_MAX # define I32_MIN PERL_INT_MIN # define U32_MAX PERL_UINT_MAX # define U32_MIN PERL_UINT_MIN #else - typedef long I32; - typedef unsigned long U32; # define I32_MAX PERL_LONG_MAX # define I32_MIN PERL_LONG_MIN # define U32_MAX PERL_ULONG_MAX diff --git a/perl.h b/perl.h index c6eb7c9..06db406 100644 --- a/perl.h +++ b/perl.h @@ -901,9 +901,10 @@ Free_t Perl_mfree (Malloc_t where); --Andy Dougherty August 1996 */ -#if defined(USE_64_BITS) && defined(Quad_t) - typedef Quad_t IV; - typedef Uquad_t UV; +typdef IVTYPE IV; +typdef UVTYPE UV; + +#ifdef USE_64_BITS # if QUADCASE == 4 && defined(INT64_MAX) /* quad is int64_t */ # define IV_MAX INT64_MAX # define IV_MIN INT64_MIN @@ -918,14 +919,10 @@ Free_t Perl_mfree (Malloc_t where); # define UV_MAX PERL_UQUAD_MAX # define UV_MIN PERL_UQUAD_MIN # endif -# define IVSIZE 8 -# define UVSIZE 8 # define IV_IS_QUAD # define UV_IS_QUAD #else - typedef long IV; - typedef unsigned long UV; -# if defined(INT32_MAX) && LONGSIZE == 4 +# if defined(INT32_MAX) && IVSIZE == 4 # define IV_MAX INT32_MAX # define IV_MIN INT32_MIN # ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */ @@ -943,15 +940,13 @@ Free_t Perl_mfree (Malloc_t where); # define UV_MAX PERL_ULONG_MAX # define UV_MIN PERL_ULONG_MIN # endif -# if LONGSIZE == 8 +# if IVSIZE == 8 # define IV_IS_QUAD # define UV_IS_QUAD # else # undef IV_IS_QUAD # undef UV_IS_QUAD # endif -# define UVSIZE LONGSIZE -# define IVSIZE LONGSIZE #endif #define IV_DIG (BIT_DIGITS(IVSIZE * 8)) @@ -1053,9 +1048,9 @@ Free_t Perl_mfree (Malloc_t where); # endif #endif +typdef NVTYPE NV; + #ifdef USE_LONG_DOUBLE - typedef long double NV; -# define NVSIZE LONG_DOUBLESIZE # define NV_DIG LDBL_DIG # ifdef HAS_SQRTL # define Perl_modf modfl @@ -1071,8 +1066,6 @@ Free_t Perl_mfree (Malloc_t where); # define Perl_fmod fmodl # endif #else - typedef double NV; -# define NVSIZE DOUBLESIZE # define NV_DIG DBL_DIG # define Perl_modf modf # define Perl_frexp frexp @@ -1831,6 +1824,7 @@ typedef I32 CHECKPOINT; #define NV_WITHIN_IV(nv) (I_V(nv) >= IV_MIN && I_V(nv) <= IV_MAX) #define NV_WITHIN_UV(nv) ((nv)>=0.0 && U_V(nv) >= UV_MIN && U_V(nv) <= UV_MAX) +/* The correct way: a Configure test where (UV)~0 is cast to NV and back. */ /* Believe. */ #define IV_FITS_IN_NV /* Doubt. */ @@ -1851,38 +1845,7 @@ typedef I32 CHECKPOINT; # endif #endif -#ifdef IV_IS_QUAD -# define UVuf PERL_PRIu64 -# define IVdf PERL_PRId64 -# define UVof PERL_PRIo64 -# define UVxf PERL_PRIx64 -#else -# if IVSIZE == LONGSIZE -# define UVuf "lu" -# define IVdf "ld" -# define UVof "lo" -# define UVxf "lx" -# else -# if IVSIZE == INTSIZE -# define UVuf "u" -# define IVdf "d" -# define UVof "o" -# define UVxf "x" -# else -# if IVSIZE == SHORTSIZE /* weird */ -# define UVuf "hu" -# define IVdf "hd" -# define UVof "ho" -# define UVxf "hx" -# else - /* well, any good ideas? */ -# endif -# endif -# endif -#endif - -/* The Uid_t_f and Gid_t_f definitely look like a job for metaconfig, - * as do the UVuf, IVdf, UVof, and UVxf above. */ +/* The Uid_t_f and Gid_t_f definitely look like a job for metaconfig. */ #if Uid_t_SIGN == -1 # if Uid_t_SIZE == IVSIZE