1 dnl Copyright (C) 2007-2010 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
24 dnl ------------------------------------------------------------------------
25 dnl Adds the --with-vtk=path, --with-vtk-version and --with-paraview configure options
27 AC_DEFUN([OPTIONS_VTK], [
29 [AC_HELP_STRING([--with-vtk], [The prefix where VTK is installed (default "" means taking from environment variable unless VTK from ParaView is detected)])],
30 [with_vtk=$withval], [with_vtk=""])
32 AC_ARG_WITH([vtk-version],
33 [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)])],
34 [vtk_suffix=$withval], [vtk_suffix="yes"])
36 AC_ARG_WITH([paraview],
37 [AC_HELP_STRING([--with-paraview], [ParaView from the specified location is used instead of VTK (default "" means taking from environment variable)])])
42 dnl ------------------------------------------------------------------------
44 AC_DEFUN([CHECK_VTK], [
45 AC_REQUIRE([AC_PROG_CC])dnl
46 AC_REQUIRE([AC_PROG_CXX])dnl
47 AC_REQUIRE([AC_PROG_CPP])dnl
48 AC_REQUIRE([AC_PROG_CXXCPP])dnl
49 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
51 AC_REQUIRE([OPTIONS_VTK])dnl
56 AC_SUBST(VTK_INCLUDES)
58 AC_SUBST(VTKPY_MODULES)
66 if test "x$OpenGL_ok" != "xyes" ; then
67 AC_MSG_WARN(VTK needs OpenGL correct configuration, check configure output)
71 if test "x$x_libraries" != "x"
73 LXLIB="-L$x_libraries"
78 if test "x$x_libraries" = "x/usr/lib"
83 if test "x$x_libraries" = "x/usr/lib${LIB_LOCATION_SUFFIX}"
88 LOCAL_INCLUDES="$OGL_INCLUDES"
89 LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets $LXLIB -lX11 -lXt"
90 TRY_LINK_LIBS="-lvtkCommon $LXLIB -lX11 -lXt"
92 dnl VTK version suffix
93 if test -z $vtk_suffix ; then
96 if test "x$vtk_suffix" = "xno" ; then
97 dnl in case user wrote --with-vtk-version=no, use empty suffix
100 if test "x$vtk_suffix" != "xyes" ; then
101 VTKSUFFIX="$vtk_suffix"
103 dnl in case user wrote --with-vtk-version=yes, get the suffix from env
104 if test -z $VTKSUFFIX ; then
110 dnl Use VTK from ParaView unless --with-paraview=no is given
115 case "x$with_paraview" in
123 if test -z $PVHOME ; then
124 AC_PATH_PROG(para_path, paraview)
125 if test "x$para_path" != "x" ; then
126 para_path=`dirname $para_path`
127 PVHOME=`dirname $para_path`
129 for d in /usr/local /usr ; do
130 if test -f ${d}/include/paraview${PVVERSION}/pqDialog.h ; then
131 AC_MSG_RESULT(trying ${d})
135 if test -f ${d}/include/paraview-3.7/pqDialog.h ; then
136 AC_MSG_RESULT(trying ${d})
141 if test -f ${d}/include/paraview-3.8/pqDialog.h ; then
142 AC_MSG_RESULT(trying ${d})
147 if test -f ${d}/include/paraview/pqDialog.h ; then
148 AC_MSG_RESULT(trying ${d})
159 PVHOME=${with_paraview}
163 dnl Check VTK from ParaView.
165 if test "x$PVHOME" != "x" ; then
167 if test "x$PVVERSION" = "x" ; then
168 for suffix in 3.7 3.8 ; do
169 if test -f $PVHOME/include/paraview-$suffix/vtkPVConfig.h ; then
175 if test "x$PVVERSION" = "x" ; then
176 PVVERSION=`basename $PVHOME | sed -e "s,[[^-]]*,,"`
178 if test "${PVVERSION:0:1}" != "-" ; then
179 PVVERSION="-$PVVERSION"
183 AC_CHECKING(for VTK from ParaView)
185 PV_LOCAL_INCLUDES="-I$PVHOME/include/paraview$PVVERSION $LOCAL_INCLUDES"
186 PV_LOCAL_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys -lvtkzlib -lvtkpng -lvtkjpeg -lvtktiff -lvtkexpat -lvtksqlite -lvtkmetaio -lvtkverdict -lvtkNetCDF -lvtkDICOMParser -lvtkfreetype -lvtkftgl -lvtkexoIIc $LOCAL_LIBS"
187 PV_TRY_LINK_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys $TRY_LINK_LIBS"
190 CPPFLAGS_old="$CPPFLAGS"
191 CPPFLAGS="$CPPFLAGS $PV_LOCAL_INCLUDES"
193 AC_CHECK_HEADER(vtkPoints.h,pv_vtk_ok="yes",pv_vtk_ok="no")
195 CPPFLAGS="$CPPFLAGS_old"
197 if test "x$pv_vtk_ok" = "xyes"; then
201 AC_MSG_CHECKING(linking VTK library from ParaView)
204 LIBS="$LIBS $PV_TRY_LINK_LIBS"
205 CPPFLAGS_old="$CPPFLAGS"
206 CPPFLAGS="$CPPFLAGS $PV_LOCAL_INCLUDES"
208 AC_CACHE_VAL(salome_cv_lib_pvvtk,[
209 AC_TRY_LINK([#include "vtkPoints.h"
212 [salome_cv_lib_pvvtk=yes],
213 [salome_cv_lib_pvvtk=no])
215 pv_vtk_ok="$salome_cv_lib_pvvtk"
217 CPPFLAGS="$CPPFLAGS_old"
218 AC_MSG_RESULT($pv_vtk_ok)
221 dnl Find out version of VTK from ParaView
222 PVVTKVERSION=" Undefined"
223 if test "x$pv_vtk_ok" = "xyes"; then
224 AC_MSG_CHECKING(VTK version)
225 PVVTKVERSION=`grep VTK_VERSION $PVHOME/include/paraview$PVVERSION/vtkConfigure.h`
226 AC_MSG_RESULT(${PVVTKVERSION:20:10})
231 dnl Use regular VTK if no ParaView found or a newer version is provided via --with-vtk
235 if test "$pv_vtk_ok" = "no"; then
239 if test -z $with_vtk ; then
244 dnl in case user wrote --with-vtk=yes
248 dnl in case user wrote --with-vtk=no
250 AC_MSG_WARN(Value "no", specified for option --with-vtk, is not supported)
259 if test "$try_regular_vtk" = "yes"; then
261 dnl Check regular VTK installation
262 AC_CHECKING(for regular VTK)
266 if test "x$with_vtk" != "x" ; then
269 if test -z $VTKHOME ; then
270 AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
271 for d in /usr/local /usr ; do
272 if test -f ${d}/include/vtk${VTKSUFFIX}/vtkPlane.h ; then
273 AC_MSG_RESULT(trying ${d})
277 if test -f ${d}/include/vtk-5.0/vtkPlane.h ; then
278 AC_MSG_RESULT(trying ${d})
283 if test -f ${d}/include/vtk-5.2/vtkPlane.h ; then
284 AC_MSG_RESULT(trying ${d})
289 if test -f ${d}/include/vtk/vtkPlane.h ; then
290 AC_MSG_RESULT(trying ${d})
299 VTK_LOCAL_INCLUDES="-I$VTKHOME/include/vtk${VTKSUFFIX} $LOCAL_INCLUDES"
300 VTK_LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS"
301 VTK_TRY_LINK_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} -L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $TRY_LINK_LIBS"
302 if test "x$VTKHOME" != "x/usr" ; then
303 VTK_LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS"
307 CPPFLAGS_old="$CPPFLAGS"
308 CPPFLAGS="$CPPFLAGS $VTK_LOCAL_INCLUDES"
310 AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
312 CPPFLAGS="$CPPFLAGS_old"
314 if test "x$vtk_ok" = "xyes"; then
316 # VTK_INCLUDES="$LOCAL_INCLUDES"
320 AC_MSG_CHECKING(linking regular VTK library)
323 LIBS="$LIBS $VTK_TRY_LINK_LIBS"
324 CPPFLAGS_old="$CPPFLAGS"
325 CPPFLAGS="$CPPFLAGS $VTK_LOCAL_INCLUDES"
327 dnl VTKPY_MODULES="$VTKHOME/python"
329 AC_CACHE_VAL(salome_cv_lib_vtk,[
330 AC_TRY_LINK([#include "vtkPlane.h"
333 [salome_cv_lib_vtk=yes],
334 [salome_cv_lib_vtk=no])
336 vtk_ok="$salome_cv_lib_vtk"
338 CPPFLAGS="$CPPFLAGS_old"
339 AC_MSG_RESULT($vtk_ok)
342 VTKVERSION=" Undefined"
343 if test "x$vtk_ok" = "xyes"; then
344 AC_MSG_CHECKING(VTK version)
345 VTKVERSION=`grep VTK_VERSION $VTKHOME/include/vtk${VTKSUFFIX}/vtkConfigure.h`
346 AC_MSG_RESULT(${VTKVERSION:20:10})
350 dnl Select either of VTKs
351 if test "x$pv_vtk_ok" = "xyes" ; then
352 if test "x$vtk_ok" = "xyes" ; then
353 if test "$VTKVERSION" \> "$PVVTKVERSION" ; then
354 AC_MSG_RESULT([VTK from ParaView is older, ignored])
357 AC_MSG_RESULT([regular VTK is older, ignored])
363 if test "x$pv_vtk_ok" = "xyes" ; then
364 AC_MSG_RESULT(for VTK: yes)
365 VTK_INCLUDES="$PV_LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS"
366 VTK_LIBS="$PV_LOCAL_LIBS"
367 VTK_MT_LIBS="$VTK_LIBS"
371 if test "x$vtk_ok" = "xyes" ; then
372 AC_MSG_RESULT(for VTK: yes)
373 VTK_INCLUDES="$VTK_LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS"
374 VTK_LIBS="$VTK_LOCAL_LIBS"
375 VTK_MT_LIBS="$VTK_LIBS"
378 AC_MSG_RESULT(for VTK: no)
379 AC_MSG_WARN(unable to link with vtk library)