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