Salome HOME
78ca1f1ffd92375e092e4f63d2e9f6790dd7205f
[modules/med.git] / adm_local / unix / config_files / check_bft.m4
1 dnl Copyright (C) 2007-2021  CEA/DEN, EDF R&D, 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_BFT],[
21
22 AC_CHECKING(for BFT Library)
23
24 AC_LANG_SAVE
25 AC_LANG(C++)
26
27 BFT_INCLUDES=""
28 BFT_LIBSUFFIX=""
29 BFT_LIBS=""
30
31 AC_CHECKING(for BFT location)
32 AC_ARG_WITH(bft,
33             [  --with-bft=DIR      root directory path to BFT library installation ],
34             [BFTDIR="$withval"
35              AC_MSG_RESULT("select $withval as path to BFT library")])
36
37 AC_MSG_RESULT(\$BFTDIR = ${BFTDIR})
38
39 CPPFLAGS_old="${CPPFLAGS}"
40 LIBS_old=$LIBS
41
42 if test "x${BFTDIR}" != "x" ; then
43   BFT_INCLUDES="-I${BFTDIR}/include"
44   BFT_LIBS="-L${BFTDIR}/lib -lbft"
45 fi
46
47 bft_ok=no
48 bft_headers_ok=no
49 bft_binaries_ok=no
50
51 dnl BFT headers
52 AC_CHECKING(for BFT headers)
53 CPPFLAGS="${CPPFLAGS_old} ${BFT_INCLUDES} ${MPI_CPPFLAGS} ${MED_CPPFLAGS}"
54
55 bft_include_dir_ok=yes
56 if test "x${BFTDIR}" != "x" ; then
57   AC_CHECK_FILE(${BFTDIR}/include/bft_mem.h,
58                 bft_include_dir_ok=yes,
59                 bft_include_dir_ok=no)
60 fi
61
62 if test "x${bft_include_dir_ok}" = "xyes" ; then
63   AC_TRY_COMPILE([ #include "bft_mem.h"],
64                  [bft_mem_init("")],
65                  bft_headers_ok=yes,
66                  bft_headers_ok=no)
67 fi
68
69 if test "x${bft_headers_ok}" = "xno" ; then
70   BFT_INCLUDES="BFT_INCLUDES_NOT_DEFINED"
71 else
72   AC_MSG_RESULT(\$BFT_INCLUDES = ${BFT_INCLUDES})
73 fi
74 AC_MSG_RESULT(for bft headers: $bft_headers_ok)
75
76 if test "x${bft_headers_ok}" = "xyes" ; then
77   dnl BFT binaries
78   AC_CHECKING(for BFT binaries)
79   bft_lib_dir_ok=yes
80   if test "x${BFTDIR}" != "x" ; then
81     AC_CHECK_FILE(${BFTDIR}/lib/libbft.so,
82                   bft_lib_dir_ok=yes,
83                   bft_lib_dir_ok=no)
84   fi
85
86 fi
87
88 CPPFLAGS="${CPPFLAGS_old}"
89 LIBS="${LIBS_old}"
90
91 if test "x${bft_headers_ok}" = "xyes" ; then
92   if test "x${bft_lib_dir_ok}" = "xyes" ; then
93     bft_ok=yes
94   fi
95 fi
96
97 AC_MSG_RESULT(for bft: $bft_ok)
98
99 AC_SUBST(BFT_INCLUDES)
100 AC_SUBST(BFT_LIBSUFFIX)
101 AC_SUBST(BFT_LIBS)
102
103 AC_LANG_RESTORE
104
105 ])dnl
106
107