1 dnl Copyright (C) 2007-2016 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, or (at your option) any later version.
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_OLD="-L${NETGEN_HOME}/lib -lnglib"
81 NETGEN_LIBS_NEW="-L${NETGEN_HOME}/lib -lnglib -linterface -lgeom2d -lcsg -lstl -locc -lmesh"
83 dnl check Netgen headers availability
85 CPPFLAGS_old="$CPPFLAGS"
86 CXXFLAGS_old="$CXXFLAGS"
87 CPPFLAGS="$CAS_CPPFLAGS $NETGEN_INCLUDES $CPPFLAGS"
88 CXXFLAGS="$CAS_CXXFLAGS $NETGEN_INCLUDES $CXXFLAGS"
90 AC_MSG_CHECKING([for Netgen header file])
92 AC_CHECK_HEADER([nglib.h], [Netgen_ok=yes], [Netgen_ok=no])
94 dnl check Netgen libraries
96 NETGEN_LIBS=${NETGEN_LIBS_NEW}
99 LIBS="$NETGEN_LIBS $CAS_LDPATH -lTKernel -lTKMath -lTKG3d -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo -lTKGeomBase $LIBS_old"
101 if test "x$Netgen_ok" = "xyes"; then
103 AC_MSG_NOTICE([checking for Netgen libraries])
105 AC_MSG_CHECKING([libraries ... try new style ])
122 if test "x$Netgen_ok" = "xno" ; then
126 AC_MSG_CHECKING([libraries ... try old style])
128 NETGEN_LIBS=${NETGEN_LIBS_OLD}
129 LIBS="$NETGEN_LIBS $CAS_LDPATH -lTKernel -lTKMath -lTKG3d -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo -lTKGeomBase $LIBS_old"
150 dnl check if Netgen of v5 or v4
152 if test "$Netgen_ok" = "yes" ; then
156 AC_MSG_CHECKING([Netgen version])
166 #include <occgeom.hpp>
170 netgen::Mesh* ngMesh;
171 ngMesh->CalcLocalH(1.0);
179 dnl check OCCT support in Netgen
181 if test "$Netgen_ok" = "yes" ; then
185 AC_MSG_CHECKING([for OCCT support in Netgen library])
198 nglib::Ng_OCC_Geometry* ng_occ_geom = nglib::Ng_OCC_NewGeometry();
206 dnl check SALOME patch in Netgen
208 if test "$Netgen_ok" = "yes" ; then
212 AC_MSG_CHECKING([for SALOME patch in Netgen library])
222 #include <occgeom.hpp>
226 netgen::OCCGeometry occgeo;
235 CPPFLAGS="$CPPFLAGS_old"
236 CXXFLAGS="$CXXFLAGS_old"
240 if test "x$Netgen_ok" = xyes ; then
244 if test "x$NETGEN_V5" = "xyes" ; then
245 AC_MSG_RESULT([Netgen is of version 5.0 or newer])
246 NETGEN_INCLUDES="$NETGEN_INCLUDES -DNETGEN_V5"
248 AC_MSG_RESULT([Netgen is of version 4.9.13 or older])
254 AC_MSG_ERROR([Netgen is not properly installed. Read NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers for more details.])