1 dnl Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License, or (at your option) any later version.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 AC_DEFUN([CHECK_HDF5],[
24 AC_REQUIRE([AC_PROG_CC])dnl
25 AC_REQUIRE([AC_PROG_CPP])dnl
30 [AC_HELP_STRING([--with-hdf5=DIR],[root directory path to hdf5 installation])],
32 AC_MSG_RESULT("select $withval as path to hdf5")
35 AC_SUBST(HDF5_INCLUDES)
37 AC_SUBST(HDF5_MT_LIBS)
52 AC_MSG_WARN(undefined HDF5HOME variable which specify hdf5 installation directory)
53 AC_MSG_NOTICE(Trying native Hdf5...)
54 dnl For Parallel HDF5 test
57 LOCAL_INCLUDES="-I$HDF5HOME/include"
58 if test "x$HDF5HOME" = "x/usr"
60 AC_MSG_NOTICE(Trying native Hdf5...)
63 AC_MSG_NOTICE(Trying Hdf5 from $HDF5HOME ...)
64 LOCAL_LIBS="-L$HDF5HOME/lib"
65 LOCAL_RLIBS="-Wl,-R$HDF5HOME/lib"
69 if test "x$hdf5_ok" = "xno"
71 if test -e "$HDF5HOME/include/hdf5.h"
73 AC_MSG_CHECKING(if hdf5 is parallel and thus needs mpi)
74 hdf5_parallel=`grep "#define H5_HAVE_PARALLEL" $HDF5HOME/include/H5pubconf.h | awk '{i=3 ; print $i}'`
75 if test "x$hdf5_parallel" = "x1"
77 LOCAL_INCLUDES="-DOMPI_SKIP_MPICXX $MPI_INCLUDES $LOCAL_INCLUDES"
80 AC_MSG_RESULT(no,hdf5 seems serial)
83 AC_MSG_WARN(File $HDF5HOME/include/hdf5.h not present)
89 CPPFLAGS_old="$CPPFLAGS"
90 CPPFLAGS="$CPPFLAGS $MPI_INCLUDES $LOCAL_INCLUDES"
91 AC_CHECK_HEADER(hdf5.h,hdf5_ok=yes ,hdf5_ok=no)
92 CPPFLAGS="$CPPFLAGS_old"
95 if test "x$hdf5_ok" = "xyes"
101 LIBS="$LIBS $MPI_LIBS $LOCAL_LIBS"
102 AC_CHECK_LIB(hdf5,H5open,hdf5_ok=yes,hdf5_ok=no)
107 if test "x$hdf5_ok" = "xyes"
109 HDF5_INCLUDES="$MPI_INCLUDES $LOCAL_INCLUDES"
110 HDF5_LIBS="$MPI_LIBS $LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
111 HDF5_MT_LIBS="$MPI_LIBS $LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
114 if test "x$hdf5_ok" = "xyes"
116 HDF5_INCLUDES="$HDF5_INCLUDES -DH5_USE_16_API"
119 AC_MSG_RESULT(for hdf5: $hdf5_ok)