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