1 dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
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
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.
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.
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
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 AC_DEFUN([CHECK_NETGEN],[
25 AC_REQUIRE([AC_PROG_CXX])dnl
26 AC_REQUIRE([AC_PROG_CXXCPP])dnl
27 AC_REQUIRE([CHECK_CAS])dnl
29 AC_CHECKING([for Netgen])
35 [AC_HELP_STRING([--with-netgen=DIR], [root directory path to NETGEN library installation])],
36 [NETGEN_HOME=$withval],[NETGEN_HOME=yes])
42 AC_SUBST(NETGEN_INCLUDES)
47 if test "x$NETGEN_HOME" = "x" -o "x$NETGEN_HOME" = "xyes" -o "x$NETGEN_HOME" = "xauto" ; then
50 if test "x$NETGENHOME" != "x" ; then
51 # - by environment variable NETGENHOME
52 NETGEN_HOME=$NETGENHOME
54 # - by searching NETGEN executables
55 AC_PATH_PROG([TEMP], [ng_stl])
56 if test "x$TEMP" != "x" ; then
57 NETGEN_BIN_DIR=`dirname $TEMP`
58 NETGEN_HOME=`dirname $NETGEN_BIN_DIR`
65 echo NETGEN_HOME=$NETGEN_HOME
67 if test "x$NETGEN_HOME" != "x"; then
69 echo ----------------------------------------------------------
70 echo You are about to choose to use somehow the
71 echo Netgen Library to generate Tetrahedric mesh.
73 echo You are strongly advised to consult the file
74 echo NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers, particularly
75 echo about assumptions made on the installation of the Netgen
76 echo application and libraries.
77 echo ----------------------------------------------------------
79 NETGEN_INCLUDES="-I${NETGEN_HOME}/include -I${NETGEN_HOME}/share/netgen/include"
80 NETGEN_LIBS="-L${NETGEN_HOME}/lib -lnglib"
82 dnl check Netgen headers availability
84 CPPFLAGS_old="$CPPFLAGS"
85 CXXFLAGS_old="$CXXFLAGS"
86 CPPFLAGS="$CAS_CPPFLAGS $NETGEN_INCLUDES $CPPFLAGS"
87 CXXFLAGS="$CAS_CXXFLAGS $NETGEN_INCLUDES $CXXFLAGS"
89 AC_MSG_CHECKING([for Netgen header file])
91 AC_CHECK_HEADER([nglib.h], [Netgen_ok=yes], [Netgen_ok=no])
93 dnl check Netgen libraries
96 LIBS="$NETGEN_LIBS $CAS_LDPATH -lTKernel -lTKMath -lTKG3d -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo -lTKGeomBase $LIBS"
98 if test "x$Netgen_ok" = "xyes"; then
100 AC_MSG_CHECKING([for Netgen libraries])
102 AC_CACHE_VAL([salome_cv_netgen_lib],
115 [eval "salome_cv_netgen_lib=yes"],
116 [eval "salome_cv_netgen_lib=no"])
119 Netgen_ok="$salome_cv_netgen_lib"
123 dnl check if Netgen of v5 or v4
125 if test "$Netgen_ok" = "yes" ; then
129 AC_MSG_CHECKING([Netgen version])
131 AC_CACHE_VAL([salome_cv_netgen_v5_lib],
140 #include <occgeom.hpp>
144 netgen::Mesh* ngMesh;
145 ngMesh->CalcLocalH(1.0);
148 [eval "salome_cv_netgen_v5_lib=yes"],
149 [eval "salome_cv_netgen_v5_lib=no"])
152 if test "x$salome_cv_netgen_v5_lib" = "xyes" ; then
157 dnl check OCCT support in Netgen
159 if test "$Netgen_ok" = "yes" ; then
163 AC_MSG_CHECKING([for OCCT support in Netgen library])
165 AC_CACHE_VAL([salome_cv_netgen_occ_lib],
177 nglib::Ng_OCC_Geometry* ng_occ_geom = nglib::Ng_OCC_NewGeometry();
180 [eval "salome_cv_netgen_occ_lib=yes"],
181 [eval "salome_cv_netgen_occ_lib=no"])
184 Netgen_ok="$salome_cv_netgen_occ_lib"
188 dnl check SALOME patch in Netgen
190 if test "$Netgen_ok" = "yes" ; then
194 AC_MSG_CHECKING([for SALOME patch in Netgen library])
196 AC_CACHE_VAL([salome_cv_netgen_salome_patch_lib],
205 #include <occgeom.hpp>
209 netgen::OCCGeometry occgeo;
212 [eval "salome_cv_netgen_salome_patch_lib=yes"],
213 [eval "salome_cv_netgen_salome_patch_lib=no"])
216 Netgen_ok="$salome_cv_netgen_salome_patch_lib"
221 CPPFLAGS="$CPPFLAGS_old"
222 CXXFLAGS="$CXXFLAGS_old"
226 if test "x$Netgen_ok" = xyes ; then
230 if test "x$NETGEN_V5" = "xyes" ; then
231 AC_MSG_RESULT([Netgen is of version 5.0 or newer])
232 NETGEN_INCLUDES="$NETGEN_INCLUDES -DNETGEN_V5"
234 AC_MSG_RESULT([Netgen is of version 4.9.13 or older])
240 AC_MSG_ERROR([Netgen is not properly installed. Read NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers for more details.])