1 dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 dnl This library is free software; you can redistribute it and/or
5 dnl modify it under the terms of the GNU Lesser General Public
6 dnl License as published by the Free Software Foundation; either
7 dnl version 2.1 of the License.
9 dnl This library is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 dnl Lesser General Public License for more details.
14 dnl You should have received a copy of the GNU Lesser General Public
15 dnl License along with this library; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 AC_DEFUN([CHECK_CAS],[
23 AC_REQUIRE([AC_PROG_CXX])dnl
24 AC_REQUIRE([AC_PROG_CXXCPP])dnl
26 AC_CHECKING(for OpenCascade)
31 AC_SUBST(CAS_CPPFLAGS)
32 AC_SUBST(CAS_CXXFLAGS)
37 AC_SUBST(CAS_DATAEXCHANGE)
40 AC_SUBST(CAS_STDPLUGIN)
48 dnl libraries directory location
73 AC_MSG_CHECKING(for OpenCascade directories)
75 if test -z $CASROOT; then
76 AC_MSG_RESULT(CASROOT not defined)
77 for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
78 if test -f $d/libTKernel.so ; then
79 AC_MSG_RESULT(libTKernel.so detected in $d)
81 CASROOT=`echo ${CASROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
87 if test -d ${CASROOT}/${casdir}/lib; then
88 CAS_LDPATH="-L$CASROOT/$casdir/lib "
91 if test -d ${CASROOT}/lib; then
92 CAS_LDPATH="-L$CASROOT/lib "
101 if test -z $CASROOT; then
102 AC_MSG_WARN(You must provide CASROOT variable : see OCC installation manual)
107 ff=$CASROOT/inc/Standard_Version.hxx
108 if test -f $ff ; then
109 grep "define OCC_VERSION_MAJOR" $ff > /dev/null
110 if test $? = 0 ; then
111 OCC_VERSION_MAJOR=`grep "define OCC_VERSION_MAJOR" $ff | awk '{i=3 ; print $i}'`
113 grep "define OCC_VERSION_MINOR" $ff > /dev/null
114 if test $? = 0 ; then
115 OCC_VERSION_MINOR=`grep "define OCC_VERSION_MINOR" $ff | awk '{i=3 ; print $i}'`
120 if test "x$occ_ok" = "xyes"; then
122 dnl test c++ compiler flag for unsigned character
123 for opt in -funsigned-char -unsigned ; do
124 AC_CXX_OPTION($opt,CAS_CXXFLAGS,flag=yes,flag=no)
125 if test "$flag" = "yes"; then
132 CPPFLAGS_old="$CPPFLAGS"
135 CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc"
138 CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc"
141 CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS"
143 if test -n $KERNEL_ROOT_DIR; then
144 if test -d $KERNEL_ROOT_DIR/include/salome; then
145 CAS_CPPFLAGS="$CAS_CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome"
146 CPPFLAGS="$CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome"
149 CAS_CPPFLAGS="$CAS_CPPFLAGS -I${ROOT_BUILDDIR}/include/salome"
150 CPPFLAGS="$CPPFLAGS -I${ROOT_BUILDDIR}/salome_adm/unix"
153 echo testing config.h
155 AC_CHECK_HEADER(config.h, config_h=yes, [
156 echo "config.h file not found!"
159 if test "x$config_h" = xno ; then
160 AC_MSG_WARN(config.h file not found)
161 dnl There is no consequence for SALOME building because
162 dnl this file is not used. SALOME uses SALOMEconfig.h instead!
164 AC_MSG_RESULT(config.h file ok)
167 AC_CHECK_HEADER(Standard_Type.hxx,occ_ok=yes ,occ_ok=no)
171 if test "x$occ_ok" = xyes ; then
173 AC_MSG_CHECKING(for OpenCascade libraries)
176 LIBS="$LIBS $CAS_LDPATH -lTKernel"
178 AC_CACHE_VAL(salome_cv_lib_occ,[
180 #include <Standard_Type.hxx>
182 const Standard_CString aName="toto";
183 Standard_Type myST(aName) ;
185 eval "salome_cv_lib_occ=yes",eval "salome_cv_lib_occ=no")
187 occ_ok="$salome_cv_lib_occ"
190 CPPFLAGS="$CPPFLAGS_old"
193 if test "x$occ_ok" = xno ; then
195 AC_MSG_WARN(Opencascade libraries not found)
198 CAS_KERNEL="$CAS_LDPATH -lTKernel -lTKMath"
200 # E.A. compatibility version 4 and 5.x
201 CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKPShape -lTKCDF -lTKCAF -lTKShapeSchema -lTKPCAF -lFWOSPlugin -lTKStdSchema"
202 if test $OCC_VERSION_MAJOR -lt 5 ; then
203 CAS_OCAF="$CAS_OCAF -lTKPAppStd"
205 if test -f $CASROOT/$casdir/lib/libPAppStdPlugin.so ; then
206 # this library is absent in CASCADE 5.2.3
207 CAS_OCAF="$CAS_OCAF -lPAppStdPlugin"
208 CAS_STDPLUGIN="PAppStdPlugin"
210 if test -f $CASROOT/$casdir/lib/libStdPlugin.so ; then
211 # this libraries are only for CASCADE 5.2.3
212 CAS_STDPLUGIN="StdPlugin"
213 CAS_OCAF="$CAS_OCAF -lStdPlugin -lStdLPlugin -lTKLCAF -lTKPLCAF -lTKStdLSchema"
216 CAS_VIEWER="$CAS_LDPATH -lTKOpenGl -lTKV3d -lTKService"
217 CAS_MODELER="$CAS_LDPATH -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBO -lTKBool -lTKHLR -lTKFillet -lTKOffset -lTKFeat"
219 # E.A. compatibility version 4 and 5.x
220 CAS_DATAEXCHANGE="$CAS_LDPATH -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing"
221 if test $OCC_VERSION_MAJOR -lt 5 ; then
222 CAS_DATAEXCHANGE="$CAS_DATAEXCHANGE -lTKShHealingStd"
226 CAS_LDFLAGS="$CAS_KERNEL $CAS_OCAF $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE"