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