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

Last change on this file since 2618 was 2618, checked in by gah, 8 years ago
File size: 8.8 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
228AC_MSG_RESULT([${DX_INC_DIR}])
229
230DX_LIB_DIR=""
231for dir in \
232 /usr/lib \
233 /usr/lib64 \
234 /usr/dx/lib_linux \
235 /usr/lib/dx/lib_linux \
236 /usr/lib64/dx/lib_linux \
237 /apps/rappture/lib
238do
239  saveLDFLAGS=$LDFLAGS
240  LDFLAGS="-L$dir $LDFLAGS"
241  unset ac_cv_lib_DXcallm_DXGetComponentValue
242  AC_CHECK_LIB([DXcallm], [DXGetComponentValue], [found=yes], [found=no], [-lX11])
243  LDFLAGS=$saveLDFLAGS
244  if test "$found" = "yes" ; then
245    DX_LIB_DIR="$dir"
246    break
247  fi
248done
249if test "x${DX_LIB_DIR}" = "x" ; then
250  AC_MSG_WARN([cannot find OpenDX libraries])
251fi
252
253AC_MSG_CHECKING([for libDXcallm library])
254if test "x${DX_LIB_DIR}" = "x" -o "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then
255  DX_LIB_SPEC=""
256else
257  DX_LIB_SPEC="-L${DX_LIB_DIR}"
258fi
259AC_MSG_RESULT([$DX_LIB_SPEC])
260
261AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h])
262AC_CHECK_LIB([highgui], [cvLoadImage])
263
264save_CPPFLAGS=$CPPFLAGS
265# Test for redhat-specific location of ffmpeg headers.
266if test -d "/usr/include/ffmpeg" ; then
267  CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
268  FF_INC_SPEC="-I/usr/include/ffmpeg"
269fi
270
271AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h],,,[
272#define SIZEOF_LONG ${ac_cv_sizeof_long}
273#if SIZEOF_LONG == 8
274#  define INT64_C(c)  c ## L
275#  define UINT64_C(c) c ## UL
276#else
277#  define INT64_C(c)  c ## LL
278#  define UINT64_C(c) c ## ULL
279#endif
280])
281CPPFLAGS=$save_CPPFLAGS
282
283AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
284# Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
285AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
286    AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
287        [AC_MSG_WARN([libavformat not usable])]))
288AC_CHECK_FUNCS([avformat_alloc_context])
289AC_CHECK_LIB([avutil], [av_free])
290AC_CHECK_FUNCS([img_convert])
291
292
293AC_MSG_CHECKING([for nVidia Cg installation])
294CG_DIR=""
295for dir in \
296 /opt/nvidia-cg-toolkit \
297 /usr/cg \
298 /usr
299do
300  if test -r "$dir/include" ; then
301    CG_DIR=$dir
302    break
303  fi
304done
305AC_MSG_RESULT([${CG_DIR}])
306
307CG_INC_DIR="$dir/include"
308CG_LIB_DIR="$dir/lib"
309
310save_CPPFLAGS=$CPPFLAGS
311CPPFLAGS="-I${CG_INC_DIR} $CPPFLAGS"
312AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers]))
313CPPFLAGS=$save_CPPFLAGS
314
315if test "${CG_DIR}" = "/usr" ; then
316  CG_DIR=""
317else
318  LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
319fi
320
321SUBDIRS="nanoscale nanovis pymolproxy vtkvis"
322
323AC_SUBST(CFLAGS_DEBUG)
324AC_SUBST(CFLAGS_OPTIMIZE)
325AC_SUBST(CG_DIR)
326AC_SUBST(CG_INC_DIR)
327AC_SUBST(CG_LIB_DIR)
328AC_SUBST(DX_INC_SPEC)
329AC_SUBST(DX_LIB_SPEC)
330AC_SUBST(FF_INC_SPEC)
331AC_SUBST(LD_RPATH)
332AC_SUBST(RP_DIR)
333AC_SUBST(RP_INC_SPEC)
334AC_SUBST(RP_LIB_DIR)
335AC_SUBST(SHLIB_CFLAGS)
336AC_SUBST(SHLIB_LD)
337AC_SUBST(SHLIB_LDFLAGS)
338AC_SUBST(SHLIB_SUFFIX)
339AC_SUBST(SIZEOF_FLOAT)
340AC_SUBST(SIZEOF_INT)
341AC_SUBST(SIZEOF_LONG)
342AC_SUBST(SIZEOF_LONG_LONG)
343AC_SUBST(SIZEOF_VOID_P)
344AC_SUBST(STLIB_LD)
345AC_SUBST(SUBDIRS)
346AC_SUBST(PYTHON)
347AC_SUBST(TCL_INC_SPEC)
348AC_SUBST(TCL_LIB_SPEC)
349AC_SUBST(TCL_VERSION)
350AC_SUBST(VERSION)
351AC_SUBST(VTK_INC_SPEC)
352AC_SUBST(VTK_LIB_DIR)
353
354AC_OUTPUT([
355   Makefile \
356   nanoscale/Makefile \
357   nanoscale/renderservers.tcl \
358   nanovis/Makefile \
359   nanovis/newmat11/Makefile \
360   nanovis/R2/src/Makefile \
361   nanovis/vrutil/Makefile \
362   nanovis/vrmath/Makefile \
363   nanovis/vr3d/Makefile \
364   nanovis/imgLoaders/Makefile \
365   nanovis/transfer-function/Makefile \
366   pymolproxy/Makefile \
367   pymolproxy/pymol \
368   vtkvis/Doxyfile \
369   vtkvis/Makefile \
370   start_viz.sh \
371   start_nanoscale.sh])
Note: See TracBrowser for help on using the repository browser.