autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Library that needs large file support


From: Bob Friesenhahn
Subject: Re: Library that needs large file support
Date: Sun, 21 Dec 2003 15:44:07 -0600 (CST)

On Sun, 21 Dec 2003, Jeff Sheinberg wrote:

> Paul Eggert writes:
>  > Florian Weimer <address@hidden> writes:
>  >
>  > > I'm writing a library that will require large-file support on 32-bit GNU
>                                                                    ^^^^^^^^^^
>  > > platforms (so that off_t and ino_t are 64 bits wide, otherwise data
>  > > structure layout would change).  What is the canonical way to enforce
>  > > this?
>  >
>  > AC_SYS_LARGEFILE
>
> What about largefile support on a non-GNU system?

> Posix uses various "getconf" calls for compilation flags, library
> flags, and linking flags.  The values returned from the various

While it is true that Posix compliant systems should support
"getconf", some systems do not.  Regardless, my experience
with AC_SYS_LARGEFILE on real-world systems is that it does produce
the correct results.

My configure script needs to have access to the values that
AC_SYS_LARGEFILE sets since including config.h is not sufficient for
all applications.  Sometimes the options *must* be specified on the
compiler command line to work.  Therefore I augment AC_SYS_LARGEFILE
as follows in order to define a LFS_CPPFLAGS variable which may be
used within the Makefile:

########
#
# Check for large file support
#
# According to the X/Open LFS standard, setting _FILE_OFFSET_BITS to 64
# remaps standard functions to their 64-bit equivalents.
#
########
AC_SYS_LARGEFILE
LFS_CPPFLAGS=''
if test "$enable_largefile" != no
then
  if test "$ac_cv_sys_file_offset_bits" != 'no'
  then
    LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
  fi
  if test "$ac_cv_sys_large_files" != 'no'
  then
    LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
  fi
  # If the `fseeko' function is available, define `HAVE_FSEEKO'. Define
  # `_LARGEFILE_SOURCE' if necessary.
  AC_FUNC_FSEEKO
  if  test "$ac_cv_sys_largefile_source" != 'no'
  then
    LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
  fi
fi
AC_SUBST(LFS_CPPFLAGS)

Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]