source: ThirdParty/vmg/m4/am_path_vtk.m4@ 79b089

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_vmg TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 79b089 was 7faa5c, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit 'de061d9d851257a04e924d4472df4523d33bb08b' as 'ThirdParty/vmg'

  • Property mode set to 100644
File size: 6.8 KB
RevLine 
[de061d]1dnl ======================================================================================
2dnl Author: Francesco Montorsi
3dnl RCS-ID: $Id: vtk.m4,v 1.1 2005/11/20 14:47:40 frm Exp $
4dnl
5dnl Implements the AM_OPTIONS_VTK, to add the --with-vtk=path option, and the
6dnl AM_PATH_VTK macro used to detect VTK presence, location and version.
7dnl ======================================================================================
8
9
10
11dnl
12dnl AM_OPTIONS_VTK
13dnl ------------------------------------------------------------------------
14dnl Adds the --with-vtk=path option to the configure options
15dnl Adds the --with-vtk-libdir=path option to the configure options
16dnl
17AC_DEFUN([AM_OPTIONS_VTK],
18[
19 AC_ARG_WITH([vtk],
20 [AC_HELP_STRING([--with-vtk],
21 [The prefix where VTK is installed (default is /usr)])],
22 [with_vtk=$withval],
23 [with_vtk="/usr"])
24
25 AC_ARG_WITH([vtklibdir],
26 [AC_HELP_STRING([--with-vtk-libdir],
27 [The prefix where VTK libs areA installed (default is /usr/lib)])],
28 [with_vtk_libdir=$withval],
29 [with_vtk_libdir="/usr/lib"])
30
31 AC_ARG_WITH([vtk-version],
32 [AC_HELP_STRING([--with-vtk-version],
33 [VTK's include directory name is vtk-suffix, e.g. vtk-5.0/. What's the suffix? (Default -5.0)])],
34 [vtk_suffix=$withval],
35 [vtk_suffix="-5.0"])
36
37])# AM_OPTIONS_VTK
38
39
40
41dnl
42dnl AM_PATH_VTK([minimum-version], [action-if-found], [action-if-not-found])
43dnl ------------------------------------------------------------------------
44dnl
45dnl NOTE: [minimum-version] must be in the form [X.Y.Z]
46dnl
47AC_DEFUN([AM_PATH_VTK],
48[
49 dnl do we want to check for VTK ?
50 if test "$with_vtk" = "yes"; then
51 dnl in case user wrote --with-vtk=yes
52 with_vtk="/usr/local"
53 fi
54
55 if test "$with_vtk" != "no"; then
56 dnl
57 dnl A path was provided in $with_vtk...try hard to find the VTK library {{{
58 VTK_PREFIX="$with_vtk"
59
60 vtk_save_CPPFLAGS=$CPPFLAGS
61 CPPFLAGS="$CPPFLAGS -I$VTK_PREFIX/include/vtk$vtk_suffix"
62 AC_CHECK_HEADER([vtkCommonInstantiator.h], [vtkFound="OK"])
63 CPPFLAGS=$vtk_save_CPPFLAGS
64 AC_MSG_CHECKING([if VTK is installed in $VTK_PREFIX])
65
66 if test -z "$vtkFound"; then
67 dnl
68 dnl VTK was not found! ...execute $3 unconditionally {{{
69 AC_MSG_RESULT([no])
70 $3
71 dnl }}}
72 dnl
73 else
74 dnl
75 dnl VTK was found! ...execute $2 if version matches {{{
76 AC_MSG_RESULT([yes])
77
78 dnl these are the VTK libraries of a default build
79 VTK_LIBS="-lvtkDICOMParser -lvtkFiltering -lvtkftgl -lvtkGraphics -lvtkHybrid -lvtkImaging -lvtkIO -lvtkRendering -lvtkCommon -lvtksys"
80
81 dnl set VTK c,cpp,ld flags
82 VTK_CFLAGS="-I$VTK_PREFIX/include/vtk$vtk_suffix"
83 VTK_CXXFLAGS="$VTK_CFLAGS"
84
85 dnl now, eventually check version {{{
86 if test -n "$1"; then
87 dnl
88 dnl A version was specified... parse the version string in $1 {{{
89
90 dnl The version of VTK that we need: {{{
91 maj=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
92 min=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
93 rel=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
94 AC_MSG_CHECKING([if VTK version is at least $maj.$min.$rel])
95 dnl }}}
96
97 dnl Compare required version of VTK against installed version: {{{
98 dnl
99 dnl Note that in order to be able to compile the following test program,
100 dnl we need to add to the current flags, the VTK settings...
101 OLD_CFLAGS=$CFLAGS
102 OLD_CXXFLAGS=$CXXFLAGS
103 OLD_LDFLAGS=$LDFLAGS
104 CFLAGS="$VTK_CFLAGS $CFLAGS"
105 CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
106 LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
107 dnl
108 dnl check if the installed VTK is greater or not
109 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
110 [
111 #include <vtkConfigure.h>
112 #include <stdio.h>
113 ],
114 [
115 printf("VTK version is: %d.%d.%d", VTK_MAJOR_VERSION, VTK_MINOR_VERSION, VTK_BUILD_VERSION);
116 #if VTK_MAJOR_VERSION < $maj
117 #error Installed VTK is too old !
118 #endif
119 #if VTK_MAJOR_VERSION == $maj && VTK_MINOR_VERSION < $min
120 #error Installed VTK is too old !
121 #endif
122 #if VTK_MAJOR_VERSION == $maj && VTK_MINOR_VERSION == $min && VTK_BUILD_VERSION < $rel
123 #error Installed VTK is too old !
124 #endif
125 ])
126 ], [vtkVersion="OK"])
127 dnl
128 if test "$vtkVersion" = "OK"; then
129 AC_MSG_RESULT([yes])
130 else
131 AC_MSG_RESULT([no])
132 fi
133 dnl restore all flags without VTK values
134 CFLAGS=$OLD_CFLAGS
135 CXXFLAGS=$OLD_CXXFLAGS
136 LDFLAGS=$OLD_LDFLAGS
137 dnl }}}
138 else :
139 dnl
140 dnl A target version number was not provided... execute $2 unconditionally {{{
141
142 dnl if we don't have to check for minimum version (because the user did not set that option),
143 dnl then we can execute here the block action-if-found
144 #CFLAGS="$VTK_CFLAGS $CFLAGS"
145 #CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
146 #LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
147 skiplinktest="OK"
148 $2
149 dnl }}}
150 dnl
151 fi
152 dnl }}}
153
154 dnl }}}
155 dnl
156 if test ! "$skiplinktest" = "OK"; then
157 for libfolder in $with_vtk_libdir /usr/lib $VTK_PREFIX/lib/vtk$vtk_suffix /usr/local/lib; do
158 VTK_LDFLAGS="-L$libfolder -Wl,-rpath=$libfolder"
159 dnl Execute $2 if version is ok, otherwise execute $3 {{{
160 OLD_CFLAGS=$CFLAGS
161 OLD_CXXFLAGS=$CXXFLAGS
162 OLD_LDFLAGS=$LDFLAGS
163 OLD_LIBS=$LIBS
164 CFLAGS="$VTK_CFLAGS $CFLAGS"
165 CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
166 LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
167 LIBS="$VTK_LIBS $LIBS"
168 if test "$vtkVersion" = "OK"; then
169 AC_MSG_CHECKING([linking with VTK libs in folder $libfolder])
170 AC_LINK_IFELSE([AC_LANG_PROGRAM(
171 [
172#include <vtkAbstractArray.h>
173#include <vtkImageData.h>
174#include <vtkPointData.h>
175#include <vtkSmartPointer.h>
176#include <vtkXMLImageDataWriter.h>
177 ],
178 [
179 vtkSmartPointer<vtkImageData> image = vtkSmartPointer<vtkImageData>::New();
180 ])
181 ], [vtkLinkVersion="OK"])
182 fi
183
184 dnl Execute $2 if version is ok, otherwise execute $3 {{{
185 if test "$vtkLinkVersion" = "OK"; then
186 AC_MSG_RESULT([yes])
187 $2
188 break
189 else
190 AC_MSG_RESULT([no])
191 $3
192 fi
193 dnl unset VTK_LDFLAGS
194 VTK_LDFLAGS=
195 dnl restore all flags without VTK values
196 CFLAGS=$OLD_CFLAGS
197 CXXFLAGS=$OLD_CXXFLAGS
198 LDFLAGS=$OLD_LDFLAGS
199 LIBS=$OLD_LIBS
200 done
201 fi
202 fi
203 dnl }}}
204 dnl
205 fi
206])# AM_PATH_VTK
207dnl
208dnl vim: foldmethod=marker foldlevel=1 ts=2 sw=2
Note: See TracBrowser for help on using the repository browser.