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

Last change on this file since 2217 was 2198, checked in by gah, 13 years ago

fixes for vizservers build on render servers

File size: 8.7 KB
Line 
1AC_PREREQ([2.60])
2AC_INIT(vizservers, 0.1, rappture@nanohub.org)
3AC_CONFIG_HEADER(nanovis/nvconf.h nanoscale/config.h)
4
5with_vtk="yes"
6with_vtk_libs=""
7with_vtk_includes=""
8with_rappture=""
9with_tcllib=""
10with_rappture="yes"
11
12AC_ARG_WITH(
13    [tcllib],
14    [AS_HELP_STRING([--with-tcllib[=DIR]],
15        [location of Tcl binary library libtclstubs.a @<:@default=/usr/lib@:>@])],
16    [with_tcllib=$withval],
17    [with_tcllib=""])
18
19AC_ARG_WITH(
20    [rappture],
21    [AS_HELP_STRING([--with-rappture[=DIR]],
22        [location of rappture files lib/librappture.a and include/rappture.h @<:@default=/usr@:>@])],
23    [with_rappture=$withval],
24    [with_rappture=yes])
25
26AC_ARG_WITH(
27    [vtk-includes],
28    [AS_HELP_STRING([--with-vtk-includes=DIR],
29        [VTK include files are in DIR])],
30    [with_vtk_includes=$withval],
31    [with_vtk_includes=/usr/include/vtk-5.6])
32
33AC_ARG_WITH(
34    [vtk-libs],
35    [AS_HELP_STRING([--with-vtk-libs=DIR],
36        [VTK libraries are in DIR])],
37    [with_vtk_libs=$withval],
38    [with_vtk_libs=/usr/lib/vtk-5.6])
39
40AC_ARG_WITH(
41    [vtk],
42    [AS_HELP_STRING([--with-vtk=VERSION],
43        [Version of VTK required])],
44    [with_vtk=$withval],
45    [with_vtk=yes])
46
47VERSION=0.0.1
48
49#------------------------------------------------------------------------
50# Handle the --prefix=... option
51#------------------------------------------------------------------------
52
53if test "${prefix}" = "NONE"; then
54    prefix=/usr/local
55fi
56if test "${exec_prefix}" = "NONE"; then
57    exec_prefix=$prefix
58fi
59
60if test "x${incdir}" == "x"; then
61  incdir=${exec_prefix}/include
62fi
63libdir=${exec_prefix}/lib
64
65if test "${libdir}" != "${prefix}/lib"; then
66    LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}"
67else
68    LIB_SEARCH_DIRS="-L ${libdir}"
69fi
70
71SC_CONFIG_CFLAGS
72
73
74AC_PATH_X
75
76AC_PROG_INSTALL
77AC_PROG_RANLIB
78AC_PROG_LN_S
79AC_PROG_MKDIR_P
80
81dnl find and test the C compiler
82AC_PROG_CC
83AC_PROG_CPP
84AC_PROG_CXXCPP
85AC_PROG_CXX
86AC_LANG_CPLUSPLUS
87
88AC_C_BIGENDIAN
89AC_CHECK_SIZEOF(int, 4)
90AC_CHECK_SIZEOF(long, 4)
91AC_CHECK_SIZEOF(long long, 8)
92AC_CHECK_SIZEOF(void *, 4)
93AC_CHECK_SIZEOF(float, 4)
94
95# Save the values as shell variables so that we can substitute them
96# into bltHash.h for situtations where there's no bltInt.h.
97
98
99LD_RPATH="";
100
101#
102# Need to check for the following dependencies:
103#       Rappture headers and library (done)
104#       Tcl headers and library (done)
105#       GL headers and library
106#       GLuT headers and library
107#       GLui header and library
108#       GLEW header and library
109#       Cg headers and library
110#       CgGL headers and library
111#       pthread library
112#       DX headers and library (done, sort of)
113#       ffmpeg headers and library (started)
114#
115
116TCL_VERSION="8.4"
117for dir in \
118 ${exec_prefix} \
119 ${exec_prefix}/lib \
120 ${with_rappture} \
121 ${with_rappture}/lib ; do
122  tclconfig="${dir}/tclConfig.sh"
123  if test -f "$tclconfig" ; then
124    . $tclconfig
125    break
126  fi
127done
128TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
129
130if test "x$with_tcllib" != "x" ; then
131   tclconfig="${with_tcllib}/tclConfig.sh"
132   if test -f "$tclconfig" ; then
133    . $tclconfig
134   fi
135   TCL_LIB_SPEC="-L${with_tcllib} -ltcl${TCL_VERSION}"
136fi
137if test "x$with_tclinclude" != "x" ; then
138   TCL_INC_SPEC="-I${with_tclinclude}"
139fi
140
141RP2_INCL_DIR=""
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_INCL_SPEC="-I$dir/include"
149      RP_DIR="$dir"
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_LIB=$with_rappture
160  RP_INCL_SPEC="-I$with_rappture/include"
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
169dnl Prefer our VTK installation over systems. --with-vtk overrides.
170if test "$with_vtk" != "no" ; then
171  if test "$with_vtk" = "yes" ; then
172    for dir in vtk-5.{9,8,7,6,5,4,3,2,1} ; do
173      if test -d "${libdir}/$dir" -a -d "${incdir}/$dir"; then
174        VTK_LIB_SPEC="-L${libdir}/$dir"
175        VTK_LIB_DIR="${libdir}/$dir"
176        VTK_INC_SPEC="-I${incdir}/$dir"
177        break
178      fi
179      if test -d "/usr/lib/$dir" -a -d "/usr/include/$dir"; then
180        VTK_LIB_SPEC=-L/usr/lib/$dir
181        VTK_LIB_DIR=/usr/lib/$dir
182        VTK_INC_SPEC=-I/usr/include/$dir
183        break
184      fi
185    done
186  fi
187fi
188
189if test "x$with_vtk_includes" != "x"; then
190   VTK_INC_SPEC=-I$with_vtk_includes
191fi
192
193if test "x$with_vtk_libs" != "x"; then
194   VTK_LIB_DIR=$with_vtk_libs
195fi
196
197save_CPPFLAGS=$CPPFLAGS
198CPPFLAGS=$VTK_INC_SPEC
199AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_ERROR([cannot find VTK includes])])
200CPPFLAGS=$save_CPPFLAGS
201
202AC_CHECK_HEADER([GL/glui.h])
203AC_CHECK_HEADER([glui.h])
204AC_CHECK_HEADER([GL/glut.h])
205AC_CHECK_HEADER([GL/glew.h])
206
207AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
208AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
209
210AC_MSG_CHECKING([for OpenDX headers])
211DX_INC_DIR=""
212for dir in \
213 /apps/rappture/include \
214 /usr/dx/include \
215 /usr/include
216do
217  if test -r "${dir}/dx/dx.h" ; then
218    DX_INC_DIR="$dir"
219    break
220  fi
221done
222if test "x${DX_INC_DIR}" = "x" ; then
223  AC_MSG_ERROR([cannot find OpenDX include files])
224fi
225
226if test "${DX_INC_DIR}" = "/usr/include" ; then
227  DX_INC_SPEC=""
228else
229  DX_INC_SPEC="-I{DX_INC_DIR}"
230fi
231AC_MSG_RESULT([${DX_INC_DIR}])
232
233DX_LIB_DIR=""
234found=no
235for dir in \
236 /usr/lib \
237 /usr/lib64 \
238 /usr/dx/lib_linux \
239 /usr/lib/dx/lib_linux \
240 /usr/lib64/dx/lib_linux \
241 /apps/rappture/lib
242do
243  saveLDFLAGS=$LDFLAGS
244  LDFLAGS="-L$dir $LDFLAGS"
245  unset ac_cv_lib_DXcallm_DXGetComponentValue
246  AC_CHECK_LIB([DXcallm], [DXGetComponentValue], [found=yes], [found=no], [-lX11])
247  LDFLAGS=$saveLDFLAGS
248  if test "$found" = "yes" ; then
249    DX_LIB_DIR="$dir"
250    break
251  fi
252done
253if test "x{$DX_LIB_DIR}" = "x" ; then
254  AC_MSG_ERROR([cannot find OpenDX libraries])
255fi
256
257AC_MSG_CHECKING([for libDXcallm library])
258if test "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then
259  DX_LIB_SPEC=""
260else
261  DX_LIB_SPEC="-L${DX_LIB_DIR}"
262fi
263AC_MSG_RESULT([$DX_LIB_SPEC])
264
265AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h])
266AC_CHECK_LIB([cv], [cvLoadImage])
267
268save_CPPFLAGS=$CPPFLAGS
269# Test for redhat-specific location of ffmpeg headers.
270if test -d "/usr/include/ffmpeg" ; then
271  CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
272  FF_INC_SPEC="-I/usr/include/ffmpeg"
273fi
274
275AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h],,,[
276#define SIZEOF_LONG ${ac_cv_sizeof_long}
277#if SIZEOF_LONG == 8
278#  define INT64_C(c)  c ## L
279#  define UINT64_C(c) c ## UL
280#else
281#  define INT64_C(c)  c ## LL
282#  define UINT64_C(c) c ## ULL
283#endif
284])
285CPPFLAGS=$save_CPPFLAGS
286
287AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
288# Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
289AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
290    AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
291        [AC_MSG_WARN([libavformat not usable])]))
292AC_CHECK_LIB([avutil], [av_free])
293AC_CHECK_FUNCS([img_convert])
294
295
296AC_MSG_CHECKING([for nVidia Cg installation])
297CG_DIR=""
298for dir in \
299 /opt/nvidia-cg-toolkit \
300 /usr/cg \
301 /usr
302do
303  if test -r "$dir/include" ; then
304    CG_DIR=$dir
305    break
306  fi
307done
308AC_MSG_RESULT([${CG_DIR}])
309
310CG_INC_DIR="$dir/include"
311CG_LIB_DIR="$dir/lib"
312
313echo CGDIR=$CG_DIR
314save_CPPFLAGS=$CPPFLAGS
315CPPFLAGS="-I${CG_INC_DIR} $CPPFLAGS"
316AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_ERROR([cannot find nVidia Cg headers]))
317CPPFLAGS=$save_CPPFLAGS
318
319 if test "${CG_DIR}" = "/usr" ; then
320  CG_DIR=""
321else
322  LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
323fi
324
325SUBDIRS="nanoscale nanovis pymolproxy vtkvis"
326
327AC_SUBST(CFLAGS_DEBUG)
328AC_SUBST(CFLAGS_OPTIMIZE)
329AC_SUBST(CG_DIR)
330AC_SUBST(CG_INC_DIR)
331AC_SUBST(CG_LIB_DIR)
332AC_SUBST(DX_INC_SPEC)
333AC_SUBST(DX_LIB_SPEC)
334AC_SUBST(FF_INC_SPEC)
335AC_SUBST(LD_RPATH)
336AC_SUBST(RP_DIR)
337AC_SUBST(RP_INC_SPEC)
338AC_SUBST(RP_LIB_DIR)
339AC_SUBST(SHLIB_CFLAGS)
340AC_SUBST(SHLIB_LD)
341AC_SUBST(SHLIB_LDFLAGS)
342AC_SUBST(SHLIB_SUFFIX)
343AC_SUBST(SIZEOF_FLOAT)
344AC_SUBST(SIZEOF_INT)
345AC_SUBST(SIZEOF_LONG)
346AC_SUBST(SIZEOF_LONG_LONG)
347AC_SUBST(SIZEOF_VOID_P)
348AC_SUBST(STLIB_LD)
349AC_SUBST(SUBDIRS)
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   nanovis/Makefile \
361   nanovis/newmat11/Makefile \
362   nanovis/R2/src/Makefile \
363   nanovis/vrutil/Makefile \
364   nanovis/vrmath/Makefile \
365   nanovis/vr3d/Makefile \
366   nanovis/imgLoaders/Makefile \
367   nanovis/transfer-function/Makefile \
368   pymolproxy/Makefile \
369   vtkvis/Doxyfile \
370   vtkvis/Makefile \
371   start_viz.sh])
372 
Note: See TracBrowser for help on using the repository browser.