Обсуждение: Detecting large-file support in configure

Поиск
Список
Период
Сортировка

Detecting large-file support in configure

От
Tom Lane
Дата:
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


Re: Detecting large-file support in configure

От
Peter Eisentraut
Дата:
Am Montag, 10. März 2008 schrieb Tom Lane:
> 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

That was my spontaneous thought while reading through your message.  It seems 
safest and clearest.