Salome HOME
To see which hdf5 we're using in configure log
[modules/kernel.git] / salome_adm / unix / config_files / check_hdf5.m4
1 dnl  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 dnl
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
5 dnl
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.
10 dnl
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.
15 dnl
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
19 dnl
20 dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 dnl
22 AC_DEFUN([CHECK_HDF5],[
23 AC_REQUIRE([AC_PROG_CC])dnl
24 AC_REQUIRE([AC_PROG_CPP])dnl
25
26 AC_CHECKING(for HDF5)
27
28 AC_ARG_WITH(hdf5,
29     [AC_HELP_STRING([--with-hdf5=DIR],[root directory path to hdf5 installation])],
30     [HDF5HOME="$withval"
31       AC_MSG_RESULT("select $withval as path to hdf5")
32     ])
33
34 AC_SUBST(HDF5_INCLUDES)
35 AC_SUBST(HDF5_LIBS)
36 AC_SUBST(HDF5_MT_LIBS)
37
38 HDF5_INCLUDES=""
39 HDF5_LIBS=""
40 HDF5_MT_LIBS=""
41
42 hdf5_ok=no
43
44 LOCAL_INCLUDES=""
45 LOCAL_LIBS=""
46 LOCAL_RLIBS=""
47
48 if test -z $HDF5HOME
49 then
50    AC_MSG_WARN(undefined HDF5HOME variable which specify hdf5 installation directory)
51    AC_MSG_NOTICE(Trying native Hdf5...)
52 else
53    LOCAL_INCLUDES="-I$HDF5HOME/include"
54    if test "x$HDF5HOME" = "x/usr"
55    then
56       AC_MSG_NOTICE(Trying native Hdf5...)
57       LOCAL_LIBS=""
58    else
59       AC_MSG_NOTICE(Trying Hdf5 from $HDF5HOME ...)
60       LOCAL_LIBS="-L$HDF5HOME/lib"
61       LOCAL_RLIBS="-R$HDF5HOME/lib"
62    fi
63 fi
64
65 dnl hdf5 headers
66
67 CPPFLAGS_old="$CPPFLAGS"
68 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
69 AC_CHECK_HEADER(hdf5.h,hdf5_ok=yes ,hdf5_ok=no)
70 CPPFLAGS="$CPPFLAGS_old"
71
72
73 if  test "x$hdf5_ok" = "xyes"
74 then
75
76 dnl hdf5 library
77
78   LIBS_old="$LIBS"
79   LIBS="$LIBS $LOCAL_LIBS"
80   AC_CHECK_LIB(hdf5,H5open,hdf5_ok=yes,hdf5_ok=no)
81   LIBS="$LIBS_old"
82
83 fi
84
85 if  test "x$hdf5_ok" = "xyes"
86 then
87   HDF5_INCLUDES="$LOCAL_INCLUDES"
88   HDF5_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
89   HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
90 fi
91
92 if  test "x$hdf5_ok" = "xyes"
93 then
94   HDF5_INCLUDES="$HDF5_INCLUDES -DH5_USE_16_API"
95 fi
96
97 AC_MSG_RESULT(for hdf5: $hdf5_ok)
98
99 ])dnl