Changeset 2683


Ignore:
Timestamp:
Nov 15, 2011 11:58:36 AM (11 years ago)
Author:
gah
Message:
 
Location:
branches/blt4/packages/vizservers
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/packages/vizservers/start_nanoscale.sh.in

    r2674 r2683  
    1 AC_PREREQ([2.60])
    2 AC_INIT(vizservers, 0.1, rappture@nanohub.org)
    3 AC_CONFIG_AUX_DIR(cf)
    4 AC_CONFIG_HEADERS([nanovis/nvconf.h nanoscale/config.h])
     1#! /bin/sh
    52
    6 AC_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=""])
     3DISPLAY=:0
     4export DISPLAY
    125
    13 AC_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])
     6# Fail on errors
     7set -e
    198
    20 AC_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=""])
     9exec_prefix="@exec_prefix@"
     10bindir="@bindir@"
     11libdir="@libdir@"
     12. ${bindir}/rappture.env
    2613
    27 AC_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=""])
     14# lspci is either in /sbin or /usr/sbin
     15PATH=/sbin:/usr/sbin:${PATH}
     16export PATH
    3317
    34 AC_ARG_WITH(
    35     [vtk],
    36     [AS_HELP_STRING([--with-vtk=VERSION],
    37         [Version of VTK required])],
    38     [with_vtk=$withval],
    39     [with_vtk=yes])
     18# Determine the number of video cards we have.  The new render server
     19# motherboards have the useless XGI Volari onboard video controllers (no 3D
     20# capabilities) so we have to make sure we count only the nVidia cards.
    4021
    41 RP_LANG_PYTHON
     22numVideo=`lspci | fgrep VGA | fgrep nVidia | wc -l`
    4223
    43 VERSION=0.0.1
     24# Don't let nanoscale and the visualization servers run away.  Limit cpu time
     25# to 20 minutes.
    4426
    45 #------------------------------------------------------------------------
    46 # Handle the --prefix=... option
    47 #------------------------------------------------------------------------
     27minutes=20
     28ulimit -t $(expr ${minutes} \* 60 )
    4829
    49 if test "${prefix}" = "NONE"; then
    50     prefix=/usr/local
    51 fi
    52 if test "${exec_prefix}" = "NONE"; then
    53     exec_prefix=$prefix
    54 fi
     30# Make /tmp the current working dirctory.
     31cd /tmp
    5532
    56 if test "x${incdir}" == "x"; then
    57   incdir=${exec_prefix}/include
    58 fi
    59 libdir=${exec_prefix}/lib
    60 
    61 if test "${libdir}" != "${prefix}/lib"; then
    62     LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}"
    63 else
    64     LIB_SEARCH_DIRS="-L ${libdir}"
    65 fi
    66 
    67 SC_CONFIG_CFLAGS
     33exec ${bindir}/nanoscale -x ${numVideo}
    6834
    6935
    70 AC_PATH_X
    71 
    72 AC_PROG_INSTALL
    73 AC_PROG_RANLIB
    74 AC_PROG_LN_S
    75 AC_PROG_MKDIR_P
    76 
    77 dnl find and test the C compiler
    78 AC_PROG_CC
    79 AC_PROG_CPP
    80 AC_PROG_CXXCPP
    81 AC_PROG_CXX
    82 AC_LANG_CPLUSPLUS
    83 
    84 AC_C_BIGENDIAN
    85 AC_CHECK_SIZEOF(int, 4)
    86 AC_CHECK_SIZEOF(long, 4)
    87 AC_CHECK_SIZEOF(long long, 8)
    88 AC_CHECK_SIZEOF(void *, 4)
    89 AC_CHECK_SIZEOF(float, 4)
    90 
    91 # Save the values as shell variables so that we can substitute them
    92 # into bltHash.h for situtations where there's no bltInt.h.
    93 
    94 
    95 LD_RPATH="";
    96 
    97 #
    98 # Need to check for the following dependencies:
    99 #       Rappture headers and library (done)
    100 #       Tcl headers and library (done)
    101 #       GL headers and library
    102 #       GLuT headers and library
    103 #       GLui header and library
    104 #       GLEW header and library
    105 #       Cg headers and library
    106 #       CgGL headers and library
    107 #       pthread library
    108 #       DX headers and library (done, sort of)
    109 #       ffmpeg headers and library (started)
    110 #
    111 
    112 TCL_VERSION="8.4"
    113 for dir in \
    114  ${exec_prefix} \
    115  ${exec_prefix}/lib \
    116  ${with_rappture} \
    117  ${with_rappture}/lib ; do
    118   tclconfig="${dir}/tclConfig.sh"
    119   if test -f "$tclconfig" ; then
    120     . $tclconfig
    121     break
    122   fi
    123 done
    124 TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
    125 
    126 if test "x$with_tcllib" != "x" ; then
    127    tclconfig="${with_tcllib}/tclConfig.sh"
    128    if test -f "$tclconfig" ; then
    129     . $tclconfig
    130    fi
    131    TCL_LIB_SPEC="-L${with_tcllib} -ltcl${TCL_VERSION}"
    132 fi
    133 if test "x$with_tclinclude" != "x" ; then
    134    TCL_INC_SPEC="-I${with_tclinclude}"
    135 fi
    136 
    137 RP_DIR=""
    138 AC_MSG_CHECKING([for rappture])
    139 if test "$with_rappture" == "yes" ; then
    140   for dir in "$exec_prefix" "/usr" ; do
    141     if test -r "$dir/include/rappture2/rappture2.h" -a \
    142      -r "$dir/lib/librappture.a"; then
    143       RP_DIR="$dir"
    144       RP_INC_SPEC="-I$dir/include -I$dir/include/rappture2"
    145       RP_LIB_DIR="$dir/lib"
    146       AC_MSG_RESULT([$dir])
    147       break
    148     fi
    149   done
    150 else
    151   if test ! -d "$with_rappture" ; then
    152     AC_MSG_ERROR([--with-rappture: no such directory $with_rappture])
    153   fi
    154   RP_DIR=$with_rappture
    155   RP_INC_SPEC="-I$with_rappture/include -I$with_rappture/include/rappture2"
    156   RP_LIB_DIR="$with_rappture/lib"
    157 fi
    158 if test "x${RP_DIR}" = "x" ; then
    159   AC_MSG_ERROR([cannot find rappture.h and librappture2.a, try using --with-rappture])
    160 else
    161   AC_MSG_RESULT([$with_rappture])
    162 fi
    163 
    164 dnl Prefer our VTK installation over systems. --with-vtk overrides.
    165 if test "$with_vtk" != "no" ; then
    166   if test "$with_vtk" = "yes" ; then
    167     for dir in vtk-5.{9,8,7,6,5,4,3,2,1} ; do
    168       if test -d "${libdir}/$dir" -a -d "${incdir}/$dir"; then
    169         VTK_LIB_SPEC="-L${libdir}/$dir"
    170         VTK_LIB_DIR="${libdir}/$dir"
    171         VTK_INC_SPEC="-I${incdir}/$dir"
    172         break
    173       fi
    174       if test -d "/usr/lib/$dir" -a -d "/usr/include/$dir"; then
    175         VTK_LIB_SPEC=-L/usr/lib/$dir
    176         VTK_LIB_DIR=/usr/lib/$dir
    177         VTK_INC_SPEC=-I/usr/include/$dir
    178         break
    179       fi
    180     done
    181   fi
    182 fi
    183 
    184 if test "x$with_vtk_includes" != "x"; then
    185    VTK_INC_SPEC=-I$with_vtk_includes
    186 fi
    187 
    188 if test "x$with_vtk_libs" != "x"; then
    189    VTK_LIB_DIR=$with_vtk_libs
    190    VTK_LIB_SPEC="-L$with_vtk_libs"
    191 fi
    192 
    193 save_CPPFLAGS=$CPPFLAGS
    194 CPPFLAGS=$VTK_INC_SPEC
    195 AC_CHECK_HEADERS([vtkSmartPointer.h], [], [AC_MSG_WARN([cannot find vtkSmartPointer.h])])
    196 CPPFLAGS=$save_CPPFLAGS
    197 
    198 AC_CHECK_HEADER([GL/glui.h])
    199 AC_CHECK_HEADER([glui.h])
    200 AC_CHECK_HEADER([GL/glut.h])
    201 AC_CHECK_HEADER([GL/glew.h])
    202 
    203 AC_CHECK_HEADERS([stdio.h unistd.h stdlib.h string.h sys/types.h])
    204 AC_CHECK_HEADERS([sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h])
    205 
    206 AC_CHECK_FUNCS([accept4])
    207 
    208 AC_MSG_CHECKING([for OpenDX headers])
    209 DX_INC_DIR=""
    210 for dir in \
    211  /apps/rappture/include \
    212  /usr/dx/include \
    213  /usr/include
    214 do
    215   if test -r "${dir}/dx/dx.h" ; then
    216     DX_INC_DIR="$dir"
    217     break
    218   fi
    219 done
    220 if test "x${DX_INC_DIR}" = "x" ; then
    221   AC_MSG_WARN([cannot find OpenDX include files])
    222   DX_INC_SPEC=""
    223 elif test "${DX_INC_DIR}" = "/usr/include" ; then
    224   DX_INC_SPEC=""
    225 else
    226   DX_INC_SPEC="-I{DX_INC_DIR}"
    227 fi
    228 
    229 AC_MSG_RESULT([${DX_INC_DIR}])
    230 save_CPPFLAGS=${CPPFLAGS}
    231 CPPFLAGS="$DX_INC_SPEC $CPPFLAGS"
    232 AC_CHECK_HEADERS(dx/dx.h)
    233 CPPFLAGS=${save_CPPFLAGS}
    234 
    235 DX_LIB_DIR=""
    236 for dir in \
    237  /usr/lib \
    238  /usr/lib64 \
    239  /usr/dx/lib_linux \
    240  /usr/lib/dx/lib_linux \
    241  /usr/lib64/dx/lib_linux \
    242  /apps/rappture/lib
    243 do
    244   saveLDFLAGS=$LDFLAGS
    245   LDFLAGS="-L$dir $LDFLAGS"
    246   unset ac_cv_lib_DXcallm_DXGetComponentValue
    247   AC_CHECK_LIB([DXcallm], [DXGetComponentValue], [found=yes], [found=no], [-lX11])
    248   LDFLAGS=$saveLDFLAGS
    249   if test "$found" = "yes" ; then
    250     DX_LIB_DIR="$dir"
    251     break
    252   fi
    253 done
    254 if test "x${DX_LIB_DIR}" = "x" ; then
    255   AC_MSG_WARN([cannot find OpenDX libraries])
    256 fi
    257 
    258 AC_MSG_CHECKING([for libDXcallm library])
    259 if test "x${DX_LIB_DIR}" = "x" -o "${DX_LIB_DIR}" = "/usr/lib" -o "${DX_LIB_DIR}" = "/usr/lib64"; then
    260   DX_LIB_SPEC=""
    261 else
    262   DX_LIB_SPEC="-L${DX_LIB_DIR} -lDXcallm"
    263 fi
    264 AC_MSG_RESULT([$DX_LIB_SPEC])
    265 
    266 AC_CHECK_HEADERS([opencv/cv.h opencv/highgui.h])
    267 AC_CHECK_LIB([highgui], [cvLoadImage])
    268 
    269 save_CPPFLAGS=$CPPFLAGS
    270 # Test for redhat-specific location of ffmpeg headers.
    271 if test -d "/usr/include/ffmpeg" ; then
    272   CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg"
    273   FF_INC_SPEC="-I/usr/include/ffmpeg"
    274 fi
    275 
    276 AC_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 ])
    286 CPPFLAGS=$save_CPPFLAGS
    287 
    288 AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
    289 # Fallback to deprecated av_alloc_format_context if avformat_alloc_context isn't found
    290 AC_CHECK_LIB([avformat], [avformat_alloc_context], [],
    291     AC_CHECK_LIB([avformat], [av_alloc_format_context], [],
    292         [AC_MSG_WARN([libavformat not usable])]))
    293 AC_CHECK_FUNCS([avformat_alloc_context])
    294 AC_CHECK_LIB([avutil], [av_free])
    295 AC_CHECK_FUNCS([img_convert])
    296 
    297 
    298 AC_MSG_CHECKING([for nVidia Cg installation])
    299 CG_DIR=""
    300 for dir in \
    301  /opt/nvidia-cg-toolkit \
    302  /usr/cg \
    303  /usr
    304 do
    305   if test -r "$dir/include" ; then
    306     CG_DIR=$dir
    307     break
    308   fi
    309 done
    310 AC_MSG_RESULT([${CG_DIR}])
    311 
    312 CG_INC_DIR="$dir/include"
    313 CG_LIB_DIR="$dir/lib"
    314 
    315 save_CPPFLAGS=$CPPFLAGS
    316 CPPFLAGS="-I${CG_INC_DIR} $CPPFLAGS"
    317 AC_CHECK_HEADERS([Cg/cgGL.h], [], AC_MSG_WARN([cannot find nVidia Cg headers]))
    318 CPPFLAGS=$save_CPPFLAGS
    319 
    320 if test "${CG_DIR}" = "/usr" ; then
    321   CG_DIR=""
    322 else
    323   LD_RPATH="$loader_run_path:${CG_LIB_DIR}"
    324 fi
    325 
    326 SUBDIRS="nanoscale nanovis pymolproxy vtkvis"
    327 
    328 AC_SUBST(CFLAGS_DEBUG)
    329 AC_SUBST(CFLAGS_OPTIMIZE)
    330 AC_SUBST(CG_DIR)
    331 AC_SUBST(CG_INC_DIR)
    332 AC_SUBST(CG_LIB_DIR)
    333 AC_SUBST(DX_INC_SPEC)
    334 AC_SUBST(DX_LIB_SPEC)
    335 AC_SUBST(FF_INC_SPEC)
    336 AC_SUBST(LD_RPATH)
    337 AC_SUBST(RP_DIR)
    338 AC_SUBST(RP_INC_SPEC)
    339 AC_SUBST(RP_LIB_DIR)
    340 AC_SUBST(SHLIB_CFLAGS)
    341 AC_SUBST(SHLIB_LD)
    342 AC_SUBST(SHLIB_LDFLAGS)
    343 AC_SUBST(SHLIB_SUFFIX)
    344 AC_SUBST(SIZEOF_FLOAT)
    345 AC_SUBST(SIZEOF_INT)
    346 AC_SUBST(SIZEOF_LONG)
    347 AC_SUBST(SIZEOF_LONG_LONG)
    348 AC_SUBST(SIZEOF_VOID_P)
    349 AC_SUBST(STLIB_LD)
    350 AC_SUBST(SUBDIRS)
    351 AC_SUBST(PYTHON)
    352 AC_SUBST(TCL_INC_SPEC)
    353 AC_SUBST(TCL_LIB_SPEC)
    354 AC_SUBST(TCL_VERSION)
    355 AC_SUBST(VERSION)
    356 AC_SUBST(VTK_INC_SPEC)
    357 AC_SUBST(VTK_LIB_DIR)
    358 
    359 AC_OUTPUT([
    360    Makefile \
    361    nanoscale/Makefile \
    362    nanoscale/renderservers.tcl \
    363    nanovis/Makefile \
    364    nanovis/newmat11/Makefile \
    365    nanovis/R2/src/Makefile \
    366    nanovis/vrutil/Makefile \
    367    nanovis/vrmath/Makefile \
    368    nanovis/vr3d/Makefile \
    369    nanovis/imgLoaders/Makefile \
    370    nanovis/transfer-function/Makefile \
    371    pymolproxy/Makefile \
    372    vtkvis/Doxyfile \
    373    vtkvis/Makefile \
    374    start_viz.sh \
    375    start_nanoscale.sh])
Note: See TracChangeset for help on using the changeset viewer.