Salome HOME
a0819806c599fe3f7f6bf34f9a0da8bd1f31cf76
[modules/yacs.git] / src / wrappergen / src / HXX2SALOME_GENERIC_CLASS_NAME_SRC / adm_local / unix / config_files / check_med2.m4
1 dnl  Copyright (C) 2006-2008  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.
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 AC_DEFUN([CHECK_MED2],[
20 AC_REQUIRE([AC_PROG_CC])dnl
21 AC_REQUIRE([AC_PROG_CPP])dnl
22 AC_REQUIRE([CHECK_HDF5])dnl
23 AC_REQUIRE([AC_DEPEND_FLAG])dnl
24
25 AC_CHECKING(for MED2)
26
27 AC_ARG_WITH(med2,
28     [  --with-med2=DIR                 root directory path to med2 installation ],
29     [MED2HOME="$withval"
30       AC_MSG_RESULT("select $withval as path to med2")
31     ])
32
33 AC_SUBST(MED2_INCLUDES)
34 AC_SUBST(MED2_LIBS)
35 AC_SUBST(MED2_MT_LIBS)
36
37 MED2_INCLUDES=""
38 MED2_LIBS=""
39 MED2_MT_LIBS=""
40
41 LOCAL_INCLUDES=""
42 LOCAL_LIBS=""
43
44 med2_ok=no
45
46 dnl check, if there is MED library
47 if test -z $MED2HOME
48 then
49    AC_MSG_WARN(undefined MED2HOME variable which specify med2 installation directory)
50    AC_PATH_PROG(MDUMP, mdump)
51    if test "xMDUMP" != "x" ; then
52       MED2HOME=$MDUMP
53       MED2HOME=`echo ${MED2HOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
54       MED2HOME=`echo ${MED2HOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
55    fi
56 fi
57 if test ! -z $MED2HOME
58 then
59    LOCAL_INCLUDES="$HDF5_INCLUDES -I$MED2HOME/include"
60    if test "x$MED2HOME" = "x/usr"
61    then
62      LOCAL_LIBS="-lmed $HDF5_LIBS"
63    else
64      LOCAL_LIBS="-L$MED2HOME/lib -lmed $HDF5_LIBS"
65    fi
66 fi
67
68 dnl check med2 header
69 CPPFLAGS_old="$CPPFLAGS"
70 CPPFLAGS="$CPPFLAGS -D$MACHINE $LOCAL_INCLUDES"
71 AC_CHECK_HEADER(med.h,med2_ok=yes ,med2_ok=no)
72 CPPFLAGS="$CPPFLAGS_old"
73
74 dnl check med2 library
75 if  test "x$med2_ok" = "xyes"
76 then
77   LIBS_old="$LIBS"
78   LIBS="$LIBS $LOCAL_LIBS"
79   AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
80   LIBS="$LIBS_old"
81 fi
82
83 if  test "x$med2_ok" = "xyes"
84 then
85   MED2_INCLUDES="-D$MACHINE $LOCAL_INCLUDES"
86   MED2_LIBS="$LOCAL_LIBS"
87   MED2_MT_LIBS="$LOCAL_LIBS"
88 fi
89
90 AC_MSG_RESULT(for med2: $med2_ok)
91
92 ])dnl