diff options
author | Guido van Rossum <guido@python.org> | 2001-09-05 14:58:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-05 14:58:11 (GMT) |
commit | b855216099771117388fdf38df80e5214e812955 (patch) | |
tree | 2dc27e3ab556016dc2b0811956d9b7bdcfd1c424 /configure.in | |
parent | 2f0047af3b54685e134d7baa9d2b80eff5f3d07f (diff) | |
download | cpython-b855216099771117388fdf38df80e5214e812955.zip cpython-b855216099771117388fdf38df80e5214e812955.tar.gz cpython-b855216099771117388fdf38df80e5214e812955.tar.bz2 |
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.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/configure.in b/configure.in index da9a1a0..ce059d1 100644 --- a/configure.in +++ b/configure.in @@ -273,11 +273,12 @@ cygwin*) ;; 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. +# 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 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' @@ -1018,7 +1019,8 @@ ipv6trylibc=no 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 + for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; + do case $i in inria) dnl http://www.kame.net/ @@ -1256,6 +1258,47 @@ AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \ 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 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) |