[svn-r26085] Improved the direct VFD configure checks.

- Results of O_DIRECT and posix_memalign() checks are now
  output so users can more easily diagnose problems.

- Configure now fails if --enable-direct-vfd was requested
  but either O_DIRECT or posix_memalign() are not
  present.

Part of HDFFV-7566

Tested on: jam (configure only)
This commit is contained in:
Dana Robinson 2015-01-30 05:38:59 -05:00
parent 21a38c4e67
commit 8cb70b47cb
2 changed files with 39 additions and 44 deletions

62
configure vendored
View File

@ -28275,19 +28275,10 @@ 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 (VFD) support" >&5
$as_echo_n "checking for direct virtual file driver (VFD) 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=no
fi
if test "X$DIRECT_VFD" = "Xyes"; then
if ${hdf5_cv_direct_io+:} false; then :
if ${hdf5_cv_direct_io+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_fn_c_check_decl "$LINENO" "O_DIRECT" "ac_cv_have_decl_O_DIRECT" "#include <fcntl.h>
@ -28300,38 +28291,31 @@ fi
fi
if ${hdf5_cv_posix_memalign+:} false; then :
if ${hdf5_cv_posix_memalign+:} false; then :
$as_echo_n "(cached) " >&6
else
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_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 conftest.err conftest.$ac_objext \
conftest$ac_exeext 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 "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; }
@ -28342,10 +28326,14 @@ $as_echo "#define HAVE_DIRECT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
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

View File

@ -2521,7 +2521,15 @@ fi
## Check if Direct I/O driver is enabled by --enable-direct-vfd
##
AC_MSG_CHECKING([for direct virtual file driver (VFD) 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],
@ -2532,11 +2540,6 @@ AC_ARG_ENABLE([direct-vfd],
[DIRECT_VFD=$enableval], [DIRECT_VFD=no])
if test "X$DIRECT_VFD" = "Xyes"; then
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_TRY_LINK(, [posix_memalign()], [hdf5_cv_posix_memalign=yes], [hdf5_cv_posix_memalign=no]))
if test ${hdf5_cv_direct_io} = "yes" && test ${hdf5_cv_posix_memalign} = "yes" ; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DIRECT], [1],
@ -2544,9 +2547,13 @@ if test "X$DIRECT_VFD" = "Xyes"; then
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"])