1 | AC_PREREQ([2.60]) |
---|
2 | AC_INIT(vizservers, 0.1, rappture@nanohub.org) |
---|
3 | AC_CONFIG_AUX_DIR(cf) |
---|
4 | AC_CONFIG_HEADERS([nanovis/nvconf.h nanoscale/config.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])], |
---|
38 | [with_vtk=$withval], |
---|
39 | [with_vtk=yes]) |
---|
40 | |
---|
41 | RP_LANG_PYTHON |
---|
42 | |
---|
43 | VERSION=0.0.1 |
---|
44 | |
---|
45 | #------------------------------------------------------------------------ |
---|
46 | # Handle the --prefix=... option |
---|
47 | #------------------------------------------------------------------------ |
---|
48 | |
---|
49 | if test "${prefix}" = "NONE"; then |
---|
50 | prefix=/usr/local |
---|
51 | fi |
---|
52 | if test "${exec_prefix}" = "NONE"; then |
---|
53 | exec_prefix=$prefix |
---|
54 | fi |
---|
55 | |
---|
56 | if test "x${incdir}" == "x"; then |
---|
57 | incdir=${exec_prefix}/include |
---|
58 | fi |
---|
59 | libdir=${exec_prefix}/lib |
---|
60 | |
---|
61 | if test "${libdir}" != "${prefix}/lib"; then |
---|
62 | LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}" |
---|
63 | else |
---|
64 | LIB_SEARCH_DIRS="-L ${libdir}" |
---|
65 | fi |
---|
66 | |
---|
67 | SC_CONFIG_CFLAGS |
---|
68 | |
---|
69 | |
---|
70 | AC_PATH_X |
---|
71 | |
---|
72 | AC_PROG_INSTALL |
---|
73 | AC_PROG_RANLIB |
---|
74 | AC_PROG_LN_S |
---|
75 | AC_PROG_MKDIR_P |
---|
76 | |
---|
77 | dnl find and test the C compiler |
---|
78 | AC_PROG_CC |
---|
79 | AC_PROG_CPP |
---|
80 | AC_PROG_CXXCPP |
---|
81 | AC_PROG_CXX |
---|
82 | AC_LANG_CPLUSPLUS |
---|
83 | |
---|
84 | AC_C_BIGENDIAN |
---|
85 | AC_CHECK_SIZEOF(int, 4) |
---|
86 | AC_CHECK_SIZEOF(long, 4) |
---|
87 | AC_CHECK_SIZEOF(long long, 8) |
---|
88 | AC_CHECK_SIZEOF(void *, 4) |
---|
89 | AC_CHECK_SIZEOF(float, 4) |
---|
90 | |
---|
91 | # Save the values as shell variables so that we can substitute them |
---|
92 | # into bltHash.h for situtations where there's no bltInt.h. |
---|
93 | |
---|
94 | |
---|
95 | LD_RPATH=""; |
---|
96 | |
---|
97 | # |
---|
98 | # Need to check for the following dependencies: |
---|
99 | # Rappture headers and library (done) |
---|
100 | # Tcl headers and library (done) |
---|
101 | # GL headers and library |
---|
102 | # GLuT headers and library |
---|
103 | # GLui header and library |
---|
104 | # GLEW header and library |
---|
105 | # Cg headers and library |
---|
106 | # CgGL headers and library |
---|
107 | # pthread library |
---|
108 | # DX headers and library (done, sort of) |
---|
109 | # ffmpeg headers and library (started) |
---|
110 | # |
---|
111 | |
---|
112 | TCL_VERSION="8.4" |
---|
113 | for dir in \ |
---|
114 | ${exec_prefix} \ |
---|
115 | ${exec_prefix}/lib \ |
---|
116 | ${with_rappture} \ |
---|
117 | ${with_rappture}/lib ; do |
---|
118 | tclconfig="${dir}/tclConfig.sh" |
---|
119 | if test -f "$tclconfig" ; then |
---|
120 | . $tclconfig |
---|
121 | break |
---|
122 | fi |
---|
123 | done |
---|
124 | TCL_INC_SPEC="$TCL_INCLUDE_SPEC" |
---|
125 | |
---|
126 | if test "x$with_tcllib" != "x" ; then |
---|
127 | tclconfig="${with_tcllib}/tclConfig.sh" |
---|
128 | if test -f "$tclconfig" ; then |
---|
129 | . $tclconfig |
---|
130 | fi |
---|
131 | TCL_LIB_SPEC="-L${with_tcllib} -ltcl${TCL_VERSION}" |
---|
132 | fi |
---|
133 | if test "x$with_tclinclude" != "x" ; then |
---|
134 | TCL_INC_SPEC="-I${with_tclinclude}" |
---|
135 | fi |
---|
136 | |
---|
137 | RP_DIR="" |
---|
138 | AC_MSG_CHECKING([for rappture]) |
---|
139 | if test "$with_rappture" == "yes" ; then |
---|
140 | for dir in "$exec_prefix" "/usr" ; do |
---|
141 | if test -r "$dir/include/rappture2/rappture2.h" -a \ |
---|
142 | -r "$dir/lib/librappture.a"; then |
---|
143 | RP_DIR="$dir" |
---|
144 | RP_INC_SPEC="-I$dir/include -I$dir/include/rappture2" |
---|
145 | RP_LIB_DIR="$dir/lib" |
---|
146 | AC_MSG_RESULT([$dir]) |
---|
147 | break |
---|
148 | fi |
---|
149 | done |
---|
150 | else |
---|
151 | if test ! -d "$with_rappture" ; then |
---|
152 | AC_MSG_ERROR([--with-rappture: no such directory $with_rappture]) |
---|
153 | fi |
---|
154 | RP_DIR=$with_rappture |
---|
155 | RP_INC_SPEC="-I$with_rappture/include -I$with_rappture/include/rappture2" |
---|
156 | RP_LIB_DIR="$with_rappture/lib" |
---|
157 | fi |
---|
158 | if test "x${RP_DIR}" = "x" ; then |
---|
159 | AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture]) |
---|
160 | else |
---|
161 | AC_MSG_RESULT([$with_rappture]) |
---|
162 | fi |
---|
163 | |
---|
164 | dnl Prefer our VTK installation over systems. --with-vtk overrides. |
---|
165 | if test "$with_vtk" != "no" ; then |
---|
166 | if test "$with_vtk" = "yes" ; then |
---|
167 | for dir in vtk-5.{9,8,7,6,5,4,3,2,1} ; do |
---|
168 | if test -d "${libdir}/$dir" -a -d "${incdir}/$dir"; then |
---|
169 | VTK_LIB_SPEC="-L${libdir}/$dir" |
---|
170 | VTK_LIB_DIR="${libdir}/$dir" |
---|
171 | VTK_INC_SPEC="-I${incdir}/$dir" |
---|
172 | break |
---|
173 | fi |
---|
174 | if test -d "/usr/lib/$dir" -a -d "/usr/include/$dir"; then |
---|
175 | VTK_LIB_SPEC=-L/usr/lib/$dir |
---|
176 | VTK_LIB_DIR=/usr/lib/$dir |
---|
177 | VTK_INC_SPEC=-I/usr/include/$dir |
---|
178 | break |
---|
179 | fi |
---|
180 | done |
---|
181 | fi |
---|
182 | fi |
---|
183 | |
---|
184 | if test "x$with_vtk_includes" != "x"; then |
---|
185 | VTK_INC_SPEC=-I$with_vtk_includes |
---|
186 | fi |
---|
187 | |
---|
188 | if test "x$with_vtk_libs" != "x"; then |
---|
189 | VTK_LIB_DIR=$with_vtk_libs |
---|
190 | VTK_LIB_SPEC="-L$with_vtk_libs" |
---|
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/glui.h]) |
---|
199 | AC_CHECK_HEADER([glui.h]) |
---|
200 | AC_CHECK_HEADER([GL/glut.h]) |
---|
201 | AC_CHECK_HEADER([GL/glew.h]) |
---|
202 | |
---|
203 | AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h]) |
---|
204 | AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h]) |
---|
205 | |
---|
206 | AC_CHECK_FUNCS([accept4]) |
---|
207 | |
---|
208 | AC_MSG_CHECKING([for OpenDX headers]) |
---|
209 | DX_INC_DIR="" |
---|
210 | for dir in \ |
---|
211 | /apps/rappture/include \ |
---|
212 | /usr/dx/include \ |
---|
213 | /usr/include |
---|
214 | do |
---|
215 | if test -r "${dir}/dx/dx.h" ; then |
---|
216 | DX_INC_DIR="$dir" |
---|
217 | break |
---|
218 | fi |
---|
219 | done |
---|
220 | if test "x${DX_INC_DIR}" = "x" ; then |
---|
221 | AC_MSG_WARN([cannot find OpenDX include files]) |
---|
222 | DX_INC_SPEC="" |
---|
223 | elif test "${DX_INC_DIR}" = "/usr/include" ; then |
---|
224 | DX_INC_SPEC="" |
---|
225 | else |
---|
226 | DX_INC_SPEC="-I{DX_INC_DIR}" |
---|
227 | fi |
---|
228 | |
---|
229 | AC_MSG_RESULT([${DX_INC_DIR}]) |
---|
230 | save_CPPFLAGS=${CPPFLAGS} |
---|
231 | CPPFLAGS="$DX_INC_SPEC $CPPFLAGS" |
---|
232 | AC_CHECK_HEADERS(dx/dx.h) |
---|
233 | CPPFLAGS=${save_CPPFLAGS} |
---|
234 | |
---|
235 | DX_LIB_DIR="" |
---|
236 | for dir in \ |
---|
237 | /usr/lib \ |
---|
238 | /usr/lib64 \ |
---|
239 | /usr/dx/lib_linux \ |
---|
240 | /usr/lib/dx/lib_linux \ |
---|
241 | /usr/lib64/dx/lib_linux \ |
---|
242 | /apps/rappture/lib |
---|
243 | do |
---|
244 | saveLDFLAGS=$LDFLAGS |
---|
245 | LDFLAGS="-L$dir $LDFLAGS" |
---|
246 | unset ac_cv_lib_DXcallm_DXGetComponentValue |
---|
247 | AC_CHECK_LIB([DXcallm], [DXGetComponentValue], [found=yes], [found=no], [-lX11]) |
---|
248 | LDFLAGS=$saveLDFLAGS |
---|
249 | if test "$found" = "yes" ; then |
---|
250 | DX_LIB_DIR="$dir" |
---|
251 | break |
---|
252 | fi |
---|
253 | done |
---|
254 | if test "x${DX_LIB_DIR}" = "x" ; then |
---|
255 | AC_MSG_WARN([cannot find OpenDX libraries]) |
---|
256 | fi |
---|
257 | |
---|
258 | AC_MSG_CHECKING([for libDXcallm library]) |
---|
259 | if test "x${DX_LIB_DIR}" = "x" -o "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then |
---|
260 | DX_LIB_SPEC="" |
---|
261 | else |
---|
262 | DX_LIB_SPEC="-L${DX_LIB_DIR} -lDXcallm" |
---|
263 | fi |
---|
264 | AC_MSG_RESULT([$DX_LIB_SPEC]) |
---|
265 | |
---|
266 | AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h]) |
---|
267 | AC_CHECK_LIB([highgui], [cvLoadImage]) |
---|
268 | |
---|
269 | save_CPPFLAGS=$CPPFLAGS |
---|
270 | # Test for redhat-specific location of ffmpeg headers. |
---|
271 | if test -d "/usr/include/ffmpeg" ; then |
---|
272 | CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg" |
---|
273 | FF_INC_SPEC="-I/usr/include/ffmpeg" |
---|
274 | fi |
---|
275 | |
---|
276 | AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h],,,[ |
---|
277 | #define __STDC_CONSTANT_MACROS 1 |
---|
278 | ]) |
---|
279 | CPPFLAGS=$save_CPPFLAGS |
---|
280 | |
---|
281 | AC_CHECK_LIB(avcodec, main,,AC_MSG_ERROR(requires libavcodec)) |
---|
282 | AC_CHECK_LIB(avutil, main,,AC_MSG_ERROR(requires libavutil)) |
---|
283 | AC_CHECK_LIB(avformat, main,,AC_MSG_ERROR(requires libavformat)) |
---|
284 | AC_CHECK_LIB(swscale, main) |
---|
285 | AC_CHECK_FUNCS(avcodec_decode_video2) |
---|
286 | AC_CHECK_FUNCS(avcodec_decode_video) |
---|
287 | AC_CHECK_FUNCS(avformat_open_input) |
---|
288 | AC_CHECK_FUNCS(av_open_input_file) |
---|
289 | AC_CHECK_FUNCS(av_guess_format) |
---|
290 | AC_CHECK_FUNCS(guess_format) |
---|
291 | AC_CHECK_FUNCS(av_dump_format) |
---|
292 | AC_CHECK_FUNCS(dump_format) |
---|
293 | AC_CHECK_FUNCS(avio_open) |
---|
294 | AC_CHECK_FUNCS(url_fopen) |
---|
295 | AC_CHECK_FUNCS(avio_close) |
---|
296 | AC_CHECK_FUNCS(url_fclose) |
---|
297 | AC_CHECK_FUNCS(avformat_alloc_context) |
---|
298 | AC_CHECK_FUNCS(av_alloc_format_context) |
---|
299 | AC_CHECK_FUNCS(av_set_parameters) |
---|
300 | AC_CHECK_FUNCS(avformat_write_header) |
---|
301 | AC_CHECK_FUNCS(av_write_header) |
---|
302 | AC_CHECK_FUNC(av_write_trailer,, |
---|
303 | AC_MSG_ERROR(oops! no av_write_trailer?!?)) |
---|
304 | AC_CHECK_FUNC(av_freep,, AC_MSG_ERROR(oops! no av_freep ?!?)) |
---|
305 | AC_CHECK_FUNC(av_free,,AC_MSG_ERROR(oops! no av_free ?!?)) |
---|
306 | AC_CHECK_FUNC(av_new_stream,,AC_MSG_ERROR(oops! av_new_stream ?!?)) |
---|
307 | AC_CHECK_FUNC(av_malloc,, AC_MSG_ERROR(oops! no av_malloc ?!?)) |
---|
308 | AC_CHECK_FUNC(av_init_packet,,AC_MSG_ERROR(oops! no av_init_packet ?!?)) |
---|
309 | AC_CHECK_FUNC(av_rescale_q,,AC_MSG_ERROR(oops! no av_rescale_q ?!?)) |
---|
310 | AC_CHECK_FUNC(av_write_frame,,AC_MSG_ERROR(oops! av_write_frame ?!?)) |
---|
311 | AC_CHECK_FUNCS(img_convert) |
---|
312 | AC_CHECK_FUNCS(sws_scale) |
---|
313 | AC_TRY_COMPILE([ |
---|
314 | #define __STDC_CONSTANT_MACROS 1 |
---|
315 | #include <stdlib.h> |
---|
316 | #ifdef HAVE_FFMPEG_AVCODEC_H |
---|
317 | # include <ffmpeg/avcodec.h> |
---|
318 | #endif |
---|
319 | #ifdef HAVE_LIBAVCODEC_AVCODEC_H |
---|
320 | # include <libavcodec/avcodec.h> |
---|
321 | #endif |
---|
322 | int x = AVMEDIA_TYPE_VIDEO; |
---|
323 | ],, ac_avmedia_type_video="yes", ac_avmedia_type_video="no") |
---|
324 | if test "$ac_avmedia_type_video" == "yes" ; then |
---|
325 | AC_DEFINE(HAVE_AVMEDIA_TYPE_VIDEO,1,[Define if AVMEDIA_TYPE_VIDEO enum exists. ]) |
---|
326 | fi |
---|
327 | |
---|
328 | AC_CHECK_LIB([avcodec], [avcodec_alloc_frame]) |
---|
329 | # Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found |
---|
330 | AC_CHECK_LIB([avformat], [avformat_alloc_context], [], |
---|
331 | AC_CHECK_LIB([avformat], [av_alloc_format_context], [], |
---|
332 | [AC_MSG_WARN([libavformat not usable])])) |
---|
333 | |
---|
334 | |
---|
335 | AC_MSG_CHECKING([for nVidia Cg installation]) |
---|
336 | CG_DIR="" |
---|
337 | for dir in \ |
---|
338 | /opt/nvidia-cg-toolkit \ |
---|
339 | /usr/cg \ |
---|
340 | /usr |
---|
341 | do |
---|
342 | if test -r "$dir/include" ; then |
---|
343 | CG_DIR=$dir |
---|
344 | break |
---|
345 | fi |
---|
346 | done |
---|
347 | AC_MSG_RESULT([${CG_DIR}]) |
---|
348 | |
---|
349 | CG_INC_DIR="$dir/include" |
---|
350 | CG_LIB_DIR="$dir/lib" |
---|
351 | |
---|
352 | save_CPPFLAGS=$CPPFLAGS |
---|
353 | CPPFLAGS="-I${CG_INC_DIR} $CPPFLAGS" |
---|
354 | AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers])) |
---|
355 | CPPFLAGS=$save_CPPFLAGS |
---|
356 | |
---|
357 | if test "${CG_DIR}" = "/usr" ; then |
---|
358 | CG_DIR="" |
---|
359 | else |
---|
360 | LD_RPATH="$loader_run_path:${CG_LIB_DIR}" |
---|
361 | fi |
---|
362 | |
---|
363 | SUBDIRS="nanoscale nanovis pymolproxy vtkvis" |
---|
364 | |
---|
365 | AC_SUBST(CFLAGS_DEBUG) |
---|
366 | AC_SUBST(CFLAGS_OPTIMIZE) |
---|
367 | AC_SUBST(CG_DIR) |
---|
368 | AC_SUBST(CG_INC_DIR) |
---|
369 | AC_SUBST(CG_LIB_DIR) |
---|
370 | AC_SUBST(DX_INC_SPEC) |
---|
371 | AC_SUBST(DX_LIB_SPEC) |
---|
372 | AC_SUBST(FF_INC_SPEC) |
---|
373 | AC_SUBST(LD_RPATH) |
---|
374 | AC_SUBST(RP_DIR) |
---|
375 | AC_SUBST(RP_INC_SPEC) |
---|
376 | AC_SUBST(RP_LIB_DIR) |
---|
377 | AC_SUBST(SHLIB_CFLAGS) |
---|
378 | AC_SUBST(SHLIB_LD) |
---|
379 | AC_SUBST(SHLIB_LDFLAGS) |
---|
380 | AC_SUBST(SHLIB_SUFFIX) |
---|
381 | AC_SUBST(SIZEOF_FLOAT) |
---|
382 | AC_SUBST(SIZEOF_INT) |
---|
383 | AC_SUBST(SIZEOF_LONG) |
---|
384 | AC_SUBST(SIZEOF_LONG_LONG) |
---|
385 | AC_SUBST(SIZEOF_VOID_P) |
---|
386 | AC_SUBST(STLIB_LD) |
---|
387 | AC_SUBST(SUBDIRS) |
---|
388 | AC_SUBST(PYTHON) |
---|
389 | AC_SUBST(TCL_INC_SPEC) |
---|
390 | AC_SUBST(TCL_LIB_SPEC) |
---|
391 | AC_SUBST(TCL_VERSION) |
---|
392 | AC_SUBST(VERSION) |
---|
393 | AC_SUBST(VTK_INC_SPEC) |
---|
394 | AC_SUBST(VTK_LIB_DIR) |
---|
395 | |
---|
396 | AC_OUTPUT([ |
---|
397 | Makefile \ |
---|
398 | nanoscale/Makefile \ |
---|
399 | nanoscale/renderservers.tcl \ |
---|
400 | nanovis/Makefile \ |
---|
401 | nanovis/newmat11/Makefile \ |
---|
402 | nanovis/R2/src/Makefile \ |
---|
403 | nanovis/vrutil/Makefile \ |
---|
404 | nanovis/vrmath/Makefile \ |
---|
405 | nanovis/vr3d/Makefile \ |
---|
406 | nanovis/imgLoaders/Makefile \ |
---|
407 | nanovis/transfer-function/Makefile \ |
---|
408 | pymolproxy/Makefile \ |
---|
409 | vtkvis/Doxyfile \ |
---|
410 | vtkvis/Makefile \ |
---|
411 | start_viz.sh \ |
---|
412 | start_nanoscale.sh]) |
---|