summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in150
1 files changed, 118 insertions, 32 deletions
diff --git a/configure.in b/configure.in
index bc9ff78..a435a8c 100644
--- a/configure.in
+++ b/configure.in
@@ -157,7 +157,7 @@ dnl HDF_CXX: whether C++ is enabled. Default no.
dnl CXX: C++ compiler.
dnl HDF5_HL: whether high-level library is enabled. Default is yes.
dnl GPFS: whether gpfs is enabled. Default no.
-dnl LINUX_LFS: whether LINUX_LFS is enabled. Default no.
+dnl LARGEFILE: whether largefile support is enabled. Default yes.
dnl INSTRUMENT: whether INSTRUMENT is enabled. No default set here.
dnl CODESTACK: whether CODESTACK is enabled. Default no.
dnl HAVE_DMALLOC: whether system has dmalloc support. Default no.
@@ -178,7 +178,7 @@ AC_SUBST(HDF_CXX) HDF_CXX=no
AC_SUBST(CXX) HDF_CXX=no
AC_SUBST(HDF5_HL) HDF5_HL=yes
AC_SUBST(GPFS) GPFS=no
-AC_SUBST(LINUX_LFS) LINUX_LFS=no
+AC_SUBST(LARGEFILE) LARGEFILE=yes
AC_SUBST(INSTRUMENT)
AC_SUBST(CODESTACK) CODESTACK=no
AC_SUBST(HAVE_DMALLOC) HAVE_DMALLOC=no
@@ -1269,42 +1269,127 @@ case "$host" in
esac
dnl ----------------------------------------------------------------------
-dnl Test for 64bit stuff before the data types and their sizes. The
-dnl result could effect the outcome of the sizeof macros below.
+dnl Test for Largefile support.
dnl
+AC_MSG_CHECKING([if configure should try to set up large file support])
+
+AC_ARG_ENABLE([largefile],
+ [AC_HELP_STRING([--disable-largefile],
+ [omit support for large files])])
+
+dnl The linux-lfs option is deprecated, but if it is used to disable
+dnl largefile support on linux and the largefile option is not specified,
+dnl then go ahead and disable large-file support.
case "$host_cpu-$host_vendor-$host_os" in
*linux*)
- dnl ----------------------------------------------------------------------
- dnl Enable large file support on linux? Store the result in the LINUX_LFS
- dnl variable for posterity
AC_ARG_ENABLE([linux-lfs],
- [AC_HELP_STRING([--enable-linux-lfs],
- [Enable support for large (64-bit)
- files on Linux. [default=check]])])
-
- LINUX_LFS="no"
- case "X-$enable_linux_lfs" in
- X-yes)
- LINUX_LFS=yes
- ;;
- X-no)
- ;;
- X-|*)
- MAJOR_VER="`uname -r | cut -d '.' -f1`"
- MINOR_VER="`uname -r | cut -d '.' -f2`"
+ [AC_HELP_STRING([--disable-linux-lfs],
+ [Disable support for large (64-bit)
+ files on Linux. This option is
+ deprecated in favor of
+ --disable-largefile.])])
+
+ if test "$enable_linux_lfs" = no; then
+ if test "$enable_largefile" != yes; then
+ enable_largefile=no
+ fi
+ fi
+ ;;
+esac
- if test ${MAJOR_VER} -gt 2 -o ${MAJOR_VER} -eq 2 -a ${MINOR_VER} -ge 4; then
- LINUX_LFS="yes"
- fi
- ;;
- esac
+dnl If largefile support is enabled, then set up appropriate compiler options.
+if test "$enable_largefile" != no; then
+ AC_MSG_RESULT(yes)
+
+ dnl Check for needed compiler options. This check is pulled drectly
+ dnl from autoconf's AC_SYS_LARGEFILE macro, as of Autoconf v2.65.
+ AC_CACHE_CHECK([for special C compiler options needed for large files],
+ ac_cv_sys_largefile_CC,
+ [ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
+ AC_COMPILE_IFELSE([], [break])
+ CC="$CC -n32"
+ AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi])
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
- AC_MSG_CHECKING([for large file support mode on Linux])
- if test "X$LINUX_LFS" = "Xyes"; then
- AC_MSG_RESULT([enabled])
- AM_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS"
- else
- AC_MSG_RESULT([disabled])
+ dnl Use the macro _AC_SYS_LARGEFILE_MACRO_VALUE to test defines
+ dnl that might need to be set for largefile support to behave
+ dnl correctly. This macro is defined in acsite.m4 and overrides
+ dnl the version provided by Autoconf (as of v2.65). The custom
+ dnl macro additionally adds the appropriate defines to AM_CPPFLAGS
+ dnl so that later configure checks have them visible.
+
+ dnl Check for _FILE_OFFSET_BITS
+ _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
+ ac_cv_sys_file_offset_bits,
+ [Number of bits in a file offset, on hosts where this is settable.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+
+ dnl Check for _LARGE_FILES
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+ ac_cv_sys_large_files,
+ [Define for large files, on AIX-style hosts.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+ fi
+
+ dnl Now actually test to see if we can create large files after we've
+ dnl checked for any needed defines.
+ AC_MSG_CHECKING([if large (64-bit) files are supported on this system.])
+ AC_CACHE_VAL([hdf5_cv_have_lfs],
+ [AC_TRY_RUN([
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
+ #define BIG_FILE (off_t)0x80000000UL
+ int main(void) {
+ int fd;
+ if ((fd=open("test.conf", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) exit(1);
+ if (lseek(fd, BIG_FILE, SEEK_SET)!=BIG_FILE) exit(1);
+ if (5!=write(fd, "hello", (size_t)5)) exit(1);
+ if (lseek(fd, 2*BIG_FILE, SEEK_SET) != 2*BIG_FILE) exit(1);
+ if (5!=write(fd, "hello", (size_t)5)) exit(1);
+ if (unlink("test.conf") < 0) exit(1);
+ exit(0);
+ }
+ ],[hdf5_cv_have_lfs=yes],[hdf5_cv_have_lfs=no],)])
+
+ if test "X${hdf5_cv_have_lfs}" = "Xyes"; then
+ AC_MSG_RESULT([yes])
+ LARGEFILE="yes"
+ fi
+ if test "X${hdf5_cv_have_lfs}" = "Xno"; then
+ AC_MSG_RESULT([no])
+ LARGEFILE="no"
+ fi
+
+else
+ LARGEFILE="no"
+ AC_MSG_RESULT(no)
+fi
+
+dnl ----------------------------------------------------------------------
+dnl Add necessary defines for Linux Systems.
+dnl
+case "$host_cpu-$host_vendor-$host_os" in
+ *linux*)
+ dnl If largefile support is enabled, then make available various
+ dnl LFS-related routines using the following _LARGEFILE*_SOURCE macros.
+ if test "X$LARGEFILE" != "Xno"; then
+ AM_CPPFLAGS="-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS"
fi
dnl Add POSIX support on Linux systems, so <features.h> defines
@@ -1890,6 +1975,7 @@ AC_MSG_RESULT([no]))
dnl Check whether the global variable `timezone' is defined.
AC_MSG_CHECKING([for global timezone variable])
+
case "`uname`" in
CYGWIN*)
AC_MSG_RESULT([disabled in CYGWIN])