diff --git a/configure.ac b/configure.ac index 9eedc21..5102e86 100644 --- a/configure.ac +++ b/configure.ac @@ -127,6 +127,22 @@ then echo 'Compiling without bridge support' fi +# ------------------------------------------------------------------------- +# Check large file support and the sizes of related types +# ------------------------------------------------------------------------- + +AC_SYS_LARGEFILE + +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) +# Only try to find the size of off_t if it really exists +if test "x$ac_cv_type_off_t" = xyes +then + AC_CHECK_SIZEOF(off_t) +else + AC_DEFINE([SIZEOF_OFF_T], [0]) +fi + # ------------------------------------------------------------------------- # Output section. State which @VARIABLES@ are going to be substituted # ------------------------------------------------------------------------- diff --git a/src/cenv.h b/src/cenv.h index fad04bb..c458dc7 100644 --- a/src/cenv.h +++ b/src/cenv.h @@ -250,10 +250,24 @@ */ #ifndef CENV_SYSF_LFS /* Predefining this must predefine the rest */ +# if defined(SIZEOF_OFF_T) /* system inspected by configure */ +# if SIZEOF_OFF_T == 0 || SIZEOF_OFF_T == 4 +# define CENV_SYSF_LFS 0 /* No off_t, use long */ +# define CENV_SYSF_LFS_FMT "l" /* printf format is long */ +# elif SIZEOF_OFF_T == 8 +# define CENV_SYSF_LFS 64 /* off_t exists and has 64 bits */ +# if SIZEOF_OFF_T == SIZEOF_LONG +# define CENV_SYSF_LFS_FMT "l" /* printf format is long */ +# elif SIZEOF_OFF_T == SIZEOF_LONG_LONG +# define CENV_SYSF_LFS_FMT "ll" /* printf format is long long */ +# endif +# endif +# define CENV_SYSF_FSEEKO HAVE_FSEEKO + /* FreeBSD defaults to 64-bit file off_t but calls the type "quad_t" * instead of "long long". Always has fseeko. */ -# if CENV_SYS_FREEBSD +# elif CENV_SYS_FREEBSD # define CENV_SYSF_LFS 64 /* off_t exists and has 64 bits */ # define CENV_SYSF_FSEEKO 1 /* And have some flavor of fseeko */ # define CENV_SYSF_LFS_FMT "q" /* printf format is quad_t */