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
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)
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 dnl VTK version suffix
89 if test -z $vtk_suffix ; then
92 if test "x$vtk_suffix" = "xno" ; then
93 dnl in case user wrote --with-vtk-version=no, use empty suffix
96 if test "x$vtk_suffix" != "xyes" ; then
97 VTKSUFFIX="$vtk_suffix"
99 dnl in case user wrote --with-vtk-version=yes, get the suffix from env
100 if test -z $VTKSUFFIX ; then
106 dnl Use VTK from ParaView unless --with-paraview=no is given
111 case "x$with_paraview" in
119 if test -z $PVHOME ; then
120 AC_PATH_PROG(para_path, paraview)
121 if test "x$para_path" != "x" ; then
122 para_path=`dirname $para_path`
123 PVHOME=`dirname $para_path`
125 for d in /usr/local /usr ; do
126 if test -f ${d}/include/paraview${PVVERSION}/pqDialog.h ; then
127 AC_MSG_RESULT(trying ${d})
131 for suffix in 3.98 4.0; do
132 if test -f ${d}/include/paraview-${suffix}/pqDialog.h ; then
133 AC_MSG_RESULT(trying ${d})
135 PVVERSION="-${suffix}"
139 if test "x${PVHOME}" != "x" ; then break ; fi
140 if test -f ${d}/include/paraview/pqDialog.h ; then
141 AC_MSG_RESULT(trying ${d})
152 PVHOME=${with_paraview}
156 dnl Check VTK from ParaView.
158 if test "x$PVHOME" != "x" ; then
160 if test "x$PVVERSION" = "x" ; then
161 for suffix in 3.98 4.0; do
162 if test -f $PVHOME/include/paraview-$suffix/vtkPVConfig.h ; then
168 if test "x$PVVERSION" = "x" ; then
169 ls -1d $PVHOME/include/paraview-* > /dev/null 2>&1
170 if test $? = 0 ; then
171 nb=$(ls -1d $PVHOME/include/paraview-* | wc -l)
172 if test $nb = 1 ; then
173 d=$(ls -1d $PVHOME/include/paraview-*)
174 PVVERSION=$(echo $d | awk -F "-" '{print $(NF)}')
178 if test "x$PVVERSION" = "x" ; then
179 PVVERSION=`basename $PVHOME | sed -e "s,[[^-]]*,,"`
181 if test "${PVVERSION:0:1}" != "-" ; then
182 PVVERSION="-$PVVERSION"
186 AC_CHECKING(for VTK from ParaView)
188 PV_LOCAL_INCLUDES="-I$PVHOME/include/paraview$PVVERSION $OGL_INCLUDES"
191 CPPFLAGS_old="$CPPFLAGS"
192 CPPFLAGS="$CPPFLAGS $PV_LOCAL_INCLUDES"
194 AC_CHECK_HEADER(vtkPoints.h,pv_vtk_ok="yes",pv_vtk_ok="no")
196 CPPFLAGS="$CPPFLAGS_old"
198 if test "x$pv_vtk_ok" = "xyes"; then
202 AC_MSG_CHECKING(linking VTK library from ParaView)
205 CPPFLAGS_old="$CPPFLAGS"
207 CPPFLAGS="$CPPFLAGS $PV_LOCAL_INCLUDES"
209 dnl - try libs without suffix
211 PV_LOCAL_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys -lvtkmetaio -lvtkverdict -lvtkNetCDF -lvtkDICOMParser -lvtkftgl -lvtkexoIIc -lvtkCommonCore -lvtkCommonDataModel -lvtkCommonExecutionModel -lvtkFiltersFlowPaths -lvtkFiltersParallel -lvtkFiltersVerdict -lvtkInteractionStyle -lvtkInteractionWidgets -lvtkIOExport -lvtkIOXML -lvtkRenderingAnnotation -lvtkRenderingCore -lvtkRenderingFreeType -lvtkRenderingFreeTypeOpenGL -lvtkRenderingLabel -lvtkRenderingLOD -lvtkRenderingOpenGL $LXLIB -lX11 -lXt"
212 PV_TRY_LINK_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys -lvtkCommonCore $LXLIB -lX11 -lXt"
214 LIBS="${LIBS_old} $PV_TRY_LINK_LIBS"
216 # AC_CACHE_VAL(salome_cv_lib_pvvtk,[
217 AC_TRY_LINK([#include "vtkPoints.h"
220 [salome_cv_lib_pvvtk=yes],
221 [salome_cv_lib_pvvtk=no])
224 if test "x$salome_cv_lib_pvvtk" != "yes" -a "x$PVVERSION" != "x" ; then
225 dnl - try libs with suffix
226 VTK_SUFFIX="-pv${PVVERSION:1:10}"
227 PV_LOCAL_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys${VTK_SUFFIX} -lvtkmetaio${VTK_SUFFIX} -lvtkverdict${VTK_SUFFIX} -lvtkNetCDF${VTK_SUFFIX} -lvtkDICOMParser${VTK_SUFFIX} -lvtkftgl${VTK_SUFFIX} -lvtkexoIIc${VTK_SUFFIX} -lvtkCommonCore${VTK_SUFFIX} -lvtkCommonDataModel${VTK_SUFFIX} -lvtkCommonExecutionModel${VTK_SUFFIX} -lvtkFiltersFlowPaths${VTK_SUFFIX} -lvtkFiltersParallel${VTK_SUFFIX} -lvtkFiltersVerdict${VTK_SUFFIX} -lvtkInteractionStyle${VTK_SUFFIX} -lvtkInteractionWidgets${VTK_SUFFIX} -lvtkIOExport${VTK_SUFFIX} -lvtkIOXML${VTK_SUFFIX} -lvtkRenderingAnnotation${VTK_SUFFIX} -lvtkRenderingCore${VTK_SUFFIX} -lvtkRenderingFreeType${VTK_SUFFIX} -lvtkRenderingFreeTypeOpenGL${VTK_SUFFIX} -lvtkRenderingLabel${VTK_SUFFIX} -lvtkRenderingLOD${VTK_SUFFIX} -lvtkRenderingOpenGL${VTK_SUFFIX} $LXLIB -lX11 -lXt"
228 PV_TRY_LINK_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys${VTK_SUFFIX} -lvtkCommonCore${VTK_SUFFIX} $LXLIB -lX11 -lXt"
230 LIBS="${LIBS_old} $PV_TRY_LINK_LIBS"
232 # AC_CACHE_VAL(salome_cv_lib_pvvtk,[
233 AC_TRY_LINK([#include "vtkPoints.h"
236 [salome_cv_lib_pvvtk=yes],
237 [salome_cv_lib_pvvtk=no])
241 pv_vtk_ok="$salome_cv_lib_pvvtk"
244 CPPFLAGS="$CPPFLAGS_old"
245 AC_MSG_RESULT($pv_vtk_ok)
248 dnl Find out version of VTK from ParaView
249 PVVTKVERSION=" Undefined"
250 if test "x$pv_vtk_ok" = "xyes"; then
251 AC_MSG_CHECKING(VTK version)
252 PVVTKVERSION=`grep VTK_VERSION $PVHOME/include/paraview$PVVERSION/vtkConfigure.h`
253 AC_MSG_RESULT(${PVVTKVERSION:20:10})
258 dnl Use regular VTK if no ParaView found or a newer version is provided via --with-vtk
262 if test "$pv_vtk_ok" = "no"; then
266 if test -z $with_vtk ; then
271 dnl in case user wrote --with-vtk=yes
275 dnl in case user wrote --with-vtk=no
277 AC_MSG_WARN(Value "no", specified for option --with-vtk, is not supported)
286 if test "$try_regular_vtk" = "yes"; then
288 dnl Check regular VTK installation
289 AC_CHECKING(for regular VTK)
293 if test "x$with_vtk" != "x" ; then
296 if test -z $VTKHOME ; then
297 AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
298 for d in /usr/local /usr ; do
299 if test -f ${d}/include/vtk${VTKSUFFIX}/vtkPlane.h ; then
300 AC_MSG_RESULT(trying ${d})
304 for suffix in 5.8 5.9 6.0 ; do
305 if test -f ${d}/include/vtk-${suffix}/vtkPlane.h ; then
306 AC_MSG_RESULT(trying ${d})
308 VTKSUFFIX="-${suffix}"
312 if test "x${VTKHOME}" != "x" ; then break ; fi
313 if test -f ${d}/include/vtk/vtkPlane.h ; then
314 AC_MSG_RESULT(trying ${d})
323 # VSR: is it necessary to check with suffix as for ParaView?
325 VTK_LOCAL_INCLUDES="-I$VTKHOME/include/vtk${VTKSUFFIX} $OGL_INCLUDES"
326 VTK_LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} -lvtkCommonCore -lvtkCommonDataModel -lvtkCommonExecutionModel -lvtkFiltersFlowPaths -lvtkFiltersParallel -lvtkFiltersVerdict -lvtkInteractionStyle -lvtkInteractionWidgets -lvtkIOExport -lvtkIOXML -lvtkRenderingAnnotation -lvtkRenderingCore -lvtkRenderingFreeType -lvtkRenderingFreeTypeOpenGL -lvtkRenderingLabel -lvtkRenderingLOD -lvtkRenderingOpenGL $LXLIB -lX11 -lXt"
327 VTK_TRY_LINK_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} -L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} -lvtkCommonCore $LXLIB -lX11 -lXt"
330 CPPFLAGS_old="$CPPFLAGS"
331 CPPFLAGS="$CPPFLAGS $VTK_LOCAL_INCLUDES"
333 AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
335 CPPFLAGS="$CPPFLAGS_old"
337 if test "x$vtk_ok" = "xyes"; then
339 # VTK_INCLUDES="$OGL_INCLUDES"
343 AC_MSG_CHECKING(linking regular VTK library)
346 LIBS="$LIBS $VTK_TRY_LINK_LIBS"
347 CPPFLAGS_old="$CPPFLAGS"
348 CPPFLAGS="$CPPFLAGS $VTK_LOCAL_INCLUDES"
350 AC_CACHE_VAL(salome_cv_lib_vtk,[
351 AC_TRY_LINK([#include "vtkPlane.h"
354 [salome_cv_lib_vtk=yes],
355 [salome_cv_lib_vtk=no])
357 vtk_ok="$salome_cv_lib_vtk"
359 CPPFLAGS="$CPPFLAGS_old"
360 AC_MSG_RESULT($vtk_ok)
363 VTKVERSION=" Undefined"
364 if test "x$vtk_ok" = "xyes"; then
365 AC_MSG_CHECKING(VTK version)
366 VTKVERSION=`grep VTK_VERSION $VTKHOME/include/vtk${VTKSUFFIX}/vtkConfigure.h`
367 AC_MSG_RESULT(${VTKVERSION:20:10})
371 dnl Select either of VTKs
372 if test "x$pv_vtk_ok" = "xyes" ; then
373 if test "x$vtk_ok" = "xyes" ; then
374 if test "$VTKVERSION" \> "$PVVTKVERSION" ; then
375 AC_MSG_RESULT([VTK from ParaView is older, ignored])
378 AC_MSG_RESULT([regular VTK is older, ignored])
384 if test "x$pv_vtk_ok" = "xyes" ; then
385 AC_MSG_RESULT(for VTK: yes)
386 VTK_INCLUDES="$PV_LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS"
387 VTK_LIBS="$PV_LOCAL_LIBS"
390 if test "x$vtk_ok" = "xyes" ; then
391 AC_MSG_RESULT(for VTK: yes)
392 VTK_INCLUDES="$VTK_LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS"
393 VTK_LIBS="$VTK_LOCAL_LIBS"
395 AC_MSG_RESULT(for VTK: no)
396 AC_MSG_WARN(unable to link with vtk library)
409 dnl CHECK_PYVTK (Python wrappings for VTK)
410 dnl ------------------------------------------------------------------------
412 AC_DEFUN([CHECK_PYVTK], [
413 AC_REQUIRE([AC_PROG_CC])dnl
414 AC_REQUIRE([AC_PROG_CXX])dnl
415 AC_REQUIRE([AC_PROG_CPP])dnl
416 AC_REQUIRE([AC_PROG_CXXCPP])dnl
417 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
418 AC_REQUIRE([CHECK_VTK])dnl
419 AC_REQUIRE([CHECK_PYTHON])dnl
427 if test "x$vtk_ok" != "x" ; then
428 PYVERSION=`echo ${PYTHON_VERSION} | sed -e "s%\.%%g"`
429 VTK_PYLIBS="-lvtkWrappingPython${PYVERSION}${VTK_SUFFIX}"