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

Last change on this file since 2101 was 2101, checked in by ldelgass, 13 years ago

Include vtkvis in build, vizservers startup script. Added --with-vtk-includes
and --with-vtk-libs options to vizservers configure. Also, require autoconf
2.60, since AC_PROG_MKDIR_P doesn't exist in earlier versions (e.g. on RHEL 5
which has autoconf 2.59).

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