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