#!/bin/sh # #******************************************* # # GXINT shell v0.9 # # shell to link and run an interactive GEANT # # Author: G.Folger 92/02/25 # # Modifications: # #******************************************* line="******************************************************" SHOPT="F:d:v:g:h:o:" # Check option set and give default values if [ -f /bin/getopt -o -f /usr/bin/getopt ] ; then set -- `getopt $SHOPT $*` ; cc=$? [ $cc -ne 0 ] && exec shexit $cc fi if [ $# -eq 0 ] ; then cat << EoD GXINT [options] file(s) ld an interactive Geant application and run it. Your compiled routines are given in file(s). options: -F specify (one) extra .for file to link in -d driver specify the driver for the graphics output. Possible values are X11, GKS, or GDDM. Not all are possible on systems. -v version version of the program library to use. Possible values include pro ( default ), new and old. -g geant_version which version of geant to use. Current default is 315. -h host useful with the -d X11 option only. Specify the hostname used for the display. Syntax identical to that of DISPLAY. If no hostname is specified, the value of DISPLAY is used. -o outputfile Do not immediately run GEANT, but produce an executable file named outputfile. -L path additional loader search path. Usefull if additional libraries are specified with -l option. This option may be repeated to more than one pathname. -l library specify additional libraries. This option may be repeated to add several libs. EoD fi drv="X11" ; ver="pro" ; OUT="/tmp/GEANT$$" while [ $# -gt 0 ] do case $1 in -d) drv=$2; shift ;; -v) ver=$2; shift ;; -g) gvs=$2; shift ;; -h) DISPLAY=$2;export DISPLAY; shift ;; -o) OUT=$2; norun="1" shift ;; -L) userpath="$userpath -L$2"; shift ;; -l) userlibs="$userlibs -l$2"; shift ;; -F) otherfiles="$otherfiles $2"; shift ;; --) shift ; break ;; *) break ;; esac shift done if [ $# -gt 0 ] ; then pgm="$*" else echo "gxint_Warning: no user program specified" fi if [ ${CERN-1} -eq 1 ] ; then if [ ! -d /cern ]; then echo "gxint_Error: shell variable CERN must be set or /cern must exist" exit 1 fi CERN="/cern" ; export CERN fi if [ "$drv" = "GKS" ] ; then if [ ${GKSR-1} -eq 1 ] ; then if [ ! -d $CERN/gks/$ver ] ; then echo "gxint_Error: shell variable GKSR must be set or " echo " : $CERN/gks/$ver must exist" exit 1 fi GKSR=$CERN/gks/$ver fi GKSP=$GKSR/lib fi LDN="f77" _o="o" # grafik libray names X11="X11" SGKS="gks77,gks,suntool,sunwindow,pixrect,m" LDP="$userpath -L${CERN}/${ver}/lib" LDL="$userlibs -lgeant${gvs-},pawlib,graflib,graf$drv,packlib,mathlib" case $drv in X11) LDL="$LDL,grafX11" break ;; GKS) LDP="$LDP -L$GKSP" LDL="$LDL,grafGKS,$GKS" break ;; SUNGKS) LDL="$LDL,grafSGKS,$SGKS" break;; *) echo "illegal option for graphic output driver specified" exit 1 ;; esac [ $drv -eq X11 ] && LDL="$LDL -l$X11,dl,m,socket,nsl" LDL="`echo $LDL | sed -e 's/,/ -l/g'`" gxint="${CERN}/${ver}/lib/gxint${gvs-}.$_o" cat << EoD $line * loading interactive Geant * creating : $OUT * loader used : $LDN * libary path : $LDP * libraries : $LDL * gxint used : $gxint $line EoD $LDN -o $OUT $gxint $pgm $otherfiles $LDP $LDL ; cc=$? [ $cc -ne 0 ] && exit $cc if [ ${norun-0} -eq 0 ] ; then $OUT ; cc=$? fi exit $cc