summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2010-05-05 17:34:26 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2010-05-05 17:34:26 (GMT)
commitf0ecd713070b869c0d89d2ff0c991ade04852177 (patch)
tree3ad6778fc01cffeab1699c26b5ad2399e2e110e1 /configure.in
parent74c8b68acab0fc2408740e7a38a2ab2bcdf58f57 (diff)
downloadhdf5-f0ecd713070b869c0d89d2ff0c991ade04852177.zip
hdf5-f0ecd713070b869c0d89d2ff0c991ade04852177.tar.gz
hdf5-f0ecd713070b869c0d89d2ff0c991ade04852177.tar.bz2
[svn-r18709] Purpose:
Improve configure's large-file support control. Description: Modified configure to now attempt to add defines necessary for supporting largefiles on all systems, instead of solely on linux. This is in response to user requests to enable largefile support on Solaris by default, as well as to give extra control on AIX (instead of just jamming the necessary flag into the config files). The old --enable-linux-lfs flag has been removed in favor of the --enable-largefile flag (enabled by default), which can be used on all platforms. On systems where large files cannot be supported in this manner, configure will report as such. Tested: h5committest AIX (NCSA's blue_print machine) duty, liberty, and linew.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in135
1 files changed, 100 insertions, 35 deletions
diff --git a/configure.in b/configure.in
index 5f06f04..3e59662 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.
@@ -177,7 +177,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
@@ -1260,42 +1260,107 @@ 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
-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_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 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
- if test ${MAJOR_VER} -gt 2 -o ${MAJOR_VER} -eq 2 -a ${MINOR_VER} -ge 4; then
- LINUX_LFS="yes"
- fi
- ;;
- esac
+ 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
- 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 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