1 dnl Copyright (C) 2007-2011 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 ls -1d $PVHOME/include/paraview-* > /dev/null 2>&1
177 if test $? = 0 ; then
178 nb=$(ls -1d $PVHOME/include/paraview-* | wc -l)
179 if test $nb = 1 ; then
180 d=$(ls -1d $PVHOME/include/paraview-*)
181 PVVERSION=$(echo $d | awk -F "-" '{print $(NF)}')
185 if test "x$PVVERSION" = "x" ; then
186 PVVERSION=`basename $PVHOME | sed -e "s,[[^-]]*,,"`
188 if test "${PVVERSION:0:1}" != "-" ; then
189 PVVERSION="-$PVVERSION"
193 AC_CHECKING(for VTK from ParaView)
195 PV_LOCAL_INCLUDES="-I$PVHOME/include/paraview$PVVERSION $LOCAL_INCLUDES"
196 PV_LOCAL_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys -lvtkzlib -lvtkpng -lvtkjpeg -lvtktiff -lvtkexpat -lvtksqlite -lvtkmetaio -lvtkverdict -lvtkNetCDF -lvtkDICOMParser -lvtkfreetype -lvtkftgl -lvtkexoIIc $LOCAL_LIBS"
197 PV_TRY_LINK_LIBS="-L$PVHOME/lib/paraview$PVVERSION -lvtksys $TRY_LINK_LIBS"
200 CPPFLAGS_old="$CPPFLAGS"
201 CPPFLAGS="$CPPFLAGS $PV_LOCAL_INCLUDES"
203 AC_CHECK_HEADER(vtkPoints.h,pv_vtk_ok="yes",pv_vtk_ok="no")
205 CPPFLAGS="$CPPFLAGS_old"
207 if test "x$pv_vtk_ok" = "xyes"; then
211 AC_MSG_CHECKING(linking VTK library from ParaView)
214 LIBS="$LIBS $PV_TRY_LINK_LIBS"
215 CPPFLAGS_old="$CPPFLAGS"
216 CPPFLAGS="$CPPFLAGS $PV_LOCAL_INCLUDES"
218 AC_CACHE_VAL(salome_cv_lib_pvvtk,[
219 AC_TRY_LINK([#include "vtkPoints.h"
222 [salome_cv_lib_pvvtk=yes],
223 [salome_cv_lib_pvvtk=no])
225 pv_vtk_ok="$salome_cv_lib_pvvtk"
227 CPPFLAGS="$CPPFLAGS_old"
228 AC_MSG_RESULT($pv_vtk_ok)
231 dnl Find out version of VTK from ParaView
232 PVVTKVERSION=" Undefined"
233 if test "x$pv_vtk_ok" = "xyes"; then
234 AC_MSG_CHECKING(VTK version)
235 PVVTKVERSION=`grep VTK_VERSION $PVHOME/include/paraview$PVVERSION/vtkConfigure.h`
236 AC_MSG_RESULT(${PVVTKVERSION:20:10})
241 dnl Use regular VTK if no ParaView found or a newer version is provided via --with-vtk
245 if test "$pv_vtk_ok" = "no"; then
249 if test -z $with_vtk ; then
254 dnl in case user wrote --with-vtk=yes
258 dnl in case user wrote --with-vtk=no
260 AC_MSG_WARN(Value "no", specified for option --with-vtk, is not supported)
269 if test "$try_regular_vtk" = "yes"; then
271 dnl Check regular VTK installation
272 AC_CHECKING(for regular VTK)
276 if test "x$with_vtk" != "x" ; then
279 if test -z $VTKHOME ; then
280 AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
281 for d in /usr/local /usr ; do
282 if test -f ${d}/include/vtk${VTKSUFFIX}/vtkPlane.h ; then
283 AC_MSG_RESULT(trying ${d})
287 if test -f ${d}/include/vtk-5.0/vtkPlane.h ; then
288 AC_MSG_RESULT(trying ${d})
293 if test -f ${d}/include/vtk-5.2/vtkPlane.h ; then
294 AC_MSG_RESULT(trying ${d})
299 if test -f ${d}/include/vtk/vtkPlane.h ; then
300 AC_MSG_RESULT(trying ${d})
309 VTK_LOCAL_INCLUDES="-I$VTKHOME/include/vtk${VTKSUFFIX} $LOCAL_INCLUDES"
310 VTK_LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS"
311 VTK_TRY_LINK_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} -L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $TRY_LINK_LIBS"
312 if test "x$VTKHOME" != "x/usr" ; then
313 VTK_LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS"
317 CPPFLAGS_old="$CPPFLAGS"
318 CPPFLAGS="$CPPFLAGS $VTK_LOCAL_INCLUDES"
320 AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
322 CPPFLAGS="$CPPFLAGS_old"
324 if test "x$vtk_ok" = "xyes"; then
326 # VTK_INCLUDES="$LOCAL_INCLUDES"
330 AC_MSG_CHECKING(linking regular VTK library)
333 LIBS="$LIBS $VTK_TRY_LINK_LIBS"
334 CPPFLAGS_old="$CPPFLAGS"
335 CPPFLAGS="$CPPFLAGS $VTK_LOCAL_INCLUDES"
337 dnl VTKPY_MODULES="$VTKHOME/python"
339 AC_CACHE_VAL(salome_cv_lib_vtk,[
340 AC_TRY_LINK([#include "vtkPlane.h"
343 [salome_cv_lib_vtk=yes],
344 [salome_cv_lib_vtk=no])
346 vtk_ok="$salome_cv_lib_vtk"
348 CPPFLAGS="$CPPFLAGS_old"
349 AC_MSG_RESULT($vtk_ok)
352 VTKVERSION=" Undefined"
353 if test "x$vtk_ok" = "xyes"; then
354 AC_MSG_CHECKING(VTK version)
355 VTKVERSION=`grep VTK_VERSION $VTKHOME/include/vtk${VTKSUFFIX}/vtkConfigure.h`
356 AC_MSG_RESULT(${VTKVERSION:20:10})
360 dnl Select either of VTKs
361 if test "x$pv_vtk_ok" = "xyes" ; then
362 if test "x$vtk_ok" = "xyes" ; then
363 if test "$VTKVERSION" \> "$PVVTKVERSION" ; then
364 AC_MSG_RESULT([VTK from ParaView is older, ignored])
367 AC_MSG_RESULT([regular VTK is older, ignored])
373 if test "x$pv_vtk_ok" = "xyes" ; then
374 AC_MSG_RESULT(for VTK: yes)
375 VTK_INCLUDES="$PV_LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS"
376 VTK_LIBS="$PV_LOCAL_LIBS"
377 VTK_MT_LIBS="$VTK_LIBS"
381 if test "x$vtk_ok" = "xyes" ; then
382 AC_MSG_RESULT(for VTK: yes)
383 VTK_INCLUDES="$VTK_LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS"
384 VTK_LIBS="$VTK_LOCAL_LIBS"
385 VTK_MT_LIBS="$VTK_LIBS"
388 AC_MSG_RESULT(for VTK: no)
389 AC_MSG_WARN(unable to link with vtk library)