Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[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     [AC_HELP_STRING([--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 LOCAL_RLIBS=""
46
47 if test -z $HDF5HOME
48 then
49    AC_MSG_WARN(undefined HDF5HOME variable which specify hdf5 installation directory)
50 else
51    LOCAL_INCLUDES="-I$HDF5HOME/include"
52    if test "x$HDF5HOME" = "x/usr"
53    then
54       LOCAL_LIBS=""
55    else
56       LOCAL_LIBS="-L$HDF5HOME/lib"
57       LOCAL_RLIBS="-R$HDF5HOME/lib"
58    fi
59 fi
60
61 dnl hdf5 headers
62
63 CPPFLAGS_old="$CPPFLAGS"
64 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
65 AC_CHECK_HEADER(hdf5.h,hdf5_ok=yes ,hdf5_ok=no)
66 CPPFLAGS="$CPPFLAGS_old"
67
68
69 if  test "x$hdf5_ok" = "xyes"
70 then
71
72 dnl hdf5 library
73
74   LIBS_old="$LIBS"
75   LIBS="$LIBS $LOCAL_LIBS"
76   AC_CHECK_LIB(hdf5,H5open,hdf5_ok=yes,hdf5_ok=no)
77   LIBS="$LIBS_old"
78
79 fi
80
81 if  test "x$hdf5_ok" = "xyes"
82 then
83   HDF5_INCLUDES="$LOCAL_INCLUDES"
84   HDF5_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
85   HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
86 fi
87
88 AC_MSG_RESULT(for hdf5: $hdf5_ok)
89
90 ])dnl