1 dnl Copyright (C) 2007-2008 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 dnl ------------------------------------------------------------------------
24 dnl Adds the --with-vtk=path and --with-vtk-version configure options
26 AC_DEFUN([OPTIONS_VTK], [
28 [AC_HELP_STRING([--with-vtk], [The prefix where VTK is installed (default "" means taking from environment variable)])],
29 [with_vtk=$withval], [with_vtk=""])
31 AC_ARG_WITH([vtk-version],
32 [AC_HELP_STRING([--with-vtk-version], [VTK include directory name is vtk-suffix, e.g. vtk-5.0/. What is the suffix? (Default "yes" means taking from environment variable)])],
33 [vtk_suffix=$withval], [vtk_suffix="yes"])
35 AC_ARG_WITH([paraview],
36 [AC_HELP_STRING([--with-paraview], [ParaView from the specified location is used instead of VTK (default "" means ParaView should not be used)])])
41 dnl ------------------------------------------------------------------------
43 AC_DEFUN([CHECK_VTK], [
44 AC_REQUIRE([AC_PROG_CC])dnl
45 AC_REQUIRE([AC_PROG_CXX])dnl
46 AC_REQUIRE([AC_PROG_CPP])dnl
47 AC_REQUIRE([AC_PROG_CXXCPP])dnl
48 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
50 AC_REQUIRE([OPTIONS_VTK])dnl
57 AC_SUBST(VTK_INCLUDES)
59 AC_SUBST(VTKPY_MODULES)
67 if test "x$OpenGL_ok" != "xyes" ; then
68 AC_MSG_WARN(VTK needs OpenGL correct configuration, check configure output)
72 if test "x$x_libraries" != "x"
74 LXLIB="-L$x_libraries"
79 if test "x$x_libraries" = "x/usr/lib"
84 if test "x$x_libraries" = "x/usr/lib${LIB_LOCATION_SUFFIX}"
89 LOCAL_INCLUDES="$OGL_INCLUDES"
90 LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets $LXLIB -lX11 -lXt"
91 TRY_LINK_LIBS="-lvtkCommon $LXLIB -lX11 -lXt"
93 dnl VTK version suffix
94 if test -z $vtk_suffix ; then
97 if test "x$vtk_suffix" == "xno" ; then
98 dnl in case user wrote --with-vtk-version=no, use empty suffix
101 if test "x$vtk_suffix" != "xyes" ; then
102 VTKSUFFIX="$vtk_suffix"
104 dnl in case user wrote --with-vtk-version=yes, get the suffix from env
105 if test -z $VTKSUFFIX ; then
111 if test -z $with_vtk ; then
114 if test "x$with_vtk" = "xyes" ; then
115 dnl in case user wrote --with-vtk=yes
118 if test "x$with_vtk" = "xno" ; then
119 dnl in case user wrote --with-vtk=no
121 AC_MSG_WARN(Value "no", specified for option --with-vtk, is not supported)
124 if test "x$with_vtk" != "x" ; then
127 if test -z $VTKHOME ; then
128 AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
129 for d in /usr/local /usr ; do
130 if test -f ${d}/include/vtk${VTKSUFFIX}/vtkPlane.h ; then
131 AC_MSG_RESULT(trying ${d})
135 if test -f ${d}/include/vtk-5.0/vtkPlane.h ; then
136 AC_MSG_RESULT(trying ${d})
141 if test -f ${d}/include/vtk/vtkPlane.h ; then
142 AC_MSG_RESULT(trying ${d})
153 # Using regular VTK installation
154 if test "x$with_paraview" = "x" ; then
155 LOCAL_INCLUDES="-I$VTKHOME/include/vtk${VTKSUFFIX} $LOCAL_INCLUDES"
156 LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS"
157 TRY_LINK_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} -L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $TRY_LINK_LIBS"
158 if test "x$VTKHOME" != "x/usr" ; then
159 LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} $LOCAL_LIBS"
162 # VTK from ParaView overrides other VTK versions
163 if test "${with_paraview}" = "yes" ; then
164 if test -z $PVHOME ; then
168 PVHOME=${with_paraview}
171 if test -z $PVSRCHOME ; then
172 PVSRCHOME="$PVHOME/src"
175 if test -z $PVINSTALLHOME ; then
176 PVINSTALLHOME="$PVHOME/bin"
179 LOCAL_INCLUDES="-I$PVSRCHOME/VTK/Common -I$PVSRCHOME/VTK/Filtering -I$PVSRCHOME/VTK/GenericFiltering -I$PVSRCHOME/VTK/Graphics -I$PVSRCHOME/VTK/Hybrid -I$PVSRCHOME/VTK/Imaging -I$PVSRCHOME/VTK/Infovis -I$PVSRCHOME/VTK/IO -I$PVSRCHOME/VTK/Parallel -I$PVSRCHOME/VTK/Rendering -I$PVSRCHOME/VTK/Utilities -I$PVSRCHOME/VTK/Views -I$PVSRCHOME/VTK/VolumeRendering -I$PVSRCHOME/VTK/Widgets -I$PVINSTALLHOME/VTK -I$PVINSTALLHOME/VTK/Common -I$PVINSTALLHOME/VTK/Filtering -I$PVINSTALLHOME/VTK/GenericFiltering -I$PVINSTALLHOME/VTK/Graphics -I$PVINSTALLHOME/VTK/Hybrid -I$PVINSTALLHOME/VTK/Imaging -I$PVINSTALLHOME/VTK/Infovis -I$PVINSTALLHOME/VTK/IO -I$PVINSTALLHOME/VTK/Parallel -I$PVINSTALLHOME/VTK/Rendering -I$PVINSTALLHOME/VTK/Utilities -I$PVINSTALLHOME/VTK/Views -I$PVINSTALLHOME/VTK/VolumeRendering -I$PVINSTALLHOME/VTK/Widgets $LOCAL_INCLUDES"
180 LOCAL_LIBS="-L$PVINSTALLHOME/bin -lvtksys -lvtkzlib -lvtkpng -lvtkjpeg -lvtktiff -lvtkexpat -lvtksqlite -lvtkmetaio -lvtkverdict -lvtkNetCDF -lvtkDICOMParser -lvtkfreetype -lvtkftgl -lvtkexoIIc $LOCAL_LIBS"
181 TRY_LINK_LIBS="-L$PVINSTALLHOME/bin -lvtksys $TRY_LINK_LIBS"
185 CPPFLAGS_old="$CPPFLAGS"
186 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
188 AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
190 CPPFLAGS="$CPPFLAGS_old"
192 if test "x$vtk_ok" = "xyes"
194 VTK_INCLUDES="$LOCAL_INCLUDES"
198 AC_MSG_CHECKING(linking VTK library)
201 LIBS="$LIBS $TRY_LINK_LIBS"
202 #LIBS="$LIBS $LOCAL_LIBS"
203 CPPFLAGS_old="$CPPFLAGS"
204 CPPFLAGS="$CPPFLAGS $VTK_INCLUDES"
206 dnl VTKPY_MODULES="$VTKHOME/python"
208 AC_CACHE_VAL(salome_cv_lib_vtk,[
209 AC_TRY_LINK([#include "vtkPlane.h"
212 [salome_cv_lib_vtk=yes],
213 [salome_cv_lib_vtk=no])
215 vtk_ok="$salome_cv_lib_vtk"
217 CPPFLAGS="$CPPFLAGS_old"
220 if test "x$vtk_ok" = "xno"
223 AC_MSG_WARN(unable to link with vtk library)
226 VTK_LIBS="$LOCAL_LIBS"
227 VTK_MT_LIBS="$LOCAL_LIBS"
230 AC_MSG_RESULT(for VTK: $vtk_ok)