Salome HOME
sources v1.2
[modules/kernel.git] / salome_adm / unix / config_files / check_hdf5.m4
1 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3
4 #  This library is free software; you can redistribute it and/or 
5 #  modify it under the terms of the GNU Lesser General Public 
6 #  License as published by the Free Software Foundation; either 
7 #  version 2.1 of the License. 
8
9 #  This library is distributed in the hope that it will be useful, 
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 #  Lesser General Public License for more details. 
13
14 #  You should have received a copy of the GNU Lesser General Public 
15 #  License along with this library; if not, write to the Free Software 
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17
18 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 #
20 #
21 AC_DEFUN([CHECK_HDF5],[
22 AC_REQUIRE([AC_PROG_CC])dnl
23 AC_REQUIRE([AC_PROG_CPP])dnl
24
25 AC_CHECKING(for HDF5)
26
27 AC_ARG_WITH(hdf5,
28     [  --with-hdf5=DIR                 root directory path to hdf5 installation ],
29     [HDF5HOME="$withval"
30       AC_MSG_RESULT("select $withval as path to hdf5")
31     ])
32
33 AC_SUBST(HDF5_INCLUDES)
34 AC_SUBST(HDF5_LIBS)
35 AC_SUBST(HDF5_MT_LIBS)
36
37 HDF5_INCLUDES=""
38 HDF5_LIBS=""
39 HDF5_MT_LIBS=""
40
41 hdf5_ok=no
42
43 LOCAL_INCLUDES=""
44 LOCAL_LIBS=""
45
46 if test -z $HDF5HOME
47 then
48    AC_MSG_WARN(undefined HDF5HOME variable which specify hdf5 installation directory)
49 else
50    LOCAL_INCLUDES="-I$HDF5HOME/include"
51    LOCAL_LIBS="-L$HDF5HOME/lib"
52 fi
53
54 dnl hdf5 headers
55
56 CPPFLAGS_old="$CPPFLAGS"
57 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
58 AC_CHECK_HEADER(hdf5.h,hdf5_ok=yes ,hdf5_ok=no)
59 CPPFLAGS="$CPPFLAGS_old"
60
61
62 if  test "x$hdf5_ok" = "xyes"
63 then
64
65 dnl hdf5 library
66
67   LIBS_old="$LIBS"
68   LIBS="$LIBS $LOCAL_LIBS"
69   AC_CHECK_LIB(hdf5,H5open,hdf5_ok=yes,hdf5_ok=no)
70   LIBS="$LIBS_old"
71
72 fi
73
74 if  test "x$hdf5_ok" = "xyes"
75 then
76   HDF5_INCLUDES="$LOCAL_INCLUDES"
77   HDF5_LIBS="$LOCAL_LIBS -lhdf5"
78   HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5"
79 fi
80
81 AC_MSG_RESULT(for hdf5: $hdf5_ok)
82
83 ])dnl