]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - adm_local/unix/config_files/check_BLSURF.m4
Salome HOME
Merge from BR_V5_DEV 17Feb09
[plugins/blsurfplugin.git] / adm_local / unix / config_files / check_BLSURF.m4
1 dnl  Copyright (C) 2007-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 dnl  File   : check_BLSURF.m4
20 dnl  Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
21
22 AC_DEFUN([CHECK_BLSURF],[
23
24 AC_REQUIRE([AC_PROG_CXX])dnl
25 AC_REQUIRE([AC_PROG_CXXCPP])dnl
26
27 AC_CHECKING(for BLSURF commercial product)
28
29 AC_LANG_SAVE
30 AC_LANG_CPLUSPLUS
31
32 BLSURF_INCLUDES=""
33 BLSURF_LIBS=""
34
35 AC_ARG_WITH(blsurf,
36             [  --with-blsurf=DIR       root directory path of BLSURF installation])
37
38 BLSURF_ok=no
39
40 if test "$with_blsurf" != "no" ; then
41   if test "$with_blsurf" == "yes" || test "$with_blsurf" == "auto"; then
42     BLSURF_HOME=""
43   else
44     BLSURF_HOME="$with_blsurf"
45   fi
46
47   if test "$BLSURF_HOME" == "" ; then
48     if test "x$BLSURFHOME" != "x" ; then
49       BLSURF_HOME=$BLSURFHOME
50     fi
51   fi
52
53   if test "x$BLSURF_HOME" != "x"; then
54
55     echo
56     echo -------------------------------------------------
57     echo You are about to choose to use somehow the
58     echo BLSURF commercial product to generate 2D mesh.
59     echo
60
61     BLSURF_INCLUDES="-I$BLSURF_HOME/include"
62     BLSURF_LIBS="-L$BLSURF_HOME/lib -lBLSurf"
63
64     CPPFLAGS_old="$CPPFLAGS"
65     CXXFLAGS_old="$CXXFLAGS"
66     CPPFLAGS="$BLSURF_INCLUDES $CPPFLAGS"
67     CXXFLAGS="$BLSURF_INCLUDES $CXXFLAGS"
68
69     AC_MSG_CHECKING(for BLSURF header file)
70
71     AC_CHECK_HEADER(distene/api.h,BLSURF_ok=yes,BLSURF_ok=no)
72
73     if test "x$BLSURF_ok" == "xyes"; then
74
75       AC_MSG_CHECKING(for BLSURF library)
76
77       LDFLAGS_old="$LDFLAGS"
78       LDFLAGS="-L. -$BLSURF_LIBS $LDFLAGS"
79
80       AC_TRY_LINK(
81         #include "distene/api.h",
82         BLSURF_init();,
83         BLSURF_ok=yes,BLSURF_ok=no
84         )
85
86       LDFLAGS="$LDFLAGS_old"
87
88       AC_MSG_RESULT($BLSURF_ok)
89     fi
90
91     CPPFLAGS="$CPPFLAGS_old"
92     CXXFLAGS="$CXXFLAGS_old"
93
94   fi
95 fi
96
97 if test "x$BLSURF_ok" == xno ; then
98   AC_MSG_RESULT(for BLSURF: no)
99   AC_MSG_WARN(BLSURF includes or libraries are not found or are not properly installed)
100   AC_MSG_WARN(Cannot build without BLSURF. Use --with-blsurf option to define BLSURF installation.)
101 else
102   AC_MSG_RESULT(for BLSURF: yes)
103 fi
104
105 AC_SUBST(BLSURF_INCLUDES)
106 AC_SUBST(BLSURF_LIBS)
107
108 AC_LANG_RESTORE
109
110 ])dnl