[Python-checkins] CVS: python/dist/src acconfig.h,1.51,1.52 configure,1.244,1.245 configure.in,1.252,1.253 pyconfig.h.in,1.6,1.7

Guido van Rossum gvanrossum@users.sourceforge.net
Wed, 05 Sep 2001 07:58:13 -0700


Update of /cvsroot/python/python/dist/src
In directory usw-pr-cvs1:/tmp/cvs-serv15594

Modified Files:
	acconfig.h configure configure.in pyconfig.h.in 
Log Message:
Changes to automatically enable large file support on some systems.
I believe this works on Linux (tested both on a system with large file
support and one without it), and it may work on Solaris 2.7.

The changes are twofold:

(1) The configure script now boldly tries to set the two symbols that
    are recommended (for Solaris and Linux), and then tries a test
    script that does some simple seeking without writing.

(2) The _portable_{fseek,ftell} functions are a little more systematic
    in how they try the different large file support options: first
    try fseeko/ftello, but only if off_t is large; then try
    fseek64/ftell64; then try hacking with fgetpos/fsetpos.

I'm keeping my fingers crossed.  The meaning of the
HAVE_LARGEFILE_SUPPORT macro is not at all clear.

I'll see if I can get it to work on Windows as well.



Index: acconfig.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/acconfig.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** acconfig.h	2001/07/11 22:35:31	1.51
--- acconfig.h	2001/09/05 14:58:11	1.52
***************
*** 26,29 ****
--- 26,32 ----
  #undef __EXTENSIONS__
  
+ /* This must be set to 64 on some systems to enable large file support */
+ #undef _FILE_OFFSET_BITS
+ 
  /* Define if getpgrp() must be called as getpgrp(0). */
  #undef GETPGRP_HAVE_ARG
***************
*** 107,110 ****
--- 110,116 ----
  /* Define if the compiler provides a wchar.h header file. */
  #undef HAVE_WCHAR_H
+ 
+ /* This must be defined on some systems to enable large file support */
+ #undef _LARGEFILE_SOURCE
  
  /* Define if you want to have a Unicode type. */

Index: configure
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure,v
retrieving revision 1.244
retrieving revision 1.245
diff -C2 -d -r1.244 -r1.245
*** configure	2001/09/05 14:24:42	1.244
--- configure	2001/09/05 14:58:11	1.245
***************
*** 1,5 ****
  #! /bin/sh
  
! # From configure.in Revision: 1.251 
  
  # Guess values for system-dependent variables and create Makefiles.
--- 1,5 ----
  #! /bin/sh
  
! # From configure.in Revision: 1.253 
  
[...4238 lines suppressed...]
  if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 7104 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
***************
*** 7084,7088 ****
  SRCDIRS="Parser Grammar Objects Python Modules"
  echo $ac_n "checking for build directories""... $ac_c" 1>&6
! echo "configure:7087: checking for build directories" >&5
  for dir in $SRCDIRS; do
      if test ! -d $dir; then
--- 7150,7154 ----
  SRCDIRS="Parser Grammar Objects Python Modules"
  echo $ac_n "checking for build directories""... $ac_c" 1>&6
! echo "configure:7153: checking for build directories" >&5
  for dir in $SRCDIRS; do
      if test ! -d $dir; then

Index: configure.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure.in,v
retrieving revision 1.252
retrieving revision 1.253
diff -C2 -d -r1.252 -r1.253
*** configure.in	2001/09/05 14:24:43	1.252
--- configure.in	2001/09/05 14:58:11	1.253
***************
*** 274,282 ****
  esac
  
! # MacOSX framework builds need more magic. LDLIBRARY is the dynamic library that
! # we build, but we do not want to link against it (we will find it with a -framework
! # option). For this reason there is an extra variable BLDLIBRARY against which Python
! # and the extension modules are linked, BLDLIBRARY. This is normally the same
! # as LDLIBRARY, but empty for MacOSX framework builds.
  if test "$enable_framework"
  then
--- 274,283 ----
  esac
  
! # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
! # library that we build, but we do not want to link against it (we
! # will find it with a -framework option). For this reason there is an
! # extra variable BLDLIBRARY against which Python and the extension
! # modules are linked, BLDLIBRARY. This is normally the same as
! # LDLIBRARY, but empty for MacOSX framework builds.
  if test "$enable_framework"
  then
***************
*** 1019,1023 ****
  if test "$ipv6" = "yes"; then
  	AC_MSG_CHECKING([ipv6 stack type])
! 	for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; do
  		case $i in
  		inria)
--- 1020,1025 ----
  if test "$ipv6" = "yes"; then
  	AC_MSG_CHECKING([ipv6 stack type])
! 	for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
! 	do
  		case $i in
  		inria)
***************
*** 1256,1259 ****
--- 1258,1302 ----
  AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
  AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
+ 
+ # Try defining symbols to enable large file support.
+ # The particular combination of symbols used here is known to work
+ # on Linux and Solaris [2.]7.
+ AC_MSG_CHECKING(for CFLAGS to enable large files)
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <stdio.h>
+ main() {
+ 	FILE *fp;
+ 	off_t seek = 0x80000000ul;
+ 	off_t tell = 0;
+ 	fp = fopen("conftestval", "wb");
+ 	if (fp == NULL) {
+ 		perror("conftestval");
+ 		exit(1);
+ 	}
+  	if (fseeko(fp, seek, 0) < 0)
+ 		perror("fseeko");
+ 	else
+ 		tell = ftello(fp);
+ 	fclose(fp);
+ 	unlink("conftestval");
+ 	if (tell == seek) {
+ 		fprintf(stderr, "seek to 2**31 worked\n");
+ 		exit(0);
+ 	}
+ 	else {
+ 		exit(1);
+ 		fprintf(stderr, "seek to 2**31 didn't work\n");
+ 	}
+ }
+ ],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(_LARGEFILE_SOURCE)
+ AC_DEFINE(_FILE_OFFSET_BITS,64),
+ AC_MSG_RESULT(no),
+ AC_MSG_RESULT(no (cross-compiling)))
+ CFLAGS="$OLD_CFLAGS"
  
  # check for long file support functions

Index: pyconfig.h.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** pyconfig.h.in	2001/09/05 14:45:54	1.6
--- pyconfig.h.in	2001/09/05 14:58:11	1.7
***************
*** 91,94 ****
--- 91,97 ----
  #undef __EXTENSIONS__
  
+ /* This must be set to 64 on some systems to enable large file support */
+ #undef _FILE_OFFSET_BITS
+ 
  /* Define if getpgrp() must be called as getpgrp(0). */
  #undef GETPGRP_HAVE_ARG
***************
*** 167,170 ****
--- 170,176 ----
  #undef HAVE_WCHAR_H
  
+ /* This must be defined on some systems to enable large file support */
+ #undef _LARGEFILE_SOURCE
+ 
  /* Define if you want to have a Unicode type. */
  #undef Py_USING_UNICODE
***************
*** 716,725 ****
  #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
  #endif
- #endif
- 
- /* Define the macros needed if on a UnixWare 7.x system. */
- #if defined(__USLC__) && defined(__SCO_VERSION__)
- #define SCO_ACCEPT_BUG     /* Use workaround for UnixWare accept() bug */
- #define SCO_ATAN2_BUG      /* Use workaround for UnixWare atan2() bug */
- #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
  #endif
--- 722,724 ----