source: branches/blt4/packages/vizservers/configure.in @ 2742

Last change on this file since 2742 was 2742, checked in by gah, 11 years ago

sync with trunk

File size: 10.5 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
164dnl Prefer our VTK installation over systems. --with-vtk overrides.
165if 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
182fi
183
184if test "x$with_vtk_includes" != "x"; then
185   VTK_INC_SPEC=-I$with_vtk_includes
186fi
187
188if test "x$with_vtk_libs" != "x"; then
189   VTK_LIB_DIR=$with_vtk_libs
190   VTK_LIB_SPEC="-L$with_vtk_libs"
191fi
192
193save_CPPFLAGS=$CPPFLAGS
194CPPFLAGS=$VTK_INC_SPEC
195AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_WARN([cannot find vtkSmartPointer.h])])
196CPPFLAGS=$save_CPPFLAGS
197
198AC_CHECK_HEADER([GL/glui.h])
199AC_CHECK_HEADER([glui.h])
200AC_CHECK_HEADER([GL/glut.h])
201AC_CHECK_HEADER([GL/glew.h])
202
203AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
204AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
205
206AC_CHECK_FUNCS([accept4])
207
208AC_MSG_CHECKING([for OpenDX headers])
209DX_INC_DIR=""
210for dir in \
211 /apps/rappture/include \
212 /usr/dx/include \
213 /usr/include
214do
215  if test -r "${dir}/dx/dx.h" ; then
216    DX_INC_DIR="$dir"
217    break
218  fi
219done
220if test "x${DX_INC_DIR}" = "x" ; then
221  AC_MSG_WARN([cannot find OpenDX include files])
222  DX_INC_SPEC=""
223elif test "${DX_INC_DIR}" = "/usr/include" ; then
224  DX_INC_SPEC=""
225else
226  DX_INC_SPEC="-I{DX_INC_DIR}"
227fi
228
229AC_MSG_RESULT([${DX_INC_DIR}])
230save_CPPFLAGS=${CPPFLAGS}
231CPPFLAGS="$DX_INC_SPEC $CPPFLAGS"
232AC_CHECK_HEADERS(dx/dx.h)
233CPPFLAGS=${save_CPPFLAGS}
234
235DX_LIB_DIR=""
236for 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
243do
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
253done
254if test "x${DX_LIB_DIR}" = "x" ; then
255  AC_MSG_WARN([cannot find OpenDX libraries])
256fi
257
258AC_MSG_CHECKING([for libDXcallm library])
259if test "x${DX_LIB_DIR}" = "x" -o "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then
260  DX_LIB_SPEC=""
261else
262  DX_LIB_SPEC="-L${DX_LIB_DIR} -lDXcallm"
263fi
264AC_MSG_RESULT([$DX_LIB_SPEC])
265
266AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h])
267AC_CHECK_LIB([highgui], [cvLoadImage])
268
269save_CPPFLAGS=$CPPFLAGS
270# Test for redhat-specific location of ffmpeg headers.
271if test -d "/usr/include/ffmpeg" ; then
272  CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
273  FF_INC_SPEC="-I/usr/include/ffmpeg"
274fi
275
276AC_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])
279CPPFLAGS=$save_CPPFLAGS
280
281AC_CHECK_LIB(avcodec, main,,AC_MSG_ERROR(requires libavcodec))
282AC_CHECK_LIB(avutil, main,,AC_MSG_ERROR(requires libavutil))
283AC_CHECK_LIB(avformat, main,,AC_MSG_ERROR(requires libavformat))
284AC_CHECK_LIB(swscale, main)
285AC_CHECK_FUNCS(avcodec_decode_video2)
286AC_CHECK_FUNCS(avcodec_decode_video)
287AC_CHECK_FUNCS(avformat_open_input)
288AC_CHECK_FUNCS(av_open_input_file)
289AC_CHECK_FUNCS(av_guess_format)
290AC_CHECK_FUNCS(guess_format)
291AC_CHECK_FUNCS(av_dump_format)
292AC_CHECK_FUNCS(dump_format)
293AC_CHECK_FUNCS(avio_open)
294AC_CHECK_FUNCS(url_fopen)
295AC_CHECK_FUNCS(avio_close)
296AC_CHECK_FUNCS(url_fclose)
297AC_CHECK_FUNCS(avformat_alloc_context)
298AC_CHECK_FUNCS(av_alloc_format_context)
299AC_CHECK_FUNCS(av_set_parameters)
300AC_CHECK_FUNCS(avformat_write_header)
301AC_CHECK_FUNCS(av_write_header)
302AC_CHECK_FUNC(av_write_trailer,,
303  AC_MSG_ERROR(oops! no av_write_trailer?!?))
304AC_CHECK_FUNC(av_freep,, AC_MSG_ERROR(oops! no av_freep ?!?))
305AC_CHECK_FUNC(av_free,,AC_MSG_ERROR(oops! no av_free ?!?))
306AC_CHECK_FUNC(av_new_stream,,AC_MSG_ERROR(oops! av_new_stream ?!?))
307AC_CHECK_FUNC(av_malloc,, AC_MSG_ERROR(oops! no av_malloc ?!?))
308AC_CHECK_FUNC(av_init_packet,,AC_MSG_ERROR(oops! no av_init_packet ?!?))
309AC_CHECK_FUNC(av_rescale_q,,AC_MSG_ERROR(oops! no av_rescale_q ?!?))
310AC_CHECK_FUNC(av_write_frame,,AC_MSG_ERROR(oops! av_write_frame ?!?))
311AC_CHECK_FUNC(avformat_alloc_context,,
312  AC_MSG_ERROR(oops! avformat_alloc_context ?!?))
313AC_CHECK_FUNCS(img_convert)
314AC_CHECK_FUNCS(sws_scale)
315AC_TRY_COMPILE([
316#define __STDC_CONSTANT_MACROS 1
317#include <stdlib.h>
318#ifdef HAVE_FFMPEG_AVCODEC_H
319# include <ffmpeg/avcodec.h>
320#endif
321#ifdef HAVE_LIBAVCODEC_AVCODEC_H
322# include <libavcodec/avcodec.h>
323#endif
324int x = AVMEDIA_TYPE_VIDEO;
325],, ac_avmedia_type_video="yes", ac_avmedia_type_video="no")
326if test "$ac_avmedia_type_video" == "yes" ; then
327  AC_DEFINE(HAVE_AVMEDIA_TYPE_VIDEO,1,[Define if AVMEDIA_TYPE_VIDEO enum exists. ])
328fi
329
330AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
331# Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
332AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
333    AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
334        [AC_MSG_WARN([libavformat not usable])]))
335
336
337AC_MSG_CHECKING([for nVidia Cg installation])
338CG_DIR=""
339for dir in \
340 /opt/nvidia-cg-toolkit \
341 /usr/cg \
342 /usr
343do
344  if test -r "$dir/include" ; then
345    CG_DIR=$dir
346    break
347  fi
348done
349AC_MSG_RESULT([${CG_DIR}])
350
351CG_INC_DIR="$dir/include"
352CG_LIB_DIR="$dir/lib"
353
354save_CPPFLAGS=$CPPFLAGS
355CPPFLAGS="-I${CG_INC_DIR} $CPPFLAGS"
356AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers]))
357CPPFLAGS=$save_CPPFLAGS
358
359if test "${CG_DIR}" = "/usr" ; then
360  CG_DIR=""
361else
362  LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
363fi
364
365SUBDIRS="nanoscale nanovis pymolproxy vtkvis"
366
367AC_SUBST(CFLAGS_DEBUG)
368AC_SUBST(CFLAGS_OPTIMIZE)
369AC_SUBST(CG_DIR)
370AC_SUBST(CG_INC_DIR)
371AC_SUBST(CG_LIB_DIR)
372AC_SUBST(DX_INC_SPEC)
373AC_SUBST(DX_LIB_SPEC)
374AC_SUBST(FF_INC_SPEC)
375AC_SUBST(LD_RPATH)
376AC_SUBST(RP_DIR)
377AC_SUBST(RP_INC_SPEC)
378AC_SUBST(RP_LIB_DIR)
379AC_SUBST(SHLIB_CFLAGS)
380AC_SUBST(SHLIB_LD)
381AC_SUBST(SHLIB_LDFLAGS)
382AC_SUBST(SHLIB_SUFFIX)
383AC_SUBST(SIZEOF_FLOAT)
384AC_SUBST(SIZEOF_INT)
385AC_SUBST(SIZEOF_LONG)
386AC_SUBST(SIZEOF_LONG_LONG)
387AC_SUBST(SIZEOF_VOID_P)
388AC_SUBST(STLIB_LD)
389AC_SUBST(SUBDIRS)
390AC_SUBST(PYTHON)
391AC_SUBST(TCL_INC_SPEC)
392AC_SUBST(TCL_LIB_SPEC)
393AC_SUBST(TCL_VERSION)
394AC_SUBST(VERSION)
395AC_SUBST(VTK_INC_SPEC)
396AC_SUBST(VTK_LIB_DIR)
397
398AC_OUTPUT([
399   Makefile \
400   nanoscale/Makefile \
401   nanoscale/renderservers.tcl \
402   nanovis/Makefile \
403   nanovis/newmat11/Makefile \
404   nanovis/R2/src/Makefile \
405   nanovis/vrutil/Makefile \
406   nanovis/vrmath/Makefile \
407   nanovis/vr3d/Makefile \
408   nanovis/imgLoaders/Makefile \
409   nanovis/transfer-function/Makefile \
410   pymolproxy/Makefile \
411   vtkvis/Doxyfile \
412   vtkvis/Makefile \
413   start_viz.sh \
414   start_nanoscale.sh])
Note: See TracBrowser for help on using the repository browser.