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

Last change on this file since 3464 was 3436, checked in by ldelgass, 7 years ago

Add docs make target for nanovis

File size: 9.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
43AC_ARG_WITH(
44    [statsdir],
45    [AS_HELP_STRING([--with-statsdir=DIR],
46        [Write statics in DIR])],
47    [STATSDIR=$withval],
48    [STATSDIR="/var/tmp/visservers"])
49
50VERSION=0.0.1
51
52#------------------------------------------------------------------------
53# Handle the --prefix=... option
54#------------------------------------------------------------------------
55
56if test "${prefix}" = "NONE"; then
57    prefix=/usr/local
58fi
59if test "${exec_prefix}" = "NONE"; then
60    exec_prefix=$prefix
61fi
62
63if test "x${incdir}" == "x"; then
64  incdir=${exec_prefix}/include
65fi
66libdir=${exec_prefix}/lib
67
68if test "${libdir}" != "${prefix}/lib"; then
69    LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}"
70else
71    LIB_SEARCH_DIRS="-L ${libdir}"
72fi
73
74SC_CONFIG_CFLAGS
75
76
77AC_PATH_X
78
79AC_PROG_INSTALL
80AC_PROG_RANLIB
81AC_PROG_LN_S
82AC_PROG_MKDIR_P
83
84dnl find and test the C compiler
85AC_PROG_CC
86AC_PROG_CPP
87AC_PROG_CXXCPP
88AC_PROG_CXX
89AC_LANG_CPLUSPLUS
90
91AC_C_BIGENDIAN
92AC_CHECK_SIZEOF(int, 4)
93AC_CHECK_SIZEOF(long, 4)
94AC_CHECK_SIZEOF(long long, 8)
95AC_CHECK_SIZEOF(void *, 4)
96AC_CHECK_SIZEOF(float, 4)
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
102LD_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
117TCL_VERSION="8.4"
118for 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
128done
129TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
130
131if 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}"
137fi
138if test "x$with_tclinclude" != "x" ; then
139   TCL_INC_SPEC="-I${with_tclinclude}"
140fi
141
142RP_DIR=""
143AC_MSG_CHECKING([for rappture])
144if 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
155else
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"
162fi
163if test "x${RP_DIR}" = "x" ; then
164  AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture])
165else
166  AC_MSG_RESULT([$with_rappture])
167fi
168
169# This could be temporary. We are assuming that we're using VTK 6+.
170# Since VTK 6 hasn't been released, we will look it only in the
171# Rappture build directories.
172VTK_LIB_DIR=${libdir}
173dnl Prefer our VTK installation over systems. --with-vtk overrides.
174if test "$with_vtk" != "no" ; then
175  if test "$with_vtk" = "yes" ; then
176    for dir in vtk-6.{10,9,8,7,6,5,4,3,2,1,0} ; do
177      if test -d "${incdir}/$dir"; then
178        VTK_INC_SPEC="-I${incdir}/$dir"
179        break
180      fi
181    done
182  fi
183fi
184
185if test "x$with_vtk_includes" != "x"; then
186   VTK_INC_SPEC=-I$with_vtk_includes
187fi
188
189if test "x$with_vtk_libs" != "x"; then
190   VTK_LIB_DIR=$with_vtk_libs
191   VTK_LIB_SPEC="-L$with_vtk_libs"
192fi
193
194save_CPPFLAGS=$CPPFLAGS
195CPPFLAGS=$VTK_INC_SPEC
196AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_WARN([cannot find vtkSmartPointer.h])])
197CPPFLAGS=$save_CPPFLAGS
198
199AC_CHECK_HEADER([GL/glut.h])
200AC_CHECK_HEADER([GL/glew.h])
201
202AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
203AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
204
205AC_CHECK_FUNCS([accept4])
206
207save_CPPFLAGS=$CPPFLAGS
208# Test for redhat-specific location of ffmpeg headers.
209if test -d "/usr/include/ffmpeg" ; then
210  CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
211  FF_INC_SPEC="-I/usr/include/ffmpeg"
212fi
213
214AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h],,,[
215#define __STDC_CONSTANT_MACROS 1
216])
217CPPFLAGS=$save_CPPFLAGS
218
219AC_CHECK_LIB(avcodec, main,,AC_MSG_ERROR(requires libavcodec))
220AC_CHECK_LIB(avutil, main,,AC_MSG_ERROR(requires libavutil))
221AC_CHECK_LIB(avformat, main,,AC_MSG_ERROR(requires libavformat))
222AC_CHECK_LIB(swscale, main)
223AC_CHECK_FUNCS(avcodec_register_all)
224AC_CHECK_FUNCS(avcodec_init)
225AC_CHECK_FUNCS(avformat_new_stream)
226AC_CHECK_FUNCS(av_new_stream)
227AC_CHECK_FUNCS(avcodec_open)
228AC_CHECK_FUNCS(avcodec_open2)
229AC_CHECK_FUNCS(avcodec_decode_video2)
230AC_CHECK_FUNCS(avcodec_decode_video)
231AC_CHECK_FUNCS(avcodec_encode_video2)
232AC_CHECK_FUNCS(avcodec_encode_video)
233AC_CHECK_FUNCS(avformat_open_input)
234AC_CHECK_FUNCS(av_open_input_file)
235AC_CHECK_FUNCS(av_guess_format)
236AC_CHECK_FUNCS(guess_format)
237AC_CHECK_FUNCS(av_dump_format)
238AC_CHECK_FUNCS(dump_format)
239AC_CHECK_FUNCS(avio_open)
240AC_CHECK_FUNCS(url_fopen)
241AC_CHECK_FUNCS(avio_close)
242AC_CHECK_FUNCS(url_fclose)
243AC_CHECK_FUNCS(avformat_alloc_context)
244AC_CHECK_FUNCS(av_alloc_format_context)
245AC_CHECK_FUNCS(av_set_parameters)
246AC_CHECK_FUNCS(avformat_write_header)
247AC_CHECK_FUNCS(av_write_header)
248AC_CHECK_FUNC(av_write_trailer,,
249  AC_MSG_ERROR(oops! no av_write_trailer?!?))
250AC_CHECK_FUNC(av_freep,, AC_MSG_ERROR(oops! no av_freep ?!?))
251AC_CHECK_FUNC(av_free,,AC_MSG_ERROR(oops! no av_free ?!?))
252AC_CHECK_FUNC(av_new_stream,,AC_MSG_ERROR(oops! av_new_stream ?!?))
253AC_CHECK_FUNC(av_malloc,, AC_MSG_ERROR(oops! no av_malloc ?!?))
254AC_CHECK_FUNC(av_init_packet,,AC_MSG_ERROR(oops! no av_init_packet ?!?))
255AC_CHECK_FUNC(av_rescale_q,,AC_MSG_ERROR(oops! no av_rescale_q ?!?))
256AC_CHECK_FUNC(av_write_frame,,AC_MSG_ERROR(oops! av_write_frame ?!?))
257AC_CHECK_FUNCS(img_convert)
258AC_CHECK_FUNCS(sws_scale)
259AC_TRY_COMPILE([
260#define __STDC_CONSTANT_MACROS 1
261#include <stdlib.h>
262#ifdef HAVE_FFMPEG_AVCODEC_H
263# include <ffmpeg/avcodec.h>
264#endif
265#ifdef HAVE_LIBAVCODEC_AVCODEC_H
266# include <libavcodec/avcodec.h>
267#endif
268int x = AVMEDIA_TYPE_VIDEO;
269],, ac_avmedia_type_video="yes", ac_avmedia_type_video="no")
270if test "$ac_avmedia_type_video" == "yes" ; then
271  AC_DEFINE(HAVE_AVMEDIA_TYPE_VIDEO,1,[Define if AVMEDIA_TYPE_VIDEO enum exists. ])
272fi
273
274AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
275# Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
276AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
277    AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
278        [AC_MSG_WARN([libavformat not usable])]))
279
280
281AC_MSG_CHECKING([for nVidia Cg installation])
282CG_DIR=""
283for dir in \
284 /opt/nvidia-cg-toolkit \
285 /usr/cg \
286 /usr
287do
288  if test -r "$dir/include" ; then
289    CG_DIR=$dir
290    break
291  fi
292done
293AC_MSG_RESULT([${CG_DIR}])
294
295CG_INC_SPEC="-I${CG_DIR}/include"
296
297save_CPPFLAGS=$CPPFLAGS
298CPPFLAGS="${CG_INC_SPEC} $CPPFLAGS"
299AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers]))
300CPPFLAGS=$save_CPPFLAGS
301
302CG_LIB_DIR=""
303for dir in \
304 /opt/nvidia-cg-toolkit \
305 /usr/cg \
306 /usr
307do
308  if test -r "$dir/lib" ; then
309    CG_LIB_DIR=$dir/lib
310    break
311  fi
312  if test -r "$dir/lib64" ; then
313    CG_LIB_DIR=$dir/lib64
314    break
315  fi
316done
317
318if test "${CG_LIB_DIR}" = "/usr/lib" ; then
319  CG_INC_SPEC=""
320  CG_LIB_SPEC="-lCg -lCgGL"
321else
322  CG_LIB_SPEC="-L${CG_LIB_DIR} -lCg -lCgGL"
323  LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
324fi
325
326SUBDIRS="nanoscale nanovis pymolproxy vtkvis"
327
328AC_SUBST(CFLAGS_DEBUG)
329AC_SUBST(CFLAGS_OPTIMIZE)
330AC_SUBST(CG_INC_SPEC)
331AC_SUBST(CG_LIB_SPEC)
332AC_SUBST(FF_INC_SPEC)
333AC_SUBST(LD_RPATH)
334AC_SUBST(RP_DIR)
335AC_SUBST(RP_INC_SPEC)
336AC_SUBST(RP_LIB_DIR)
337AC_SUBST(SHLIB_CFLAGS)
338AC_SUBST(SHLIB_LD)
339AC_SUBST(SHLIB_LDFLAGS)
340AC_SUBST(SHLIB_SUFFIX)
341AC_SUBST(SIZEOF_FLOAT)
342AC_SUBST(SIZEOF_INT)
343AC_SUBST(SIZEOF_LONG)
344AC_SUBST(SIZEOF_LONG_LONG)
345AC_SUBST(SIZEOF_VOID_P)
346AC_SUBST(STATSDIR)
347AC_SUBST(STLIB_LD)
348AC_SUBST(SUBDIRS)
349AC_SUBST(PYTHON)
350AC_SUBST(TCL_INC_SPEC)
351AC_SUBST(TCL_LIB_SPEC)
352AC_SUBST(TCL_VERSION)
353AC_SUBST(VERSION)
354AC_SUBST(VTK_INC_SPEC)
355AC_SUBST(VTK_LIB_DIR)
356
357AC_OUTPUT([
358   Makefile \
359   nanoscale/Makefile \
360   nanoscale/renderservers.tcl \
361   nanovis/Doxyfile \
362   nanovis/Makefile \
363   nanovis/newmat11/Makefile \
364   nanovis/R2/src/Makefile \
365   nanovis/vrmath/Makefile \
366   nanovis/imgLoaders/Makefile \
367   pymolproxy/Makefile \
368   vtkvis/Doxyfile \
369   vtkvis/Makefile \
370   start_viz.sh \
371   start_nanoscale.sh])
Note: See TracBrowser for help on using the repository browser.