source: trunk/packages/vizservers/configure.in @ 3380

Last change on this file since 3380 was 3362, checked in by ldelgass, 11 years ago

Merge nanovis2 branch to trunk

File size: 10.7 KB
Line 
1AC_PREREQ([2.60])
2AC_INIT(vizservers, 0.1, rappture@nanohub.org)
3AC_CONFIG_AUX_DIR(cf)
4AC_CONFIG_HEADERS([nanovis/nvconf.h nanoscale/config.h])
5
6AC_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
13AC_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
20AC_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
27AC_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
34AC_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
41RP_LANG_PYTHON
42
43VERSION=0.0.1
44
45#------------------------------------------------------------------------
46# Handle the --prefix=... option
47#------------------------------------------------------------------------
48
49if test "${prefix}" = "NONE"; then
50    prefix=/usr/local
51fi
52if test "${exec_prefix}" = "NONE"; then
53    exec_prefix=$prefix
54fi
55
56if test "x${incdir}" == "x"; then
57  incdir=${exec_prefix}/include
58fi
59libdir=${exec_prefix}/lib
60
61if test "${libdir}" != "${prefix}/lib"; then
62    LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}"
63else
64    LIB_SEARCH_DIRS="-L ${libdir}"
65fi
66
67SC_CONFIG_CFLAGS
68
69
70AC_PATH_X
71
72AC_PROG_INSTALL
73AC_PROG_RANLIB
74AC_PROG_LN_S
75AC_PROG_MKDIR_P
76
77dnl find and test the C compiler
78AC_PROG_CC
79AC_PROG_CPP
80AC_PROG_CXXCPP
81AC_PROG_CXX
82AC_LANG_CPLUSPLUS
83
84AC_C_BIGENDIAN
85AC_CHECK_SIZEOF(int, 4)
86AC_CHECK_SIZEOF(long, 4)
87AC_CHECK_SIZEOF(long long, 8)
88AC_CHECK_SIZEOF(void *, 4)
89AC_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
95LD_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
112TCL_VERSION="8.4"
113for 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
123done
124TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
125
126if 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}"
132fi
133if test "x$with_tclinclude" != "x" ; then
134   TCL_INC_SPEC="-I${with_tclinclude}"
135fi
136
137RP_DIR=""
138AC_MSG_CHECKING([for rappture])
139if 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
150else
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"
157fi
158if test "x${RP_DIR}" = "x" ; then
159  AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture])
160else
161  AC_MSG_RESULT([$with_rappture])
162fi
163
164# This could be temporary. We are assuming that we're using VTK 6+.
165# Since VTK 6 hasn't been released, we will look it only in the
166# Rappture build directories.
167VTK_LIB_DIR=${libdir}
168dnl Prefer our VTK installation over systems. --with-vtk overrides.
169if test "$with_vtk" != "no" ; then
170  if test "$with_vtk" = "yes" ; then
171    for dir in vtk-6.{10,9,8,7,6,5,4,3,2,1,0} ; do
172      if test -d "${incdir}/$dir"; then
173        VTK_INC_SPEC="-I${incdir}/$dir"
174        break
175      fi
176    done
177  fi
178fi
179
180if test "x$with_vtk_includes" != "x"; then
181   VTK_INC_SPEC=-I$with_vtk_includes
182fi
183
184if test "x$with_vtk_libs" != "x"; then
185   VTK_LIB_DIR=$with_vtk_libs
186   VTK_LIB_SPEC="-L$with_vtk_libs"
187fi
188
189save_CPPFLAGS=$CPPFLAGS
190CPPFLAGS=$VTK_INC_SPEC
191AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_WARN([cannot find vtkSmartPointer.h])])
192CPPFLAGS=$save_CPPFLAGS
193
194AC_CHECK_HEADER([GL/glui.h])
195AC_CHECK_HEADER([glui.h])
196AC_CHECK_HEADER([GL/glut.h])
197AC_CHECK_HEADER([GL/glew.h])
198
199AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
200AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
201
202AC_CHECK_FUNCS([accept4])
203
204AC_MSG_CHECKING([for OpenDX headers])
205DX_INC_DIR=""
206for dir in \
207 /apps/rappture/include \
208 /usr/dx/include \
209 /usr/include
210do
211  if test -r "${dir}/dx/dx.h" ; then
212    DX_INC_DIR="$dir"
213    break
214  fi
215done
216if test "x${DX_INC_DIR}" = "x" ; then
217  AC_MSG_WARN([cannot find OpenDX include files])
218  DX_INC_SPEC=""
219elif test "${DX_INC_DIR}" = "/usr/include" ; then
220  DX_INC_SPEC=""
221else
222  DX_INC_SPEC="-I{DX_INC_DIR}"
223fi
224
225AC_MSG_RESULT([${DX_INC_DIR}])
226save_CPPFLAGS=${CPPFLAGS}
227CPPFLAGS="$DX_INC_SPEC $CPPFLAGS"
228AC_CHECK_HEADERS(dx/dx.h)
229CPPFLAGS=${save_CPPFLAGS}
230
231DX_LIB_DIR=""
232for dir in \
233 /usr/lib \
234 /usr/lib64 \
235 /usr/dx/lib_linux \
236 /usr/lib/dx/lib_linux \
237 /usr/lib64/dx/lib_linux \
238 /apps/rappture/lib
239do
240  saveLDFLAGS=$LDFLAGS
241  LDFLAGS="-L$dir $LDFLAGS"
242  unset ac_cv_lib_DXcallm_DXGetComponentValue
243  AC_CHECK_LIB([DXcallm], [DXGetComponentValue], [found=yes], [found=no], [-lX11])
244  LDFLAGS=$saveLDFLAGS
245  if test "$found" = "yes" ; then
246    DX_LIB_DIR="$dir"
247    break
248  fi
249done
250if test "x${DX_LIB_DIR}" = "x" ; then
251  AC_MSG_WARN([cannot find OpenDX libraries])
252fi
253
254AC_MSG_CHECKING([for libDXcallm library])
255if test "x${DX_LIB_DIR}" = "x" -o "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then
256  DX_LIB_SPEC=""
257else
258  DX_LIB_SPEC="-L${DX_LIB_DIR} -lDXcallm"
259fi
260AC_MSG_RESULT([$DX_LIB_SPEC])
261
262save_CPPFLAGS=$CPPFLAGS
263# Test for redhat-specific location of ffmpeg headers.
264if test -d "/usr/include/ffmpeg" ; then
265  CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
266  FF_INC_SPEC="-I/usr/include/ffmpeg"
267fi
268
269AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h],,,[
270#define __STDC_CONSTANT_MACROS 1
271])
272CPPFLAGS=$save_CPPFLAGS
273
274AC_CHECK_LIB(avcodec, main,,AC_MSG_ERROR(requires libavcodec))
275AC_CHECK_LIB(avutil, main,,AC_MSG_ERROR(requires libavutil))
276AC_CHECK_LIB(avformat, main,,AC_MSG_ERROR(requires libavformat))
277AC_CHECK_LIB(swscale, main)
278AC_CHECK_FUNCS(avcodec_register_all)
279AC_CHECK_FUNCS(avcodec_init)
280AC_CHECK_FUNCS(avformat_new_stream)
281AC_CHECK_FUNCS(av_new_stream)
282AC_CHECK_FUNCS(avcodec_open)
283AC_CHECK_FUNCS(avcodec_open2)
284AC_CHECK_FUNCS(avcodec_decode_video2)
285AC_CHECK_FUNCS(avcodec_decode_video)
286AC_CHECK_FUNCS(avcodec_encode_video2)
287AC_CHECK_FUNCS(avcodec_encode_video)
288AC_CHECK_FUNCS(avformat_open_input)
289AC_CHECK_FUNCS(av_open_input_file)
290AC_CHECK_FUNCS(av_guess_format)
291AC_CHECK_FUNCS(guess_format)
292AC_CHECK_FUNCS(av_dump_format)
293AC_CHECK_FUNCS(dump_format)
294AC_CHECK_FUNCS(avio_open)
295AC_CHECK_FUNCS(url_fopen)
296AC_CHECK_FUNCS(avio_close)
297AC_CHECK_FUNCS(url_fclose)
298AC_CHECK_FUNCS(avformat_alloc_context)
299AC_CHECK_FUNCS(av_alloc_format_context)
300AC_CHECK_FUNCS(av_set_parameters)
301AC_CHECK_FUNCS(avformat_write_header)
302AC_CHECK_FUNCS(av_write_header)
303AC_CHECK_FUNC(av_write_trailer,,
304  AC_MSG_ERROR(oops! no av_write_trailer?!?))
305AC_CHECK_FUNC(av_freep,, AC_MSG_ERROR(oops! no av_freep ?!?))
306AC_CHECK_FUNC(av_free,,AC_MSG_ERROR(oops! no av_free ?!?))
307AC_CHECK_FUNC(av_new_stream,,AC_MSG_ERROR(oops! av_new_stream ?!?))
308AC_CHECK_FUNC(av_malloc,, AC_MSG_ERROR(oops! no av_malloc ?!?))
309AC_CHECK_FUNC(av_init_packet,,AC_MSG_ERROR(oops! no av_init_packet ?!?))
310AC_CHECK_FUNC(av_rescale_q,,AC_MSG_ERROR(oops! no av_rescale_q ?!?))
311AC_CHECK_FUNC(av_write_frame,,AC_MSG_ERROR(oops! av_write_frame ?!?))
312AC_CHECK_FUNCS(img_convert)
313AC_CHECK_FUNCS(sws_scale)
314AC_TRY_COMPILE([
315#define __STDC_CONSTANT_MACROS 1
316#include <stdlib.h>
317#ifdef HAVE_FFMPEG_AVCODEC_H
318# include <ffmpeg/avcodec.h>
319#endif
320#ifdef HAVE_LIBAVCODEC_AVCODEC_H
321# include <libavcodec/avcodec.h>
322#endif
323int x = AVMEDIA_TYPE_VIDEO;
324],, ac_avmedia_type_video="yes", ac_avmedia_type_video="no")
325if test "$ac_avmedia_type_video" == "yes" ; then
326  AC_DEFINE(HAVE_AVMEDIA_TYPE_VIDEO,1,[Define if AVMEDIA_TYPE_VIDEO enum exists. ])
327fi
328
329AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
330# Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
331AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
332    AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
333        [AC_MSG_WARN([libavformat not usable])]))
334
335
336AC_MSG_CHECKING([for nVidia Cg installation])
337CG_DIR=""
338for dir in \
339 /opt/nvidia-cg-toolkit \
340 /usr/cg \
341 /usr
342do
343  if test -r "$dir/include" ; then
344    CG_DIR=$dir
345    break
346  fi
347done
348AC_MSG_RESULT([${CG_DIR}])
349
350CG_INC_SPEC="-I${CG_DIR}/include"
351
352save_CPPFLAGS=$CPPFLAGS
353CPPFLAGS="${CG_INC_SPEC} $CPPFLAGS"
354AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers]))
355CPPFLAGS=$save_CPPFLAGS
356
357CG_LIB_DIR=""
358for dir in \
359 /opt/nvidia-cg-toolkit \
360 /usr/cg \
361 /usr
362do
363  if test -r "$dir/lib" ; then
364    CG_LIB_DIR=$dir/lib
365    break
366  fi
367  if test -r "$dir/lib64" ; then
368    CG_LIB_DIR=$dir/lib64
369    break
370  fi
371done
372
373if test "${CG_LIB_DIR}" = "/usr/lib" ; then
374  CG_INC_SPEC=""
375  CG_LIB_SPEC="-lCg -lCgGL"
376else
377  CG_LIB_SPEC="-L${CG_LIB_DIR} -lCg -lCgGL"
378  LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
379fi
380
381SUBDIRS="nanoscale nanovis pymolproxy vtkvis"
382
383AC_SUBST(CFLAGS_DEBUG)
384AC_SUBST(CFLAGS_OPTIMIZE)
385AC_SUBST(CG_INC_SPEC)
386AC_SUBST(CG_LIB_SPEC)
387AC_SUBST(DX_INC_SPEC)
388AC_SUBST(DX_LIB_SPEC)
389AC_SUBST(FF_INC_SPEC)
390AC_SUBST(LD_RPATH)
391AC_SUBST(RP_DIR)
392AC_SUBST(RP_INC_SPEC)
393AC_SUBST(RP_LIB_DIR)
394AC_SUBST(SHLIB_CFLAGS)
395AC_SUBST(SHLIB_LD)
396AC_SUBST(SHLIB_LDFLAGS)
397AC_SUBST(SHLIB_SUFFIX)
398AC_SUBST(SIZEOF_FLOAT)
399AC_SUBST(SIZEOF_INT)
400AC_SUBST(SIZEOF_LONG)
401AC_SUBST(SIZEOF_LONG_LONG)
402AC_SUBST(SIZEOF_VOID_P)
403AC_SUBST(STLIB_LD)
404AC_SUBST(SUBDIRS)
405AC_SUBST(PYTHON)
406AC_SUBST(TCL_INC_SPEC)
407AC_SUBST(TCL_LIB_SPEC)
408AC_SUBST(TCL_VERSION)
409AC_SUBST(VERSION)
410AC_SUBST(VTK_INC_SPEC)
411AC_SUBST(VTK_LIB_DIR)
412
413AC_OUTPUT([
414   Makefile \
415   nanoscale/Makefile \
416   nanoscale/renderservers.tcl \
417   nanovis/Makefile \
418   nanovis/newmat11/Makefile \
419   nanovis/R2/src/Makefile \
420   nanovis/vrmath/Makefile \
421   nanovis/imgLoaders/Makefile \
422   pymolproxy/Makefile \
423   vtkvis/Doxyfile \
424   vtkvis/Makefile \
425   start_viz.sh \
426   start_nanoscale.sh])
Note: See TracBrowser for help on using the repository browser.