changeset 8676:22462fd58e66

require HDF5 v1.6 API
author John W. Eaton <jwe@octave.org>
date Thu, 05 Feb 2009 01:19:29 -0500
parents 43c6012bd4c2
children 095ae5e0a831
files ChangeLog aclocal.m4 configure.in src/ChangeLog src/load-save.cc src/ls-hdf5.cc src/ls-hdf5.h src/oct-hdf5.h src/ov-base-sparse.cc src/ov-base.h src/ov.h
diffstat 11 files changed, 84 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 04 17:48:30 2009 -0500
+++ b/ChangeLog	Thu Feb 05 01:19:29 2009 -0500
@@ -1,3 +1,8 @@
+2009-02-05  John W. Eaton  <jwe@octave.org>
+
+	* aclocal.m4 (OCTAVE_HDF5_HAS_REQUIRED_API): New macro.
+	* configure.in: Use it in HDF5 check.
+
 2009-02-04  Benjamin Lindner  <lindnerben@gmx.net>
 
 	* configure.in: Use separate cases for *-*-mingw* and *-*-cygwin*
--- a/aclocal.m4	Wed Feb 04 17:48:30 2009 -0500
+++ b/aclocal.m4	Thu Feb 05 01:19:29 2009 -0500
@@ -919,6 +919,25 @@
     AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)])
   fi])
 dnl
+dnl Check whether HDF5 library has version 1.6 API functions.
+dnl
+AC_DEFUN([OCTAVE_HDF5_HAS_REQUIRED_API], [
+  AC_CACHE_CHECK([whether HDF5 library has required API],
+    octave_cv_hdf5_has_required_api, [
+    AC_TRY_LINK([
+#define H5_USE_16_API 1
+#include <hdf5.h>
+], [
+  H5Eset_auto (0, 0);], [
+      octave_cv_hdf5_has_required_api=yes], [
+      octave_cv_hdf5_has_required_api=no])])
+  if test "$octave_cv_hdf5_has_required_api" = "no"; then
+    WITH_HDF5=false
+    warn_hdf5="HDF5 library does not provide the version 1.6 API.  Octave will not be able to save or load HDF5 data files."
+    AC_MSG_WARN($warn_hdf5)
+  fi
+])
+dnl
 dnl Check for the QHull version.
 dnl
 AC_DEFUN(AC_CHECK_QHULL_VERSION,
--- a/configure.in	Wed Feb 04 17:48:30 2009 -0500
+++ b/configure.in	Thu Feb 05 01:19:29 2009 -0500
@@ -547,9 +547,12 @@
         WITH_HDF5=true
         HDF5_LIBS="-l$hdf5_lib"
         LIBS="$HDF5_LIBS $LIBS"
-        AC_DEFINE(HAVE_HDF5, 1, [Define if HDF5 is available.])
 	AC_CHECK_LIB($hdf5_lib, H5Gget_num_objs, [
-	  AC_DEFINE(HAVE_H5GGET_NUM_OBJS, 1, [Define if HDF5 has H5Gget_num_objs.])])])])
+          OCTAVE_HDF5_HAS_REQUIRED_API
+          if test $WITH_HDF5; then
+            AC_DEFINE(HAVE_HDF5, 1, [Define if HDF5 is available.])
+	    AC_DEFINE(HAVE_H5GGET_NUM_OBJS, 1, [Define if HDF5 has H5Gget_num_objs.])
+	  fi])])])
   fi
 
   if $WITH_HDF5; then
@@ -559,9 +562,6 @@
         ;;
     esac
     true
-  else
-    warn_hdf5="HDF5 library not found.  Octave will not be able to save or load HDF5 data files."
-    AC_MSG_WARN($warn_hdf5)
   fi
 else
   warn_zlib="ZLIB library not found.  Octave will not be able to save or load compressed data files or HDF5 files."
--- a/src/ChangeLog	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/ChangeLog	Thu Feb 05 01:19:29 2009 -0500
@@ -1,3 +1,12 @@
+2009-02-05  John W. Eaton  <jwe@octave.org>
+
+	* oct-hdf5.h: New file.
+	* ls-hdf5.cc, ov-base.h, ov.h: Include oct-hdf5.h instead of hdf5.h.
+	* ls-hdf5.h: Include oct-hdf5.h.
+	* load-save.cc: Include ls-hdf5.h instead of hdf5.h.
+	* ov-base-sparse.cc, load-save.cc:
+	Don't protect #include "ls-hdf5.h" with #ifdef.
+
 2009-02-04  Kai Habel  <kai.habel@gmx.de>
 
 	* gl-render.cc (opengl_renderer::draw (surface::properties)):
--- a/src/load-save.cc	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/load-save.cc	Thu Feb 05 01:19:29 2009 -0500
@@ -39,10 +39,6 @@
 #include <sstream>
 #include <string>
 
-#ifdef HAVE_HDF5
-#include <hdf5.h>
-#endif
-
 #include "byte-swap.h"
 #include "data-conv.h"
 #include "file-ops.h"
@@ -75,9 +71,7 @@
 #include "version.h"
 #include "dMatrix.h"
 
-#ifdef HAVE_HDF5
 #include "ls-hdf5.h"
-#endif
 #include "ls-mat-ascii.h"
 #include "ls-mat4.h"
 #include "ls-mat5.h"
--- a/src/ls-hdf5.cc	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/ls-hdf5.cc	Thu Feb 05 01:19:29 2009 -0500
@@ -38,8 +38,6 @@
 #include <string>
 #include <vector>
 
-#include <hdf5.h>
-
 #include "byte-swap.h"
 #include "data-conv.h"
 #include "file-ops.h"
--- a/src/ls-hdf5.h	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/ls-hdf5.h	Thu Feb 05 01:19:29 2009 -0500
@@ -25,6 +25,8 @@
 
 #if defined (HAVE_HDF5)
 
+#include "oct-hdf5.h"
+
 // first, we need to define our own dummy stream subclass, since
 // HDF5 needs to do its own file i/o
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/oct-hdf5.h	Thu Feb 05 01:19:29 2009 -0500
@@ -0,0 +1,42 @@
+/*
+
+Copyright (C) 2009 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave__hdf5_h)
+#define octave_hdf5_h 1
+
+#if defined (HAVE_HDF5)
+
+#if !defined (H5_USE_16_API)
+#define H5_USE_16_API 1
+#endif
+
+#include <hdf5.h>
+
+#endif
+
+#endif
+
+/*
+;;; Local Variables: ***
+;;; mode: C++ ***
+;;; End: ***
+*/
--- a/src/ov-base-sparse.cc	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/ov-base-sparse.cc	Thu Feb 05 01:19:29 2009 -0500
@@ -36,9 +36,7 @@
 #include "byte-swap.h"
 #include "ls-oct-ascii.h"
 #include "ls-utils.h"
-#if defined (HAVE_HDF5)
 #include "ls-hdf5.h"
-#endif
 
 #include "boolSparse.h"
 #include "ov-base-sparse.h"
--- a/src/ov-base.h	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/ov-base.h	Thu Feb 05 01:19:29 2009 -0500
@@ -30,10 +30,6 @@
 #include <list>
 #include <string>
 
-#if defined (HAVE_HDF5)
-#include <hdf5.h>
-#endif
-
 #include "Range.h"
 #include "data-conv.h"
 #include "mxarray.h"
@@ -41,6 +37,7 @@
 #include "str-vec.h"
 
 #include "error.h"
+#include "oct-hdf5.h"
 
 class Cell;
 class Octave_map;
--- a/src/ov.h	Wed Feb 04 17:48:30 2009 -0500
+++ b/src/ov.h	Thu Feb 05 01:19:29 2009 -0500
@@ -30,10 +30,6 @@
 #include <string>
 #include <list>
 
-#if defined (HAVE_HDF5)
-#include <hdf5.h>
-#endif
-
 #include "Range.h"
 #include "data-conv.h"
 #include "idx-vector.h"
@@ -44,6 +40,7 @@
 #include "oct-time.h"
 #include "str-vec.h"
 
+#include "oct-hdf5.h"
 #include "oct-sort.h"
 
 class Cell;