From: Jarkko Hietaniemi Date: Thu, 11 Nov 1999 23:17:43 +0000 (+0000) Subject: Turn on largefileness always if available and X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b8eaf932222db04db65aff99717b9c1dbd0a692;p=p5sagit%2Fp5-mst-13.2.git Turn on largefileness always if available and continue 64-bit fixes. p4raw-id: //depot/cfgperl@4552 --- diff --git a/Configure b/Configure index ce7b9b8..9cad345 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 Thu Nov 11 21:36:00 EET 1999 [metaconfig 3.0 PL70] +# Generated on Fri Nov 12 01:02:11 EET 1999 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <&4 ;; esac fi $rm -f try.* try @@ -9035,11 +9035,9 @@ 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 <&4 +$cat >try.c < #$i_inttypes I_INTTYPES #ifdef I_INTTYPES @@ -9047,23 +9045,18 @@ case "$use64bits" in #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 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.* set d_int64t eval $setvar - : Look for isascii echo " " $cat >isascii.c <<'EOCP' @@ -9553,7 +9546,7 @@ esac echo " " -echo "Checking which 64-bit integer type to use..." >&4 +echo "Checking which 64-bit integer type we could use..." >&4 case "$intsize" in 8) val=int @@ -9562,7 +9555,7 @@ case "$intsize" in val='"unsigned int"' set uquadtype eval $setvar - quadcase=1 + quadkind=1 ;; *) case "$longsize" in 8) val=long @@ -9571,7 +9564,7 @@ case "$intsize" in val='"unsigned long"' set uquadtype eval $setvar - quadcase=2 + quadkind=2 ;; *) case "$uselonglong:$d_longlong:$longlongsize" in define:define:8) @@ -9581,7 +9574,7 @@ case "$intsize" in val='"unsigned long long"' set uquadtype eval $setvar - quadcase=3 + quadkind=3 ;; *) case "$d_int64t" in define) @@ -9591,7 +9584,7 @@ case "$intsize" in val=uint64_t set uquadtype eval $setvar - quadcase=4 + quadkind=4 ;; esac ;; @@ -9602,10 +9595,14 @@ case "$intsize" in esac case "$quadtype" in -'') echo "Alas, no 64-bit integer types in sight." >&4 +'') case "$uselonglong:$d_longlong:$longlongsize" in + undef:define:8) + echo "(You would have 'long long', but you are not using it.)" >&4 ;; + *) echo "Alas, no 64-bit integer types in sight." >&4 ;; + esac d_quad="$undef" ;; -*) echo "Using '$quadtype' for 64-bit integers." >&4 +*) echo "We could use '$quadtype' for 64-bit integers." >&4 d_quad="$define" ;; esac @@ -14660,7 +14657,7 @@ privlib='$privlib' privlibexp='$privlibexp' prototype='$prototype' ptrsize='$ptrsize' -quadcase='$quadcase' +quadkind='$quadkind' quadtype='$quadtype' randbits='$randbits' randfunc='$randfunc' diff --git a/config_h.SH b/config_h.SH index 9d8deec..0d0d2cb 100644 --- a/config_h.SH +++ b/config_h.SH @@ -1006,10 +1006,6 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- * This symbol holds the type used for 64-bit integers. * It can be int, long, long long, int64_t etc... */ -/* QUADCASE: - * This symbol, if defined, encodes the type of a quad: - * 1 = int, 2 = long, 3 = long long, 4 = int64_t. - */ /* Uquad_t: * This symbol holds the type used for unsigned 64-bit integers. * It can be unsigned int, unsigned long, unsigned long long, @@ -1018,7 +1014,13 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #$d_quad HAS_QUAD /**/ #$d_quad Quad_t $quadtype /**/ #$d_quad Uquad_t $uquadtype /**/ -#$d_quad QUADCASE $quadcase /**/ +#ifdef HAS_QUAD +# define QUADKIND $quadkind /**/ +# define QUAD_IS_INT 1 +# define QUAD_IS_LONG 2 +# define QUAD_IS_LONG_LONG 3 +# define QUAD_IS_INT64_T 4 +#endif /* HAS_ACCESSX: * This symbol, if defined, indicates that the accessx routine is @@ -2220,6 +2222,13 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$d_hasmntopt HAS_HASMNTOPT /**/ +/* HAS_INT64_T: + * This symbol will defined if the C compiler supports int64_t. + * Usually the needs to be included, but sometimes + * is enough. + */ +#$d_int64t HAS_INT64_T /**/ + /* HAS_LDBL_DIG: * This symbol, if defined, indicates that this system's * or defines the symbol LDBL_DIG, which is the number @@ -2320,13 +2329,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- * This symbol, if defined, indicates to the C program that it should * include . */ -/* HAS_INT64_T: - * This symbol will defined if the C compiler supports int64_t. - * Usually the needs to be included, but sometimes - * is enough. - */ #$i_inttypes I_INTTYPES /**/ -#$d_int64t HAS_INT64_T /**/ /* I_MNTENT: * This symbol, if defined, indicates that exists and diff --git a/handy.h b/handy.h index 19f589f..92d163e 100644 --- a/handy.h +++ b/handy.h @@ -108,10 +108,18 @@ typedef I16TYPE I16; typedef U16TYPE U16; typedef I32TYPE I32; typedef U32TYPE U32; -#ifdef Quad_t +#ifdef PERL_CORE +# ifdef HAS_QUAD +# if QUADKIND == QUAD_IS_INT64_T +# include +# ifdef I_INTTYPES /* e.g. Linux has int64_t without */ +# include +# endif +# endif typedef I64TYPE I64; typedef U64TYPE U64; -#endif +# endif +#endif /* PERL_CORE */ /* Mention I8SIZE, U8SIZE, I16SIZE, U16SIZE, I32SIZE, U32SIZE, I64SIZE, and U64SIZE here so that metaconfig pulls them in. */ diff --git a/hints/aix.sh b/hints/aix.sh index 5fd7547..d905be1 100644 --- a/hints/aix.sh +++ b/hints/aix.sh @@ -180,6 +180,32 @@ EOM esac EOCBU +# Turn on largefileness, if available. + lfcflags="`getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" + lfldflags="`getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" + # _Somehow_ in AIX 4.3.1.0 the above getconf call manages to + # insert(?) *something* to $ldflags so that later (in Configure) evaluating + # $ldflags causes a newline after the '-b64' (the result of the getconf). + # (nothing strange shows up in $ldflags even in hexdump; + # so it may be something in the shell, instead?) + # Try it out: just uncomment the below line and rerun Configure: +# echo >&4 "AIX 4.3.1.0 $lfldflags mystery" ; exit 1 + # Just don't ask me how AIX does it, I spent hours wondering. + # Therefore the line re-evaluating lfldflags: it seems to fix + # the whatever it was that AIX managed to break. --jhi + lfldflags="`echo $lfldflags`" + lflibs="`getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`" +case "$lfcflags$lfldflags$lflibs" in +'');; +*) ccflags="$ccflags $lfcflags" + ldflags="$ldflags $ldldflags" + libswanted="$libswanted $lflibs" + ;; +esac + lfcflags='' + lfldflags='' + lflibs='' + # This script UU/use64bits.cbu will get 'called-back' by Configure # after it has prompted the user for whether to use 64 bits. cat > UU/use64bits.cbu <<'EOCBU' @@ -198,22 +224,6 @@ EOM *-DUSE_LONG_LONG*) ;; *) ccflags="$ccflags -DUSE_LONG_LONG" ;; esac - ccflags="$ccflags `getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" - - ldflags="$ldflags `getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" - # _Somehow_ in AIX 4.3.1.0 the above getconf call manages to - # insert(?) *something* to $ldflags so that later (in Configure) evaluating - # $ldflags causes a newline after the '-b64' (the result of the getconf). - # (nothing strange shows up in $ldflags even in hexdump; - # so it may be something in the shell, instead?) - # Try it out: just uncomment the below line and rerun Configure: -# echo >&4 "AIX 4.3.1.0 $ldflags mystery" ; exit 1 - # Just don't ask me how AIX does it. - # Therefore the line re-evaluating ldflags: it seems to bypass - # the whatever it was that AIX managed to break. --jhi - ldflags="`echo $ldflags`" - - libswanted="$libswanted `getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" # When a 64-bit cc becomes available $archname64 # may need setting so that $archname gets it attached. ;; diff --git a/hints/dec_osf.sh b/hints/dec_osf.sh index 3c3b00c..5eb7e80 100644 --- a/hints/dec_osf.sh +++ b/hints/dec_osf.sh @@ -204,6 +204,8 @@ esac pp_sys_cflags='ccflags="$ccflags -DNO_EFF_ONLY_OK"' +# The off_t is already 8 bytes, so we do have largefileness. + # This script UU/usethreads.cbu will get 'called-back' by Configure # after it has prompted the user for whether to use threads. cat > UU/usethreads.cbu <<'EOCBU' diff --git a/hints/hpux.sh b/hints/hpux.sh index add4410..681a722 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -290,6 +290,21 @@ EOM esac EOCBU +# Turn on largefileness if available. + lfcflags="`getconf _CS_XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" + lfldflags="`getconf _CS_XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" + lflibs="`getconf _CS_XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`" +case "$lfcflags$lfldflags$lflibs" in +'');; +*) ccflags="$ccflags $lfcflags" + ldflags="$ldflags $ldldflags" + libswanted="$libswanted $lflibs" + ;; +esac + lfcflags='' + lfldflags='' + lflibs='' + # This script UU/use64bits.cbu will get 'called-back' by Configure # after it has prompted the user for whether to use 64 bits. cat > UU/use64bits.cbu <<'EOCBU' @@ -311,7 +326,7 @@ Cannot continue, aborting. EOM exit 1 fi - ccflags="$ccflags +DD64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + ccflags="$ccflags +DD64" ldflags="$ldflags +DD64" ld=/usr/bin/ld set `echo " $libswanted " | sed -e 's@ dl @ @'` @@ -319,3 +334,6 @@ EOM glibpth="/lib/pa20_64" esac EOCBU + + + diff --git a/hints/irix_6.sh b/hints/irix_6.sh index 488c6bb..f4bbf32 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -226,6 +226,8 @@ EOM esac EOCBU +# The -n32 makes off_t to be 8 bytes, so we should have largefileness. + # This script UU/use64bits.cbu will get 'called-back' by Configure # after it has prompted the user for whether to use 64 bits. cat > UU/use64bits.cbu <<'EOCBU' diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh index 050cacc..a5d033b 100644 --- a/hints/solaris_2.sh +++ b/hints/solaris_2.sh @@ -333,6 +333,21 @@ EOM esac EOCBU +# Turn on largefileness if available. + lfcflags="`getconf LFS_CFLAGS 2>/dev/null`" + lfldflags="`getconf LFS_LDFLAGS 2>/dev/null`" + lflibs="`getconf LFS_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`" +case "$lfcflags$lfldflags$lflibs" in +'');; +*) ccflags="$ccflags $lfcflags" + ldflags="$ldflags $ldldflags" + libswanted="$libswanted $lflibs" + ;; +esac + lfcflags='' + lfldflags='' + lflibs='' + # This script UU/use64bits.cbu will get 'called-back' by Configure # after it has prompted the user for whether to use 64 bits. cat > UU/use64bits.cbu <<'EOCBU' @@ -347,9 +362,6 @@ EOM exit 1 ;; esac - ccflags="$ccflags `getconf LFS_CFLAGS`" - ldflags="$ldflags `getconf LFS_LDFLAGS`" - libswanted="$libswanted `getconf LFS_LIBS`" case "$ccflags" in *-DUSE_LONG_LONG*) ;; *) ccflags="$ccflags -DUSE_LONG_LONG" ;; diff --git a/perl.h b/perl.h index 5252211..f00566f 100644 --- a/perl.h +++ b/perl.h @@ -891,10 +891,6 @@ Free_t Perl_mfree (Malloc_t where); #undef UV #endif -#ifdef I_INTTYPES -#include -#endif - /* The IV type is supposed to be long enough to hold any integral value or a pointer. @@ -905,7 +901,7 @@ typedef IVTYPE IV; typedef UVTYPE UV; #if defined(USE_64_BITS) && defined(HAS_QUAD) -# if QUADCASE == 4 && defined(INT64_MAX) /* quad is int64_t */ +# if QUADKIND == QUAD_IS_INT64_T && defined(INT64_MAX) # define IV_MAX INT64_MAX # define IV_MIN INT64_MIN # define UV_MAX UINT64_MAX @@ -1331,16 +1327,34 @@ typedef struct svtbl SVTBL; #include "handy.h" -#if defined(USE_LARGE_FILES) -# define USE_64_BIT_RAWIO /* Explicit */ -# define USE_64_BIT_STDIO +#ifndef NO_LARGE_FILES +# define USE_LARGE_FILES /* If available. */ #endif -#if LSEEKSIZE == 8 && !defined(USE_64_BIT_RAWIO) -# define USE_64_BIT_RAWIO /* Implicit */ +#if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_RAWIO) +# define USE_64_BIT_RAWIO /* explicit */ +# if LSEEKSIZE == 8 && !defined(USE_64_BIT_RAWIO) +# define USE_64_BIT_RAWIO /* implicit */ +# endif #endif -/* Do we need FSEEKSIZE? */ +/* Notice the use of HAS_FSEEKO: now we are obligated to always use + * fseeko/ftello if possible. Don't go #defining ftell to ftello yourself, + * however, because operating systems like to do that themself. */ +#ifndef FSEEKSIZE +# ifdef HAS_FSEEKO +# define FSEEKSIZE LSEEKSIZE +# else +# define FSEEKSIZE LONGSIZE +# endif +#endif + +#if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_STDIO) +# define USE_64_BIT_STDIO /* explicit */ +# if FSEEKSIZE == 8 && !defined(USE_64_BIT_STDIO) +# define USE_64_BIT_STDIO /* implicit */ +# endif +#endif /* I couldn't find any -Ddefine or -flags in IRIX 6.5 that would * have done the necessary symbol renaming using cpp. --jhi */ @@ -1369,9 +1383,10 @@ typedef struct svtbl SVTBL; # endif # if defined(USE_LSEEK64) # define lseek lseek64 -# endif -# if defined(USE_LLSEEK) -# define lseek llseek +# else +# if defined(USE_LLSEEK) +# define lseek llseek +# endif # endif # if defined(USE_STAT64) # define stat stat64 @@ -1411,10 +1426,10 @@ typedef struct svtbl SVTBL; # define fopen fopen64 # endif # if defined(USE_FSEEK64) -# define fseek fseek64 +# define fseek fseek64 /* don't do fseeko here, see perlio.c */ # endif # if defined(USE_FTELL64) -# define ftell ftell64 +# define ftell ftell64 /* don't do ftello here, see perlio.c */ # endif # if defined(USE_FSETPOS64) # define fsetpos fsetpos64 diff --git a/pp.c b/pp.c index 1fb26c3..745d3f1 100644 --- a/pp.c +++ b/pp.c @@ -3254,13 +3254,13 @@ PP(pp_unpack) I16 ashort; int aint; I32 along; -#ifdef Quad_t +#ifdef HAS_QUAD Quad_t aquad; #endif U16 aushort; unsigned int auint; U32 aulong; -#ifdef Quad_t +#ifdef HAS_QUAD Uquad_t auquad; #endif char *aptr; @@ -4018,7 +4018,7 @@ PP(pp_unpack) sv_setpvn(sv, aptr, len); PUSHs(sv_2mortal(sv)); break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'q': along = (strend - s) / sizeof(Quad_t); if (len > along) @@ -4336,7 +4336,7 @@ PP(pp_pack) unsigned int auint; I32 along; U32 aulong; -#ifdef Quad_t +#ifdef HAS_QUAD Quad_t aquad; Uquad_t auquad; #endif @@ -4828,7 +4828,7 @@ PP(pp_pack) } } break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'Q': while (len-- > 0) { fromstr = NEXTFROM; diff --git a/sv.c b/sv.c index 9a4fb96..d472846 100644 --- a/sv.c +++ b/sv.c @@ -5163,7 +5163,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV /* SIZE */ switch (*q) { -#ifdef Quad_t +#ifdef HAS_QUAD case 'L': /* Ld */ case 'q': /* qd */ intsize = 'q'; @@ -5171,7 +5171,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV break; #endif case 'l': -#ifdef Quad_t +#ifdef HAS_QUAD if (*(q + 1) == 'l') { /* lld */ intsize = 'q'; q += 2; @@ -5287,7 +5287,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV default: iv = va_arg(*args, int); break; case 'l': iv = va_arg(*args, long); break; case 'V': iv = va_arg(*args, IV); break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'q': iv = va_arg(*args, Quad_t); break; #endif } @@ -5299,7 +5299,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV default: iv = (int)iv; break; case 'l': iv = (long)iv; break; case 'V': break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'q': iv = (Quad_t)iv; break; #endif } @@ -5353,7 +5353,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV default: uv = va_arg(*args, unsigned); break; case 'l': uv = va_arg(*args, unsigned long); break; case 'V': uv = va_arg(*args, UV); break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'q': uv = va_arg(*args, Quad_t); break; #endif } @@ -5365,7 +5365,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV default: uv = (unsigned)uv; break; case 'l': uv = (unsigned long)uv; break; case 'V': break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'q': uv = (Quad_t)uv; break; #endif } @@ -5521,7 +5521,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV default: *(va_arg(*args, int*)) = i; break; case 'l': *(va_arg(*args, long*)) = i; break; case 'V': *(va_arg(*args, IV*)) = i; break; -#ifdef Quad_t +#ifdef HAS_QUAD case 'q': *(va_arg(*args, Quad_t*)) = i; break; #endif } diff --git a/t/lib/syslfs.t b/t/lib/syslfs.t index 43e66fe..ce91db6 100644 --- a/t/lib/syslfs.t +++ b/t/lib/syslfs.t @@ -3,12 +3,6 @@ # If you modify/add tests here, remember to update also t/op/lfs.t. BEGIN { - # Don't bother if there are no quads. - eval { my $q = pack "q", 0 }; - if ($@) { - print "1..0\n# no 64-bit types\n"; - exit(0); - } chdir 't' if -d 't'; unshift @INC, '../lib'; require Config; import Config; diff --git a/t/op/lfs.t b/t/op/lfs.t index 87060e7..140846f 100644 --- a/t/op/lfs.t +++ b/t/op/lfs.t @@ -3,12 +3,6 @@ # If you modify/add tests here, remember to update also t/lib/syslfs.t. BEGIN { - # Don't bother if there are no quads. - eval { my $q = pack "q", 0 }; - if ($@) { - print "1..0\n# no 64-bit types\n"; - exit(0); - } chdir 't' if -d 't'; unshift @INC, '../lib'; # Don't bother if there are no quad offsets. diff --git a/utf8.c b/utf8.c index a470376..b27774a 100644 --- a/utf8.c +++ b/utf8.c @@ -68,7 +68,7 @@ Perl_uv_to_utf8(pTHX_ U8 *d, UV uv) *d++ = (( uv & 0x3f) | 0x80); return d; } -#ifdef Quad_t +#ifdef HAS_QUAD if (uv < 0x2000000000) #endif { @@ -81,7 +81,7 @@ Perl_uv_to_utf8(pTHX_ U8 *d, UV uv) *d++ = (( uv & 0x3f) | 0x80); return d; } -#ifdef Quad_t +#ifdef HAS_QUAD { *d++ = 0xff; /* Can't match U+FFFE! */ *d++ = (((uv >> 36) & 0x3f) | 0x80);