Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / adm_local / unix / config_files / check_fvm.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_FVM],[
23
24 AC_CHECKING(for FVM Library)
25
26 AC_LANG_SAVE
27 AC_LANG(C++)
28
29 FVM_INCLUDES=""
30 FVM_LIBSUFFIX=""
31 FVM_LIBS=""
32 ENABLE_FVM="no"
33
34 AC_CHECKING(for FVM location)
35 AC_ARG_WITH(fvm,
36             [  --with-fvm=DIR      root directory path to FVM library installation ],
37             [FVMDIR="$withval"
38              AC_MSG_RESULT("select $withval as path to FVM library")])
39
40 AC_MSG_RESULT(\$FVMDIR = ${FVMDIR})
41
42 CPPFLAGS_old="${CPPFLAGS}"
43 LIBS_old=$LIBS
44
45 if test "x${FVMDIR}" != "x" ; then
46   
47   CHECK_BFT
48   fvm_ok=no
49
50
51
52   if test "x${bft_ok}" = "xyes"; then
53       fvm_headers_ok=no
54       fvm_binaries_ok=no
55       FVM_INCLUDES="-I${FVMDIR}/include"
56       FVM_LIBS="-L${FVMDIR}/lib -lfvm ${BFT_LIBS} ${MPI_LIBS}"
57
58
59     dnl FVM headers
60       AC_CHECKING(for FVM headers)
61       CPPFLAGS="${CPPFLAGS_old} ${FVM_INCLUDES} ${MPI_CPPFLAGS} ${MED_CPPFLAGS}"
62
63       fvm_include_dir_ok=yes
64       if test "x${FVMDIR}" != "x" ; then
65         AC_CHECK_FILE(${FVMDIR}/include/fvm_nodal.h,
66                       fvm_include_dir_ok=yes,
67                       fvm_include_dir_ok=no)
68       fi
69
70       if test "x${fvm_include_dir_ok}" = "xyes" ; then
71         AC_TRY_COMPILE([#include <iostream>
72                       #include "fvm_nodal.h"],
73                        [fvm_nodal_create("",2)],
74                        fvm_headers_ok=yes,
75                        fvm_headers_ok=no)
76       fi
77
78       if test "x${fvm_headers_ok}" = "xno" ; then
79         FVM_INCLUDES="FVM_INCLUDES_NOT_DEFINED"
80       else
81         AC_MSG_RESULT(\$FVM_INCLUDES = ${FVM_INCLUDES})
82       fi
83       AC_MSG_RESULT(for fvm headers: $fvm_headers_ok)
84
85       if test "x${fvm_headers_ok}" = "xyes" ; then
86         dnl FVM binaries
87         AC_CHECKING(for FVM binaries)
88         fvm_lib_dir_ok=yes
89         if test "x${FVMDIR}" != "x" ; then
90           AC_CHECK_FILE(${FVMDIR}/lib/libfvm.so,
91                         fvm_lib_dir_ok=yes,
92                         fvm_lib_dir_ok=no)
93         fi
94
95       fi
96
97       CPPFLAGS="${CPPFLAGS_old}"
98       LIBS="${LIBS_old}"
99
100       if test "x${fvm_headers_ok}" = "xyes" ; then
101         if test "x${fvm_lib_dir_ok}" = "xyes" ; then
102           fvm_ok=yes
103           ENABLE_FVM="yes"
104         fi
105       fi
106
107      
108       AC_SUBST(FVM_INCLUDES)
109       AC_SUBST(FVM_LIBSUFFIX)
110       AC_SUBST(FVM_LIBS)
111                         AC_SUBST(ENABLE_FVM)
112   fi
113   AC_MSG_RESULT(for fvm: $fvm_ok)
114
115 fi
116
117 AC_LANG_RESTORE
118
119 ])dnl
120
121