[PATCH v3 1/3] configure: use AC_SYS_LARGEFILE

Gao Xiang hsiangkao at linux.alibaba.com
Thu Dec 15 19:53:30 AEDT 2022


Hi Khem,

On Wed, Dec 14, 2022 at 10:47:56PM -0800, Khem Raj wrote:
> The autoconf macro AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS=64
> where necessary to ensure that off_t and all interfaces using off_t
> are 64bit, even on 32bit systems.
> 
> Pass -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=66 via CFLAGS

                             ^ -D_FILE_OFFSET_BITS=64?

> 
> Signed-off-by: Khem Raj <raj.khem at gmail.com>
> ---
>  configure.ac | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index a736ff0..e8bb003 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -13,6 +13,8 @@ AC_CONFIG_MACRO_DIR([m4])
>  AC_CONFIG_AUX_DIR(config)
>  AM_INIT_AUTOMAKE([foreign -Wall])
>  
> +AC_SYS_LARGEFILE

Do we still need this? Also it introduces --disable-largefile and which
will break the functionality to us.

Also see:
https://lore.kernel.org/linux-xfs/1480552932-614-1-git-send-email-ebiggers@google.com

Otherwise looks good to me.

Thanks,
Gao Xiang

> +
>  # Checks for programs.
>  AM_PROG_AR
>  AC_PROG_CC
> @@ -319,6 +321,9 @@ if test "x$enable_lzma" = "xyes"; then
>    CPPFLAGS="${saved_CPPFLAGS}"
>  fi
>  
> +# Enable 64-bit off_t
> +CFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
> +
>  # Set up needed symbols, conditionals and compiler/linker flags
>  AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"])
>  AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"])
> -- 
> 2.39.0


More information about the Linux-erofs mailing list