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

Last change on this file since 2099 was 2099, checked in by ldelgass, 14 years ago

Add check for deprecated av_alloc_format_context in libavformat as a fallback
to avformat_alloc_context. RpAvTranslate?.cpp in nanovis will use the older
function if the newer one isn't found, but the configure check was preventing
LIBS (and FF_LIB_SPEC in the nanovis Makefile) from having -lavformat added
when only the older function is present.

File size: 8.0 KB
Line 
1AC_INIT(vizservers, 0.1, rappture@nanohub.org)
2AC_CONFIG_HEADER(nanovis/nvconf.h nanoscale/config.h)
3
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
19VERSION=0.0.1
20AC_SUBST(VERSION)
21
22#------------------------------------------------------------------------
23# Handle the --prefix=... option
24#------------------------------------------------------------------------
25
26if test "${prefix}" = "NONE"; then
27    prefix=/usr/local
28fi
29if test "${exec_prefix}" = "NONE"; then
30    exec_prefix=$prefix
31fi
32
33if test "${libdir}" != "${prefix}/lib"; then
34    LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}"
35else
36    LIB_SEARCH_DIRS="-L ${libdir}"
37fi
38
39SC_CONFIG_CFLAGS
40
41AC_SUBST(CFLAGS_DEBUG)
42AC_SUBST(CFLAGS_OPTIMIZE)
43AC_SUBST(STLIB_LD)
44AC_SUBST(SHLIB_LD)
45AC_SUBST(SHLIB_CFLAGS)
46AC_SUBST(SHLIB_LDFLAGS)
47AC_SUBST(SHLIB_SUFFIX)
48
49AC_PATH_X
50
51AC_PROG_INSTALL
52AC_PROG_RANLIB
53AC_PROG_LN_S
54AC_PROG_MKDIR_P
55
56dnl find and test the C compiler
57AC_PROG_CC
58AC_PROG_CPP
59AC_PROG_CXXCPP
60AC_PROG_CXX
61AC_LANG_CPLUSPLUS
62
63AC_C_BIGENDIAN
64AC_CHECK_SIZEOF(int, 4)
65AC_CHECK_SIZEOF(long, 4)
66AC_CHECK_SIZEOF(long long, 8)
67AC_CHECK_SIZEOF(void *, 4)
68AC_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
73AC_SUBST(SIZEOF_INT, ${ac_cv_sizeof_int})
74AC_SUBST(SIZEOF_LONG, ${ac_cv_sizeof_long})
75AC_SUBST(SIZEOF_LONG_LONG, ${ac_cv_sizeof_long_long})
76AC_SUBST(SIZEOF_VOID_P, ${ac_cv_sizeof_void_p})
77AC_SUBST(SIZEOF_FLOAT, ${ac_cv_sizeof_float})
78
79LD_RPATH="";
80
81SUBDIRS="nanoscale nanovis pymolproxy"
82AC_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
99TCL_VERSION="8.4"
100for 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
110done
111TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
112
113if 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}"
119fi
120if test "x$with_tclinclude" != "x" ; then
121   TCL_INC_SPEC="-I${with_tclinclude}"
122fi
123
124AC_SUBST(TCL_VERSION)
125AC_SUBST(TCL_INC_SPEC)
126AC_SUBST(TCL_LIB_SPEC)
127
128RP2_INCL_DIR=""
129RP_DIR=""
130AC_MSG_CHECKING([for rappture])
131if 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
159else
160    AC_CHECK_HEADERS([rappture.h], [],
161           [AC_MSG_ERROR([cannot find rappture.h, try using --with-rappture])])
162
163
164fi
165AC_MSG_RESULT([${RP_DIR}/include])
166AC_SUBST(RP2_INCL_DIR)
167AC_SUBST(RP_DIR)
168
169AC_CHECK_HEADER([GL/glui.h])
170AC_CHECK_HEADER([glui.h])
171AC_CHECK_HEADER([GL/glut.h])
172AC_CHECK_HEADER([GL/glew.h])
173AC_CHECK_HEADER([Cg/cgGL.h])
174
175AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
176AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
177
178AC_MSG_CHECKING([for OpenDX headers])
179DX_INC_DIR=""
180for dir in \
181 /apps/rappture/include \
182 /usr/dx/include \
183 /usr/include
184do
185  if test -r "${dir}/dx/dx.h" ; then
186    DX_INC_DIR="$dir"
187    break
188  fi
189done
190if test "x${DX_INC_DIR}" = "x" ; then
191  AC_MSG_ERROR([can't find OpenDX include files])
192fi
193
194if test "${DX_INC_DIR}" = "/usr/include" ; then
195  DX_INC_SPEC=""
196else
197  DX_INC_SPEC="-I{DX_INC_DIR}"
198fi
199AC_SUBST(DX_INC_SPEC)
200AC_MSG_RESULT([${DX_INC_DIR}])
201
202DX_LIB_DIR=""
203found=no
204for 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
211do
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
221done
222if test "x{$DX_LIB_DIR}" = "x" ; then
223  AC_MSG_ERROR([cant find OpenDX libraries])
224fi
225
226AC_MSG_CHECKING([for libDXcallm library])
227if test "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then
228  DX_LIB_SPEC=""
229else
230  DX_LIB_SPEC="-L${DX_LIB_DIR}"
231fi
232AC_MSG_RESULT([$DX_LIB_SPEC])
233AC_SUBST(DX_LIB_SPEC)
234
235AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h])
236AC_CHECK_LIB([cv], [cvLoadImage])
237
238save_CPPFLAGS=$CPPFLAGS
239# Test for redhat-specific location of ffmpeg headers.
240if test -d "/usr/include/ffmpeg" ; then
241  CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
242  FF_INC_SPEC="-I/usr/include/ffmpeg"
243fi
244AC_SUBST(FF_INC_SPEC)
245
246AC_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])
256CPPFLAGS=$save_CPPFLAGS
257
258AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
259# Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
260AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
261    AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
262        [AC_MSG_WARN([libavformat not usable])]))
263AC_CHECK_LIB([avutil], [av_free])
264AC_CHECK_FUNCS([img_convert])
265
266AC_MSG_CHECKING([for nVidia Cg installation])
267CG_DIR=""
268for dir in \
269 /opt/nvidia-cg-toolkit \
270 /usr/cg \
271 /usr
272do
273  if test -r "${dir}/include/Cg/cgGL.h" ; then
274    CG_DIR="$dir"
275    break
276  fi
277done
278if test "x${CG_DIR}" = "x" ; then
279  AC_MSG_ERROR([can't find nVidia Cg installation])
280fi
281
282if test "${CG_DIR}" = "/usr" ; then
283  CG_DIR=""
284else
285  LD_RPATH="$loader_run_path:${CG_DIR}/lib"
286fi
287
288AC_SUBST(CG_DIR)
289AC_MSG_RESULT([${CG_DIR}])
290AC_SUBST(LD_RPATH)
291
292dnl AC_MSG_CHECKING(tcl library version)
293dnl TCL=`AC_TRY_RUN([#include <tcl.h>
294dnl         int main() {printf("tcl%s",TCL_VERSION);return(0);}],,
295dnl         echo "tcl8.4", echo "tcl8.4")`
296dnl AC_MSG_RESULT($TCL)
297dnl AC_MSG_CHECKING(tk library version)
298dnl TK=`AC_TRY_RUN([#include <tk.h>
299dnl         main() {printf("tk%s", TK_VERSION); exit(0);}],,
300dnl         echo "tk8.4", echo "tk8.4")`
301dnl AC_MSG_RESULT($TK)
302
303
304AC_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    )
Note: See TracBrowser for help on using the repository browser.