1 | AC_PREREQ([2.60]) |
---|
2 | AC_INIT(vizservers, 0.1, rappture@nanohub.org) |
---|
3 | AC_CONFIG_HEADER(nanovis/nvconf.h nanoscale/config.h) |
---|
4 | |
---|
5 | with_vtk="yes" |
---|
6 | with_vtk_libs="" |
---|
7 | with_vtk_includes="" |
---|
8 | with_rappture="" |
---|
9 | with_tcllib="" |
---|
10 | with_rappture="yes" |
---|
11 | |
---|
12 | AC_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 | |
---|
19 | AC_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 | |
---|
26 | AC_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 | |
---|
33 | AC_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 | |
---|
40 | AC_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 | |
---|
47 | VERSION=0.0.1 |
---|
48 | |
---|
49 | #------------------------------------------------------------------------ |
---|
50 | # Handle the --prefix=... option |
---|
51 | #------------------------------------------------------------------------ |
---|
52 | |
---|
53 | if test "${prefix}" = "NONE"; then |
---|
54 | prefix=/usr/local |
---|
55 | fi |
---|
56 | if test "${exec_prefix}" = "NONE"; then |
---|
57 | exec_prefix=$prefix |
---|
58 | fi |
---|
59 | |
---|
60 | if test "x${incdir}" == "x"; then |
---|
61 | incdir=${exec_prefix}/include |
---|
62 | fi |
---|
63 | libdir=${exec_prefix}/lib |
---|
64 | |
---|
65 | if test "${libdir}" != "${prefix}/lib"; then |
---|
66 | LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}" |
---|
67 | else |
---|
68 | LIB_SEARCH_DIRS="-L ${libdir}" |
---|
69 | fi |
---|
70 | |
---|
71 | SC_CONFIG_CFLAGS |
---|
72 | |
---|
73 | |
---|
74 | AC_PATH_X |
---|
75 | |
---|
76 | AC_PROG_INSTALL |
---|
77 | AC_PROG_RANLIB |
---|
78 | AC_PROG_LN_S |
---|
79 | AC_PROG_MKDIR_P |
---|
80 | |
---|
81 | dnl find and test the C compiler |
---|
82 | AC_PROG_CC |
---|
83 | AC_PROG_CPP |
---|
84 | AC_PROG_CXXCPP |
---|
85 | AC_PROG_CXX |
---|
86 | AC_LANG_CPLUSPLUS |
---|
87 | |
---|
88 | AC_C_BIGENDIAN |
---|
89 | AC_CHECK_SIZEOF(int, 4) |
---|
90 | AC_CHECK_SIZEOF(long, 4) |
---|
91 | AC_CHECK_SIZEOF(long long, 8) |
---|
92 | AC_CHECK_SIZEOF(void *, 4) |
---|
93 | AC_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 | |
---|
99 | LD_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 | |
---|
116 | TCL_VERSION="8.4" |
---|
117 | for 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 |
---|
127 | done |
---|
128 | TCL_INC_SPEC="$TCL_INCLUDE_SPEC" |
---|
129 | |
---|
130 | if 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}" |
---|
136 | fi |
---|
137 | if test "x$with_tclinclude" != "x" ; then |
---|
138 | TCL_INC_SPEC="-I${with_tclinclude}" |
---|
139 | fi |
---|
140 | |
---|
141 | RP2_INCL_DIR="" |
---|
142 | RP_DIR="" |
---|
143 | AC_MSG_CHECKING([for rappture]) |
---|
144 | if 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 |
---|
155 | else |
---|
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" |
---|
162 | fi |
---|
163 | if test "x${RP_DIR}" = "x" ; then |
---|
164 | AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture]) |
---|
165 | else |
---|
166 | AC_MSG_RESULT([$with_rappture]) |
---|
167 | fi |
---|
168 | |
---|
169 | dnl Prefer our VTK installation over systems. --with-vtk overrides. |
---|
170 | if 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 |
---|
187 | fi |
---|
188 | |
---|
189 | if test "x$with_vtk_includes" != "x"; then |
---|
190 | VTK_INC_SPEC=-I$with_vtk_includes |
---|
191 | fi |
---|
192 | |
---|
193 | if test "x$with_vtk_libs" != "x"; then |
---|
194 | VTK_LIB_DIR=$with_vtk_libs |
---|
195 | fi |
---|
196 | |
---|
197 | save_CPPFLAGS=$CPPFLAGS |
---|
198 | CPPFLAGS=$VTK_INC_SPEC |
---|
199 | AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_ERROR([cannot find VTK includes])]) |
---|
200 | CPPFLAGS=$save_CPPFLAGS |
---|
201 | |
---|
202 | AC_CHECK_HEADER([GL/glui.h]) |
---|
203 | AC_CHECK_HEADER([glui.h]) |
---|
204 | AC_CHECK_HEADER([GL/glut.h]) |
---|
205 | AC_CHECK_HEADER([GL/glew.h]) |
---|
206 | |
---|
207 | AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h]) |
---|
208 | AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h]) |
---|
209 | |
---|
210 | AC_MSG_CHECKING([for OpenDX headers]) |
---|
211 | DX_INC_DIR="" |
---|
212 | for dir in \ |
---|
213 | /apps/rappture/include \ |
---|
214 | /usr/dx/include \ |
---|
215 | /usr/include |
---|
216 | do |
---|
217 | if test -r "${dir}/dx/dx.h" ; then |
---|
218 | DX_INC_DIR="$dir" |
---|
219 | break |
---|
220 | fi |
---|
221 | done |
---|
222 | if test "x${DX_INC_DIR}" = "x" ; then |
---|
223 | AC_MSG_ERROR([cannot find OpenDX include files]) |
---|
224 | fi |
---|
225 | |
---|
226 | if test "${DX_INC_DIR}" = "/usr/include" ; then |
---|
227 | DX_INC_SPEC="" |
---|
228 | else |
---|
229 | DX_INC_SPEC="-I{DX_INC_DIR}" |
---|
230 | fi |
---|
231 | AC_MSG_RESULT([${DX_INC_DIR}]) |
---|
232 | |
---|
233 | DX_LIB_DIR="" |
---|
234 | found=no |
---|
235 | for 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 |
---|
242 | do |
---|
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 |
---|
252 | done |
---|
253 | if test "x{$DX_LIB_DIR}" = "x" ; then |
---|
254 | AC_MSG_ERROR([cannot find OpenDX libraries]) |
---|
255 | fi |
---|
256 | |
---|
257 | AC_MSG_CHECKING([for libDXcallm library]) |
---|
258 | if test "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then |
---|
259 | DX_LIB_SPEC="" |
---|
260 | else |
---|
261 | DX_LIB_SPEC="-L${DX_LIB_DIR}" |
---|
262 | fi |
---|
263 | AC_MSG_RESULT([$DX_LIB_SPEC]) |
---|
264 | |
---|
265 | AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h]) |
---|
266 | AC_CHECK_LIB([cv], [cvLoadImage]) |
---|
267 | |
---|
268 | save_CPPFLAGS=$CPPFLAGS |
---|
269 | # Test for redhat-specific location of ffmpeg headers. |
---|
270 | if test -d "/usr/include/ffmpeg" ; then |
---|
271 | CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg" |
---|
272 | FF_INC_SPEC="-I/usr/include/ffmpeg" |
---|
273 | fi |
---|
274 | |
---|
275 | AC_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 | ]) |
---|
285 | CPPFLAGS=$save_CPPFLAGS |
---|
286 | |
---|
287 | AC_CHECK_LIB([avcodec], [avcodec_alloc_frame]) |
---|
288 | # Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found |
---|
289 | AC_CHECK_LIB([avformat], [avformat_alloc_context], [], |
---|
290 | AC_CHECK_LIB([avformat], [av_alloc_format_context], [], |
---|
291 | [AC_MSG_WARN([libavformat not usable])])) |
---|
292 | AC_CHECK_LIB([avutil], [av_free]) |
---|
293 | AC_CHECK_FUNCS([img_convert]) |
---|
294 | |
---|
295 | |
---|
296 | AC_MSG_CHECKING([for nVidia Cg installation]) |
---|
297 | CG_DIR="" |
---|
298 | for dir in \ |
---|
299 | /opt/nvidia-cg-toolkit \ |
---|
300 | /usr/cg \ |
---|
301 | /usr |
---|
302 | do |
---|
303 | if test -r "$dir/include" ; then |
---|
304 | CG_DIR=$dir |
---|
305 | break |
---|
306 | fi |
---|
307 | done |
---|
308 | AC_MSG_RESULT([${CG_DIR}]) |
---|
309 | |
---|
310 | CG_INC_DIR="$dir/include" |
---|
311 | CG_LIB_DIR="$dir/lib" |
---|
312 | |
---|
313 | echo CGDIR=$CG_DIR |
---|
314 | save_CPPFLAGS=$CPPFLAGS |
---|
315 | CPPFLAGS="-I${CG_INC_DIR} $CPPFLAGS" |
---|
316 | AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_ERROR([cannot find nVidia Cg headers])) |
---|
317 | CPPFLAGS=$save_CPPFLAGS |
---|
318 | |
---|
319 | if test "${CG_DIR}" = "/usr" ; then |
---|
320 | CG_DIR="" |
---|
321 | else |
---|
322 | LD_RPATH="$loader_run_path:${CG_LIB_DIR}" |
---|
323 | fi |
---|
324 | |
---|
325 | SUBDIRS="nanoscale nanovis pymolproxy vtkvis" |
---|
326 | |
---|
327 | AC_SUBST(CFLAGS_DEBUG) |
---|
328 | AC_SUBST(CFLAGS_OPTIMIZE) |
---|
329 | AC_SUBST(CG_DIR) |
---|
330 | AC_SUBST(CG_INC_DIR) |
---|
331 | AC_SUBST(CG_LIB_DIR) |
---|
332 | AC_SUBST(DX_INC_SPEC) |
---|
333 | AC_SUBST(DX_LIB_SPEC) |
---|
334 | AC_SUBST(FF_INC_SPEC) |
---|
335 | AC_SUBST(LD_RPATH) |
---|
336 | AC_SUBST(RP_DIR) |
---|
337 | AC_SUBST(RP_INC_SPEC) |
---|
338 | AC_SUBST(RP_LIB_DIR) |
---|
339 | AC_SUBST(SHLIB_CFLAGS) |
---|
340 | AC_SUBST(SHLIB_LD) |
---|
341 | AC_SUBST(SHLIB_LDFLAGS) |
---|
342 | AC_SUBST(SHLIB_SUFFIX) |
---|
343 | AC_SUBST(SIZEOF_FLOAT) |
---|
344 | AC_SUBST(SIZEOF_INT) |
---|
345 | AC_SUBST(SIZEOF_LONG) |
---|
346 | AC_SUBST(SIZEOF_LONG_LONG) |
---|
347 | AC_SUBST(SIZEOF_VOID_P) |
---|
348 | AC_SUBST(STLIB_LD) |
---|
349 | AC_SUBST(SUBDIRS) |
---|
350 | AC_SUBST(TCL_INC_SPEC) |
---|
351 | AC_SUBST(TCL_LIB_SPEC) |
---|
352 | AC_SUBST(TCL_VERSION) |
---|
353 | AC_SUBST(VERSION) |
---|
354 | AC_SUBST(VTK_INC_SPEC) |
---|
355 | AC_SUBST(VTK_LIB_DIR) |
---|
356 | |
---|
357 | AC_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 | |
---|