Detecting large-file support in configure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Detecting large-file support in configure
Date: 2008-03-10 16:59:42
Message-ID: 25719.1205168382@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm reviewing this patch
http://archives.postgresql.org/pgsql-patches/2007-04/msg00531.php
which contains this configure.in code to decide if it's safe to allow
use of non-segmented files:

if test $ac_cv_func_fseeko = yes; then
AC_SYS_LARGEFILE
fi

+ if test "$ac_cv_sys_large_files" = "no" -o "$segmented_files" = "yes"; then
+ AC_DEFINE([USE_SEGMENTED_FILES], 1,
+ [Define to split data file in 1GB segments.])
+ fi

AFAICT this is simply wrong. ac_cv_sys_large_files isn't set to reflect
whether the platform has largefile support or not; it's set to reflect
whether you need to #define _LARGE_FILES to get that. On a platform
where largefile support is native, or is instead enabled by setting
_FILE_OFFSET_BITS to 64, this test would refuse to allow
USE_SEGMENTED_FILES to be disabled.

Another problem is that it'll do the wrong thing if fseeko isn't
present, because then AC_SYS_LARGEFILE isn't executed at all.

A quick look at the configure script suggests that the available macros
don't really set anything that specifically tells you if they found
working largefile support. I'm considering doing AC_CHECK_SIZEOF(off_t)
and then looking at the result, but I wonder if anyone knows the
"approved" way to accomplish this.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2008-03-10 17:06:12 Re: [Fwd: Re: [PATCHES] 64-bit CommandIds]
Previous Message Gregory Stark 2008-03-10 16:59:30 Re: [Fwd: Re: [PATCHES] 64-bit CommandIds]