continue 64-bit fixes.
p4raw-id: //depot/cfgperl@4552
# $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$$ <<EOF
d_hasmntopt=''
d_htonl=''
d_inetaton=''
+d_int64t=''
d_isascii=''
d_killpg=''
d_lchown=''
i_gdbm=''
d_grpasswd=''
i_grp=''
-d_int64t=''
i_inttypes=''
i_limits=''
i_locale=''
sPRIu64=''
sPRIx64=''
d_quad=''
-quadcase=''
+quadkind=''
quadtype=''
uquadtype=''
drand01=''
val="$undef"
echo "No, it doesn't."
case "$fpossize" in
- 8) echo "(This is okay because your fpos_t is 64 bits wide.)" ;;
+ 8) echo "(This is okay because your fpos_t is 64 bits wide.)" >&4 ;;
esac
fi
$rm -f try.* try
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 <<EOCP
+echo " "
+$echo $n "Checking to see if your system supports int64_t...$c" >&4
+$cat >try.c <<EOCP
#include <sys/types.h>
#$i_inttypes I_INTTYPES
#ifdef I_INTTYPES
#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'
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
val='"unsigned int"'
set uquadtype
eval $setvar
- quadcase=1
+ quadkind=1
;;
*) case "$longsize" in
8) val=long
val='"unsigned long"'
set uquadtype
eval $setvar
- quadcase=2
+ quadkind=2
;;
*) case "$uselonglong:$d_longlong:$longlongsize" in
define:define:8)
val='"unsigned long long"'
set uquadtype
eval $setvar
- quadcase=3
+ quadkind=3
;;
*) case "$d_int64t" in
define)
val=uint64_t
set uquadtype
eval $setvar
- quadcase=4
+ quadkind=4
;;
esac
;;
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
privlibexp='$privlibexp'
prototype='$prototype'
ptrsize='$ptrsize'
-quadcase='$quadcase'
+quadkind='$quadkind'
quadtype='$quadtype'
randbits='$randbits'
randfunc='$randfunc'
* 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,
#$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
*/
#$d_hasmntopt HAS_HASMNTOPT /**/
+/* HAS_INT64_T:
+ * This symbol will defined if the C compiler supports int64_t.
+ * Usually the <inttypes.h> needs to be included, but sometimes
+ * <sys/types.h> is enough.
+ */
+#$d_int64t HAS_INT64_T /**/
+
/* HAS_LDBL_DIG:
* This symbol, if defined, indicates that this system's <float.h>
* or <limits.h> defines the symbol LDBL_DIG, which is the number
* This symbol, if defined, indicates to the C program that it should
* include <inttypes.h>.
*/
-/* HAS_INT64_T:
- * This symbol will defined if the C compiler supports int64_t.
- * Usually the <inttypes.h> needs to be included, but sometimes
- * <sys/types.h> is enough.
- */
#$i_inttypes I_INTTYPES /**/
-#$d_int64t HAS_INT64_T /**/
/* I_MNTENT:
* This symbol, if defined, indicates that <mntent.h> exists and
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 <sys/types.h>
+# ifdef I_INTTYPES /* e.g. Linux has int64_t without <inttypes.h> */
+# include <inttypes.h>
+# 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. */
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'
*-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.
;;
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'
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'
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 @ @'`
glibpth="/lib/pa20_64"
esac
EOCBU
+
+
+
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'
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'
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" ;;
#undef UV
#endif
-#ifdef I_INTTYPES
-#include <inttypes.h>
-#endif
-
/*
The IV type is supposed to be long enough to hold any integral
value or a pointer.
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
#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 */
# 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
# 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
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;
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)
unsigned int auint;
I32 along;
U32 aulong;
-#ifdef Quad_t
+#ifdef HAS_QUAD
Quad_t aquad;
Uquad_t auquad;
#endif
}
}
break;
-#ifdef Quad_t
+#ifdef HAS_QUAD
case 'Q':
while (len-- > 0) {
fromstr = NEXTFROM;
/* SIZE */
switch (*q) {
-#ifdef Quad_t
+#ifdef HAS_QUAD
case 'L': /* Ld */
case 'q': /* qd */
intsize = 'q';
break;
#endif
case 'l':
-#ifdef Quad_t
+#ifdef HAS_QUAD
if (*(q + 1) == 'l') { /* lld */
intsize = 'q';
q += 2;
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
}
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
}
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
}
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
}
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
}
# 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;
# 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.
*d++ = (( uv & 0x3f) | 0x80);
return d;
}
-#ifdef Quad_t
+#ifdef HAS_QUAD
if (uv < 0x2000000000)
#endif
{
*d++ = (( uv & 0x3f) | 0x80);
return d;
}
-#ifdef Quad_t
+#ifdef HAS_QUAD
{
*d++ = 0xff; /* Can't match U+FFFE! */
*d++ = (((uv >> 36) & 0x3f) | 0x80);