1 | AC_PREREQ([2.60]) |
---|
2 | AC_INIT([nanovis], [1.3], [rappture@nanohub.org]) |
---|
3 | AC_CONFIG_AUX_DIR(cf) |
---|
4 | AC_CONFIG_HEADERS([nvconf.h]) |
---|
5 | |
---|
6 | AC_ARG_WITH( |
---|
7 | [tcllib], |
---|
8 | [AS_HELP_STRING([--with-tcllib[=DIR]], |
---|
9 | [location of Tcl binary library libtclstubs.a @<:@default=/usr/lib@:>@])], |
---|
10 | [with_tcllib=$withval], |
---|
11 | [with_tcllib=""]) |
---|
12 | |
---|
13 | AC_ARG_WITH( |
---|
14 | [rappture], |
---|
15 | [AS_HELP_STRING([--with-rappture[=DIR]], |
---|
16 | [location of rappture files lib/librappture.a and include/rappture.h @<:@default=/usr@:>@])], |
---|
17 | [with_rappture=$withval], |
---|
18 | [with_rappture=yes]) |
---|
19 | |
---|
20 | AC_ARG_WITH( |
---|
21 | [vtk-includes], |
---|
22 | [AS_HELP_STRING([--with-vtk-includes=DIR], |
---|
23 | [VTK include files are in DIR])], |
---|
24 | [with_vtk_includes=$withval], |
---|
25 | [with_vtk_includes=""]) |
---|
26 | |
---|
27 | AC_ARG_WITH( |
---|
28 | [vtk-libs], |
---|
29 | [AS_HELP_STRING([--with-vtk-libs=DIR], |
---|
30 | [VTK libraries are in DIR])], |
---|
31 | [with_vtk_libs=$withval], |
---|
32 | [with_vtk_libs=""]) |
---|
33 | |
---|
34 | AC_ARG_WITH( |
---|
35 | [vtk], |
---|
36 | [AS_HELP_STRING([--with-vtk=VERSION], |
---|
37 | [Version of VTK required @<:@default=6.1@:>@])], |
---|
38 | [with_vtk=$withval], |
---|
39 | [with_vtk=""]) |
---|
40 | |
---|
41 | AC_ARG_WITH( |
---|
42 | [ffmpeg], |
---|
43 | [AS_HELP_STRING([--with-ffmpeg[=DIR]], |
---|
44 | [location of ffmpeg @<:@default=yes@:>@])], |
---|
45 | [], |
---|
46 | [with_ffmpeg=yes]) |
---|
47 | |
---|
48 | AC_ARG_WITH( |
---|
49 | [avconv], |
---|
50 | [AS_HELP_STRING([--with-avconv[=DIR]], |
---|
51 | [location of avconv @<:@default=yes@:>@])], |
---|
52 | [], |
---|
53 | [with_avconv=yes]) |
---|
54 | |
---|
55 | AC_ARG_WITH( |
---|
56 | [statsdir], |
---|
57 | [AS_HELP_STRING([--with-statsdir=DIR], |
---|
58 | [Write statistics in DIR])], |
---|
59 | [STATSDIR=$withval], |
---|
60 | [STATSDIR="/var/tmp/visservers"]) |
---|
61 | |
---|
62 | #------------------------------------------------------------------------ |
---|
63 | # Handle the --prefix=... option |
---|
64 | #------------------------------------------------------------------------ |
---|
65 | |
---|
66 | if test "${prefix}" = "NONE"; then |
---|
67 | prefix=/usr/local |
---|
68 | fi |
---|
69 | if test "${exec_prefix}" = "NONE"; then |
---|
70 | exec_prefix=$prefix |
---|
71 | fi |
---|
72 | |
---|
73 | if test "x${incdir}" == "x"; then |
---|
74 | incdir=${exec_prefix}/include |
---|
75 | fi |
---|
76 | libdir=${exec_prefix}/lib |
---|
77 | |
---|
78 | if test "${libdir}" != "${prefix}/lib"; then |
---|
79 | LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}" |
---|
80 | else |
---|
81 | LIB_SEARCH_DIRS="-L ${libdir}" |
---|
82 | fi |
---|
83 | |
---|
84 | AC_PROG_INSTALL |
---|
85 | AC_PROG_RANLIB |
---|
86 | AC_PROG_LN_S |
---|
87 | AC_PROG_MKDIR_P |
---|
88 | |
---|
89 | dnl find and test the C compiler |
---|
90 | AC_PROG_CC |
---|
91 | AC_PROG_CPP |
---|
92 | AC_PROG_CXXCPP |
---|
93 | AC_PROG_CXX |
---|
94 | AC_LANG_CPLUSPLUS |
---|
95 | |
---|
96 | AC_C_BIGENDIAN |
---|
97 | |
---|
98 | # Save the values as shell variables so that we can substitute them |
---|
99 | # into bltHash.h for situtations where there's no bltInt.h. |
---|
100 | |
---|
101 | |
---|
102 | LD_RPATH=""; |
---|
103 | |
---|
104 | # |
---|
105 | # Need to check for the following dependencies: |
---|
106 | # Rappture headers and library (done) |
---|
107 | # Tcl headers and library (done) |
---|
108 | # GL headers and library |
---|
109 | # GLuT headers and library |
---|
110 | # GLEW header and library |
---|
111 | # Cg headers and library |
---|
112 | # CgGL headers and library |
---|
113 | # pthread library |
---|
114 | # ffmpeg headers and library (started) |
---|
115 | # |
---|
116 | |
---|
117 | TCL_VERSION="8.4" |
---|
118 | for dir in \ |
---|
119 | ${exec_prefix} \ |
---|
120 | ${exec_prefix}/lib \ |
---|
121 | ${with_rappture} \ |
---|
122 | ${with_rappture}/lib ; do |
---|
123 | tclconfig="${dir}/tclConfig.sh" |
---|
124 | if test -f "$tclconfig" ; then |
---|
125 | . $tclconfig |
---|
126 | break |
---|
127 | fi |
---|
128 | done |
---|
129 | TCL_INC_SPEC="$TCL_INCLUDE_SPEC" |
---|
130 | |
---|
131 | if test "x$with_tcllib" != "x" ; then |
---|
132 | tclconfig="${with_tcllib}/tclConfig.sh" |
---|
133 | if test -f "$tclconfig" ; then |
---|
134 | . $tclconfig |
---|
135 | fi |
---|
136 | TCL_LIB_SPEC="-L${with_tcllib} -ltcl${TCL_VERSION}" |
---|
137 | fi |
---|
138 | if test "x$with_tclinclude" != "x" ; then |
---|
139 | TCL_INC_SPEC="-I${with_tclinclude}" |
---|
140 | fi |
---|
141 | |
---|
142 | RP_DIR="" |
---|
143 | AC_MSG_CHECKING([for rappture]) |
---|
144 | if test "$with_rappture" == "yes" ; then |
---|
145 | for dir in "$exec_prefix" "/usr" ; do |
---|
146 | if test -r "$dir/include/rappture2/rappture2.h" -a \ |
---|
147 | -r "$dir/lib/librappture.a"; then |
---|
148 | RP_DIR="$dir" |
---|
149 | RP_INC_SPEC="-I$dir/include -I$dir/include/rappture2" |
---|
150 | RP_LIB_DIR="$dir/lib" |
---|
151 | AC_MSG_RESULT([$dir]) |
---|
152 | break |
---|
153 | fi |
---|
154 | done |
---|
155 | else |
---|
156 | if test ! -d "$with_rappture" ; then |
---|
157 | AC_MSG_ERROR([--with-rappture: no such directory $with_rappture]) |
---|
158 | fi |
---|
159 | RP_DIR=$with_rappture |
---|
160 | RP_INC_SPEC="-I$with_rappture/include -I$with_rappture/include/rappture2" |
---|
161 | RP_LIB_DIR="$with_rappture/lib" |
---|
162 | fi |
---|
163 | if test "x${RP_DIR}" = "x" ; then |
---|
164 | AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture]) |
---|
165 | else |
---|
166 | AC_MSG_RESULT([$with_rappture]) |
---|
167 | fi |
---|
168 | |
---|
169 | # We are assuming that we're using VTK 6.0 |
---|
170 | VTK_VERSION=6.1 |
---|
171 | VTK_LIB_DIR=${libdir} |
---|
172 | VTK_INC_DIR=${incdir} |
---|
173 | |
---|
174 | if test "x$with_vtk_includes" != "x"; then |
---|
175 | VTK_INC_DIR=$with_vtk_includes |
---|
176 | fi |
---|
177 | |
---|
178 | if test "x$with_vtk_libs" != "x"; then |
---|
179 | VTK_LIB_DIR=$with_vtk_libs |
---|
180 | fi |
---|
181 | |
---|
182 | dnl Prefer our VTK installation over systems. --with-vtk overrides. |
---|
183 | if test "x$with_vtk" != "x" ; then |
---|
184 | VTK_VERSION=$with_vtk |
---|
185 | fi |
---|
186 | |
---|
187 | if ! test -d "$VTK_INC_DIR/vtk-${VTK_VERSION}" ; then |
---|
188 | AC_ERROR([Couldn't find VTK includes]) |
---|
189 | else |
---|
190 | VTK_INC_SPEC="-I${VTK_INC_DIR}/vtk-${VTK_VERSION}" |
---|
191 | fi |
---|
192 | |
---|
193 | save_CPPFLAGS=$CPPFLAGS |
---|
194 | CPPFLAGS=$VTK_INC_SPEC |
---|
195 | AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_WARN([cannot find vtkSmartPointer.h])]) |
---|
196 | CPPFLAGS=$save_CPPFLAGS |
---|
197 | |
---|
198 | AC_CHECK_HEADER([GL/glut.h]) |
---|
199 | AC_CHECK_HEADER([GL/glew.h]) |
---|
200 | |
---|
201 | AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h]) |
---|
202 | AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h]) |
---|
203 | |
---|
204 | AC_CHECK_FUNCS([accept4]) |
---|
205 | |
---|
206 | #-------------------------------------------------------------------- |
---|
207 | # search for avconv executable |
---|
208 | #-------------------------------------------------------------------- |
---|
209 | if test "${with_avconv}" != "no" ; then |
---|
210 | if test "${with_avconv}" = "yes" ; then |
---|
211 | AC_PATH_PROG(AVCONV, avconv) |
---|
212 | else |
---|
213 | AC_PATH_PROG(AVCONV, avconv, [], [${with_avconv}/bin:${with_avconv}]) |
---|
214 | fi |
---|
215 | if test "${AVCONV}x" != "x" ; then |
---|
216 | AC_DEFINE(HAVE_AVCONV, 1, [nanovis can use avconv to create videos.]) |
---|
217 | fi |
---|
218 | fi |
---|
219 | |
---|
220 | #-------------------------------------------------------------------- |
---|
221 | # search for ffmpeg executable |
---|
222 | #-------------------------------------------------------------------- |
---|
223 | if test "${with_ffmpeg}" != "no" ; then |
---|
224 | if test "${with_ffmpeg}" = "yes" ; then |
---|
225 | AC_PATH_PROG(FFMPEG, ffmpeg) |
---|
226 | else |
---|
227 | AC_PATH_PROG(FFMPEG, ffmpeg, [], [${with_ffmpeg}/bin:${with_ffmpeg}]) |
---|
228 | fi |
---|
229 | if test "${FFMPEG}x" != "x" ; then |
---|
230 | AC_DEFINE(HAVE_FFMPEG, 1, [nanovis can use ffmpeg to create videos.]) |
---|
231 | fi |
---|
232 | fi |
---|
233 | |
---|
234 | AC_MSG_CHECKING([for nVidia Cg installation]) |
---|
235 | CG_DIR="" |
---|
236 | for dir in \ |
---|
237 | /opt/nvidia-cg-toolkit \ |
---|
238 | /usr/cg \ |
---|
239 | /usr |
---|
240 | do |
---|
241 | if test -r "$dir/include" ; then |
---|
242 | CG_DIR=$dir |
---|
243 | break |
---|
244 | fi |
---|
245 | done |
---|
246 | AC_MSG_RESULT([${CG_DIR}]) |
---|
247 | |
---|
248 | CG_INC_SPEC="-I${CG_DIR}/include" |
---|
249 | |
---|
250 | save_CPPFLAGS=$CPPFLAGS |
---|
251 | CPPFLAGS="${CG_INC_SPEC} $CPPFLAGS" |
---|
252 | AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers])) |
---|
253 | CPPFLAGS=$save_CPPFLAGS |
---|
254 | |
---|
255 | CG_LIB_DIR="" |
---|
256 | for dir in \ |
---|
257 | /opt/nvidia-cg-toolkit \ |
---|
258 | /usr/cg \ |
---|
259 | /usr |
---|
260 | do |
---|
261 | if test -r "$dir/lib" ; then |
---|
262 | CG_LIB_DIR=$dir/lib |
---|
263 | break |
---|
264 | fi |
---|
265 | if test -r "$dir/lib64" ; then |
---|
266 | CG_LIB_DIR=$dir/lib64 |
---|
267 | break |
---|
268 | fi |
---|
269 | done |
---|
270 | |
---|
271 | if test "${CG_LIB_DIR}" = "/usr/lib" ; then |
---|
272 | CG_INC_SPEC="" |
---|
273 | CG_LIB_SPEC="-lCg -lCgGL" |
---|
274 | else |
---|
275 | CG_LIB_SPEC="-L${CG_LIB_DIR} -lCg -lCgGL" |
---|
276 | LD_RPATH="$loader_run_path:${CG_LIB_DIR}" |
---|
277 | fi |
---|
278 | |
---|
279 | AC_SUBST(CG_INC_SPEC) |
---|
280 | AC_SUBST(CG_LIB_SPEC) |
---|
281 | AC_SUBST(AVCONV) |
---|
282 | AC_SUBST(FFMPEG) |
---|
283 | AC_SUBST(LD_RPATH) |
---|
284 | AC_SUBST(RP_DIR) |
---|
285 | AC_SUBST(RP_INC_SPEC) |
---|
286 | AC_SUBST(RP_LIB_DIR) |
---|
287 | AC_SUBST(STATSDIR) |
---|
288 | AC_SUBST(TCL_INC_SPEC) |
---|
289 | AC_SUBST(TCL_LIB_SPEC) |
---|
290 | AC_SUBST(TCL_VERSION) |
---|
291 | AC_SUBST(VTK_VERSION) |
---|
292 | AC_SUBST(VTK_INC_DIR) |
---|
293 | AC_SUBST(VTK_LIB_DIR) |
---|
294 | |
---|
295 | AC_OUTPUT([ |
---|
296 | Doxyfile \ |
---|
297 | Makefile \ |
---|
298 | graphics/Makefile \ |
---|
299 | imgLoaders/Makefile \ |
---|
300 | newmat11/Makefile \ |
---|
301 | util/Makefile \ |
---|
302 | vrmath/Makefile]) |
---|