source: nanovis/trunk/configure.in @ 4899

Last change on this file since 4899 was 4353, checked in by ldelgass, 10 years ago

Use avconv instead of ffmpeg if found (Debian uses the libav fork and ffmpeg
is removed in e.g. Ubuntu 14.04).

File size: 7.2 KB
Line 
1AC_PREREQ([2.60])
2AC_INIT([nanovis], [1.2], [rappture@nanohub.org])
3AC_CONFIG_AUX_DIR(cf)
4AC_CONFIG_HEADERS([nvconf.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 @<:@default=6.1@:>@])],
38    [with_vtk=$withval],
39    [with_vtk=""])
40
41AC_ARG_WITH(
42    [ffmpeg],
43    [AS_HELP_STRING([--with-ffmpeg[=DIR]],
44      [location of ffmpeg @<:@default=yes@:>@])],
45    [],
46    [with_ffmpeg=yes])
47
48AC_ARG_WITH(
49    [avconv],
50    [AS_HELP_STRING([--with-avconv[=DIR]],
51      [location of avconv @<:@default=yes@:>@])],
52    [],
53    [with_avconv=yes])
54
55AC_ARG_WITH(
56    [statsdir],
57    [AS_HELP_STRING([--with-statsdir=DIR],
58        [Write statistics in DIR])],
59    [STATSDIR=$withval],
60    [STATSDIR="/var/tmp/visservers"])
61
62#------------------------------------------------------------------------
63# Handle the --prefix=... option
64#------------------------------------------------------------------------
65
66if test "${prefix}" = "NONE"; then
67    prefix=/usr/local
68fi
69if test "${exec_prefix}" = "NONE"; then
70    exec_prefix=$prefix
71fi
72
73if test "x${incdir}" == "x"; then
74  incdir=${exec_prefix}/include
75fi
76libdir=${exec_prefix}/lib
77
78if test "${libdir}" != "${prefix}/lib"; then
79    LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}"
80else
81    LIB_SEARCH_DIRS="-L ${libdir}"
82fi
83
84AC_PROG_INSTALL
85AC_PROG_RANLIB
86AC_PROG_LN_S
87AC_PROG_MKDIR_P
88
89dnl find and test the C compiler
90AC_PROG_CC
91AC_PROG_CPP
92AC_PROG_CXXCPP
93AC_PROG_CXX
94AC_LANG_CPLUSPLUS
95
96AC_C_BIGENDIAN
97
98# Save the values as shell variables so that we can substitute them
99# into bltHash.h for situtations where there's no bltInt.h.
100
101
102LD_RPATH="";
103
104#
105# Need to check for the following dependencies:
106#       Rappture headers and library (done)
107#       Tcl headers and library (done)
108#       GL headers and library
109#       GLuT headers and library
110#       GLEW header and library
111#       Cg headers and library
112#       CgGL headers and library
113#       pthread library
114#       ffmpeg headers and library (started)
115#
116
117TCL_VERSION="8.4"
118for dir in \
119 ${exec_prefix} \
120 ${exec_prefix}/lib \
121 ${with_rappture} \
122 ${with_rappture}/lib ; do
123  tclconfig="${dir}/tclConfig.sh"
124  if test -f "$tclconfig" ; then
125    . $tclconfig
126    break
127  fi
128done
129TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
130
131if test "x$with_tcllib" != "x" ; then
132   tclconfig="${with_tcllib}/tclConfig.sh"
133   if test -f "$tclconfig" ; then
134    . $tclconfig
135   fi
136   TCL_LIB_SPEC="-L${with_tcllib} -ltcl${TCL_VERSION}"
137fi
138if test "x$with_tclinclude" != "x" ; then
139   TCL_INC_SPEC="-I${with_tclinclude}"
140fi
141
142RP_DIR=""
143AC_MSG_CHECKING([for rappture])
144if 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_DIR="$dir"
149      RP_INC_SPEC="-I$dir/include -I$dir/include/rappture2"
150      RP_LIB_DIR="$dir/lib"
151      AC_MSG_RESULT([$dir])
152      break
153    fi
154  done
155else
156  if test ! -d "$with_rappture" ; then
157    AC_MSG_ERROR([--with-rappture: no such directory $with_rappture])
158  fi
159  RP_DIR=$with_rappture
160  RP_INC_SPEC="-I$with_rappture/include -I$with_rappture/include/rappture2"
161  RP_LIB_DIR="$with_rappture/lib"
162fi
163if test "x${RP_DIR}" = "x" ; then
164  AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture])
165else
166  AC_MSG_RESULT([$with_rappture])
167fi
168
169# We are assuming that we're using VTK 6.0
170VTK_VERSION=6.1
171VTK_LIB_DIR=${libdir}
172VTK_INC_DIR=${incdir}
173
174if test "x$with_vtk_includes" != "x"; then
175   VTK_INC_DIR=$with_vtk_includes
176fi
177
178if test "x$with_vtk_libs" != "x"; then
179   VTK_LIB_DIR=$with_vtk_libs
180fi
181
182dnl Prefer our VTK installation over systems. --with-vtk overrides.
183if test "x$with_vtk" != "x" ; then
184   VTK_VERSION=$with_vtk
185fi
186
187if ! test -d "$VTK_INC_DIR/vtk-${VTK_VERSION}" ; then
188   AC_ERROR([Couldn't find VTK includes])
189else
190   VTK_INC_SPEC="-I${VTK_INC_DIR}/vtk-${VTK_VERSION}"
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/glut.h])
199AC_CHECK_HEADER([GL/glew.h])
200
201AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
202AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
203
204AC_CHECK_FUNCS([accept4])
205
206#--------------------------------------------------------------------
207# search for avconv executable
208#--------------------------------------------------------------------
209if test "${with_avconv}" != "no" ; then
210  if test "${with_avconv}" = "yes" ; then
211    AC_PATH_PROG(AVCONV, avconv)
212  else
213    AC_PATH_PROG(AVCONV, avconv, [], [${with_avconv}/bin:${with_avconv}])
214  fi
215  if test "${AVCONV}x" != "x" ; then
216    AC_DEFINE(HAVE_AVCONV, 1, [nanovis can use avconv to create videos.])
217  fi
218fi
219
220#--------------------------------------------------------------------
221# search for ffmpeg executable
222#--------------------------------------------------------------------
223if test "${with_ffmpeg}" != "no" ; then
224  if test "${with_ffmpeg}" = "yes" ; then
225    AC_PATH_PROG(FFMPEG, ffmpeg)
226  else
227    AC_PATH_PROG(FFMPEG, ffmpeg, [], [${with_ffmpeg}/bin:${with_ffmpeg}])
228  fi
229  if test "${FFMPEG}x" != "x" ; then
230    AC_DEFINE(HAVE_FFMPEG, 1, [nanovis can use ffmpeg to create videos.])
231  fi
232fi
233
234AC_MSG_CHECKING([for nVidia Cg installation])
235CG_DIR=""
236for dir in \
237 /opt/nvidia-cg-toolkit \
238 /usr/cg \
239 /usr
240do
241  if test -r "$dir/include" ; then
242    CG_DIR=$dir
243    break
244  fi
245done
246AC_MSG_RESULT([${CG_DIR}])
247
248CG_INC_SPEC="-I${CG_DIR}/include"
249
250save_CPPFLAGS=$CPPFLAGS
251CPPFLAGS="${CG_INC_SPEC} $CPPFLAGS"
252AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers]))
253CPPFLAGS=$save_CPPFLAGS
254
255CG_LIB_DIR=""
256for dir in \
257 /opt/nvidia-cg-toolkit \
258 /usr/cg \
259 /usr
260do
261  if test -r "$dir/lib" ; then
262    CG_LIB_DIR=$dir/lib
263    break
264  fi
265  if test -r "$dir/lib64" ; then
266    CG_LIB_DIR=$dir/lib64
267    break
268  fi
269done
270
271if test "${CG_LIB_DIR}" = "/usr/lib" ; then
272  CG_INC_SPEC=""
273  CG_LIB_SPEC="-lCg -lCgGL"
274else
275  CG_LIB_SPEC="-L${CG_LIB_DIR} -lCg -lCgGL"
276  LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
277fi
278
279AC_SUBST(CG_INC_SPEC)
280AC_SUBST(CG_LIB_SPEC)
281AC_SUBST(AVCONV)
282AC_SUBST(FFMPEG)
283AC_SUBST(LD_RPATH)
284AC_SUBST(RP_DIR)
285AC_SUBST(RP_INC_SPEC)
286AC_SUBST(RP_LIB_DIR)
287AC_SUBST(STATSDIR)
288AC_SUBST(TCL_INC_SPEC)
289AC_SUBST(TCL_LIB_SPEC)
290AC_SUBST(TCL_VERSION)
291AC_SUBST(VTK_VERSION)
292AC_SUBST(VTK_INC_DIR)
293AC_SUBST(VTK_LIB_DIR)
294
295AC_OUTPUT([
296   Doxyfile \
297   Makefile \
298   graphics/Makefile \
299   imgLoaders/Makefile \
300   newmat11/Makefile \
301   util/Makefile \
302   vrmath/Makefile])
Note: See TracBrowser for help on using the repository browser.