1 dnl -------------------------------------------------------------------
2 dnl This test for largefile support was written by Vadim Zeitlin for
4 dnl -------------------------------------------------------------------
6 dnl WX_SYS_LARGEFILE_TEST
8 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
9 dnl arithmetic properly but this failed miserably with gcc under Linux
10 dnl whereas the system still supports 64 bit files, so now simply check
11 dnl that off_t is big enough
12 define(WX_SYS_LARGEFILE_TEST,
14 unsigned int field: sizeof(off_t) == 8;
18 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
19 define(WX_SYS_LARGEFILE_MACRO_VALUE,
21 AC_CACHE_CHECK([for $1 value needed for large files], [$3],
23 AC_TRY_COMPILE([#define $1 $2
24 #include <sys/types.h>],
25 WX_SYS_LARGEFILE_TEST,
31 if test "$$3" != no; then
33 AC_DEFINE_UNQUOTED([$1], [$$3], [$1 (for LARGEFILE support)])
42 dnl By default, many hosts won't let programs access large files;
43 dnl one must use special compiler options to get large-file access to work.
44 dnl For more details about this brain damage please see:
45 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
46 AC_DEFUN([AC_SYS_LARGEFILE],
47 [AC_ARG_ENABLE(largefile,
48 [ --disable-largefile omit support for large files])
49 if test "$enable_largefile" != no; then
50 dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
51 dnl _LARGE_FILES -- for AIX
53 WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
54 if test "x$wx_largefile" != "xyes"; then
55 WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
59 AC_CACHE_CHECK([for 64 bit off_t],netatalk_cv_SIZEOF_OFF_T,[
60 AC_TRY_RUN([#include <stdio.h>
63 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
64 netatalk_cv_SIZEOF_OFF_T=yes,netatalk_cv_SIZEOF_OFF_T=no,netatalk_cv_SIZEOF_OFF_T=cross)])
66 AC_MSG_CHECKING([if large file support is available])
67 if test "x$netatalk_cv_SIZEOF_OFF_T" != "xno"; then
68 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, [], [LARGEFILE support])
70 ifelse([$1], , :, [$1])
73 ifelse([$2], , :, [$2])
78 dnl ----------end of largefile test------------------------------------