summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure125
-rw-r--r--configure.ac72
-rw-r--r--src/H5config.h.in2
3 files changed, 94 insertions, 105 deletions
diff --git a/configure b/configure
index 5392f18..80fe73b 100755
--- a/configure
+++ b/configure
@@ -1616,8 +1616,9 @@ Optional Features:
--enable-filters=all Turn on all internal I/O filters. One may also
specify a comma-separated list of filters or the
word no. The default is all internal I/O filters.
- --enable-direct-vfd Build the Direct I/O Virtual File Driver
- [default=yes]
+ --enable-direct-vfd Build the direct I/O virtual file driver (VFD). This
+ is based on the POSIX (sec2) VFD and requires the
+ open() call to take the O_DIRECT flag. [default=no]
--enable-dconv-exception
if exception handling functions is checked during
data conversions [default=yes]
@@ -23099,19 +23100,28 @@ case "$host_cpu-$host_vendor-$host_os" in
## Add POSIX support on Linux systems, so <features.h> defines
## __USE_POSIX, which is required to get the prototype for fdopen
## defined correctly in <stdio.h>.
+ ##
## This flag was removed from h5cc as of 2009-10-17 when it was found
## that the flag broke compiling netCDF-4 code with h5cc, but kept in
## H5_CPPFLAGS because fdopen and HDfdopen fail without it. HDfdopen
## is used only by H5_debug_mask which is used only when debugging in
## H5_init_library (all in H5.c). When the flag was removed this was
## the only compile failure noted.
+ ##
## This was originally defined as _POSIX_SOURCE which was updated to
## _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
## functionality so clock_gettime and CLOCK_MONOTONIC are defined
- ## correctly.
+ ## correctly. This was later updated to 200112L so that
+ ## posix_memalign() is visible for the direct VFD code on Linux
+ ## systems.
+ ##
## POSIX feature information can be found in the gcc manual at:
## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- H5_CPPFLAGS="-D_POSIX_C_SOURCE=199506L $H5_CPPFLAGS"
+ H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS"
+
+ ## Need to add this so that O_DIRECT is visible for the direct
+ ## VFD on Linux systems.
+ AM_CPPFLAGS="-D_GNU_SOURCE $AM_CPPFLAGS"
## Also add BSD support on Linux systems, so <features.h> defines
## __USE_BSD, which is required to get the prototype for strdup
@@ -28343,94 +28353,65 @@ fi
## Check if Direct I/O driver is enabled by --enable-direct-vfd
##
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Direct Virtual File Driver support" >&5
-$as_echo_n "checking for Direct Virtual File Driver support... " >&6; }
+## Check these regardless. If the checks are moved inside the main
+## direct VFD block, the output is nested.
-# Check whether --enable-direct-vfd was given.
-if test "${enable_direct_vfd+set}" = set; then :
- enableval=$enable_direct_vfd; DIRECT_VFD=$enableval
-else
- DIRECT_VFD=yes
-fi
-
-
-if test "$DIRECT_VFD" = "yes"; then
- if ${hdf5_cv_direct_io+:} false; then :
+if ${hdf5_cv_direct_io+:} false; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- int main(void)
- {
- int fid;
- if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0)
- exit(1);
- close(fid);
- remove("tst_file");
- exit (0);
- }
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#ifdef FC_DUMMY_MAIN
-#ifndef FC_DUMMY_MAIN_EQ_F77
-# ifdef __cplusplus
- extern "C"
-# endif
- int FC_DUMMY_MAIN() { return 1; }
-#endif
-#endif
-int
-main ()
-{
-posix_memalign()
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+ ac_fn_c_check_decl "$LINENO" "O_DIRECT" "ac_cv_have_decl_O_DIRECT" "#include <fcntl.h>
+"
+if test "x$ac_cv_have_decl_O_DIRECT" = xyes; then :
hdf5_cv_direct_io=yes
else
hdf5_cv_direct_io=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+if ${hdf5_cv_posix_memalign+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- hdf5_cv_direct_io=no
+ ac_fn_c_check_func "$LINENO" "posix_memalign" "ac_cv_func_posix_memalign"
+if test "x$ac_cv_func_posix_memalign" = xyes; then :
+ hdf5_cv_posix_memalign=yes
+else
+ hdf5_cv_posix_memalign=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+
fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the direct I/O virtual file driver (VFD) is enabled" >&5
+$as_echo_n "checking if the direct I/O virtual file driver (VFD) is enabled... " >&6; }
+
+# Check whether --enable-direct-vfd was given.
+if test "${enable_direct_vfd+set}" = set; then :
+ enableval=$enable_direct_vfd; DIRECT_VFD=$enableval
+else
+ DIRECT_VFD=no
fi
- if test ${hdf5_cv_direct_io} = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+if test "X$DIRECT_VFD" = "Xyes"; then
+ if test ${hdf5_cv_direct_io} = "yes" && test ${hdf5_cv_posix_memalign} = "yes" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_DIRECT 1" >>confdefs.h
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- DIRECT_VFD=no
- fi
+ DIRECT_VFD=no
+ as_fn_error $? "The direct VFD was requested but cannot be built. This is either
+ due to O_DIRECT not being found in fcntl.h or a lack of
+ posix_memalign() on your system. Please re-configure without
+ specifying --enable-direct-vfd." "$LINENO" 5
+ fi
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
-$as_echo "suppressed" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
if test "X$DIRECT_VFD" = "Xyes"; then
diff --git a/configure.ac b/configure.ac
index 812ea9a..3b8b2eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1110,19 +1110,28 @@ case "$host_cpu-$host_vendor-$host_os" in
## Add POSIX support on Linux systems, so <features.h> defines
## __USE_POSIX, which is required to get the prototype for fdopen
## defined correctly in <stdio.h>.
+ ##
## This flag was removed from h5cc as of 2009-10-17 when it was found
## that the flag broke compiling netCDF-4 code with h5cc, but kept in
## H5_CPPFLAGS because fdopen and HDfdopen fail without it. HDfdopen
## is used only by H5_debug_mask which is used only when debugging in
## H5_init_library (all in H5.c). When the flag was removed this was
## the only compile failure noted.
+ ##
## This was originally defined as _POSIX_SOURCE which was updated to
## _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
## functionality so clock_gettime and CLOCK_MONOTONIC are defined
- ## correctly.
+ ## correctly. This was later updated to 200112L so that
+ ## posix_memalign() is visible for the direct VFD code on Linux
+ ## systems.
+ ##
## POSIX feature information can be found in the gcc manual at:
## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- H5_CPPFLAGS="-D_POSIX_C_SOURCE=199506L $H5_CPPFLAGS"
+ H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS"
+
+ ## Need to add this so that O_DIRECT is visible for the direct
+ ## VFD on Linux systems.
+ AM_CPPFLAGS="-D_GNU_SOURCE $AM_CPPFLAGS"
## Also add BSD support on Linux systems, so <features.h> defines
## __USE_BSD, which is required to get the prototype for strdup
@@ -2537,40 +2546,39 @@ fi
## Check if Direct I/O driver is enabled by --enable-direct-vfd
##
-AC_MSG_CHECKING([for Direct Virtual File Driver support])
+## Check these regardless. If the checks are moved inside the main
+## direct VFD block, the output is nested.
+
+AC_CACHE_VAL([hdf5_cv_direct_io],
+ AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include <fcntl.h>]]))
+AC_CACHE_VAL([hdf5_cv_posix_memalign],
+ AC_CHECK_FUNC([posix_memalign], [hdf5_cv_posix_memalign=yes], [hdf5_cv_posix_memalign=no]))
+
+AC_MSG_CHECKING([if the direct I/O virtual file driver (VFD) is enabled])
AC_ARG_ENABLE([direct-vfd],
[AS_HELP_STRING([--enable-direct-vfd],
- [Build the Direct I/O Virtual File Driver
- [default=yes]])],
- [DIRECT_VFD=$enableval], [DIRECT_VFD=yes])
-
-if test "$DIRECT_VFD" = "yes"; then
- AC_CACHE_VAL([hdf5_cv_direct_io],
- [AC_TRY_RUN([
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- int main(void)
- {
- int fid;
- if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0)
- exit(1);
- close(fid);
- remove("tst_file");
- exit (0);
- }], [AC_TRY_LINK(, [posix_memalign()], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no])], [hdf5_cv_direct_io=no],)])
-
- if test ${hdf5_cv_direct_io} = "yes"; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_DIRECT], [1],
- [Define if the direct I/O virtual file driver should be compiled])
- else
- AC_MSG_RESULT([no])
- DIRECT_VFD=no
- fi
+ [Build the direct I/O virtual file driver (VFD).
+ This is based on the POSIX (sec2) VFD and
+ requires the open() call to take the O_DIRECT
+ flag. [default=no]])],
+ [DIRECT_VFD=$enableval], [DIRECT_VFD=no])
+
+if test "X$DIRECT_VFD" = "Xyes"; then
+ if test ${hdf5_cv_direct_io} = "yes" && test ${hdf5_cv_posix_memalign} = "yes" ; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_DIRECT], [1],
+ [Define if the direct I/O virtual file driver (VFD) should be compiled])
+ else
+ AC_MSG_RESULT([no])
+ DIRECT_VFD=no
+ AC_MSG_ERROR([The direct VFD was requested but cannot be built. This is either
+ due to O_DIRECT not being found in fcntl.h or a lack of
+ posix_memalign() on your system. Please re-configure without
+ specifying --enable-direct-vfd.])
+ fi
else
- AC_MSG_RESULT([suppressed])
+ AC_MSG_RESULT([no])
fi
AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"])
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 0c09fe6..6b6ffdd 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -87,7 +87,7 @@
/* Define to 1 if you have the `difftime' function. */
#undef HAVE_DIFFTIME
-/* Define if the direct I/O virtual file driver should be compiled */
+/* Define if the direct I/O virtual file driver (VFD) should be compiled */
#undef HAVE_DIRECT
/* Define to 1 if you have the <dirent.h> header file. */