#!/bin/bash # g4bl-config -- echo g4bl configuration information # # g4bl-config --dir echo $G4BL_DIR (the g4bl directory path) # g4bl-config --sys echo $SYSTEM (the host type for this build) # g4bl-config --libs echo libraries for use in link command # g4bl-config --include echo -I options for include paths in compile # g4bl-config --main echo name of G4beamline main .cc file, plus # -DG4BLVERSION=2.11 -DG4BLDATE=12-FEB-2010-18:22 # g4bl-config --objs echo list of G4beamline object files (no main) # g4bl-config --vcflags echo list of flags for VC++ (Windows only) # # This script must be run via an absolute pathname. # # --dir and --sys do not need G4beamline source installed; the others # require the source to be installed and configured. # # This command is the source for various configuration items: # --include, --main, and --libs # The Makefile uses this command to get those, but it generates # its own list of objects from $SOURCE/src/*.cc # g4blmake uses this command to get --include, --main, --objs, and --libs. # # NOTE: this command probably needs to be updated when a new version # of Geant4 is used (and possibly other libraries as well); especially # its --include and --libs. ### ### SYSTEM-specific function for Darwin libs ### function Darwin-libs { LIBS="$G4BL_DIR/lib/*.a" case $G4BL_ROOT in y) LIBS="$LIBS $G4BL_DIR/lib/*.so" ;; n) ;; bin) ###LIBS="$LIBS $($ROOT/bin/root-config --libs)" LIBS="$LIBS -L$ROOT/lib -lTree -lCore -lCint -lRIO" ;; *) echo >&2 "g4bl-config: ERROR invalid G4BL_ROOT value." exit 1 ;; esac if test "$G4BL_VISUAL" = "y" then # LIBS="$LIBS -Wl,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib" # there is libGL.dylib in /usr/X11/lib, and it works the same in OpenInventor # libXm.dylib from Fink in /sw/lib LIBS="$LIBS -L/usr/lib -L/usr/X11/lib -L/sw/lib -lGLU -lGL -lXm -lXpm -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE" fi LIBS="$LIBS -lexpat" echo $LIBS } ### ### SYSTEM-specific function for Linux libs ### function Linux-libs { LIBS=`$G4BL_DIR/bin/geant4-config --libs` LIBS="$LIBS -L$G4BL_DIR/lib -lCLHEP -lgsl -lgslcblas -lfftw3f" if test "$G4BL_VISUAL" = "y" then LIBS="$LIBS -L/home/mice/Grid/MAUS-v3.2.1/third_party/build/root/lib -lSoXt -lCoin -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL -lXm -lXpm -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE" fi case $G4BL_ROOT in y) LIBS="$LIBS $G4BL_DIR/lib/*.so" ;; n) ;; bin) ###LIBS="$LIBS $($ROOT/bin/root-config --libs)" LIBS="$LIBS -L$ROOT/lib -lTree -lCore -lCint -lRIO" ;; *) echo >&2 "g4bl-config: ERROR invalid G4BL_ROOT value." exit 1 ;; esac LIBS="$LIBS -lexpat -ldl" echo $LIBS } ### ### SYSTEM-specific function for WIN32 libs ### function WIN32-libs { # no geant4-config (list from geant4.9.5 on Darwin) LIBS="/link /libpath:$G4BL_DIR/lib /STACK:8368128 /force" ###LIBS="$LIBS /NODEFAULTLIB:msvcrt.lib libcmt.lib" LIBS="$LIBS /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib" for i in G4interfaces G4persistency G4analysis G4error_propagation G4readout G4physicslists G4run G4event G4tracking G4parmodels G4processes G4digits_hits G4track G4particles G4geometry G4materials G4graphics_reps G4intercoms G4global do LIBS="$LIBS $i-static.lib" done # Root if test "$G4BL_ROOT" = "y" then for i in libTree libRIO libNet libCint libThread libMathCore libCore do LIBS="$LIBS $i.lib" done fi # clhep-config is g++ style, so just use the .lib LIBS="$LIBS CLHEP.lib" # gsl and fftw LIBS="$LIBS libgsl.a libgslcblas.a libfftw3f-3.lib" if test "$G4BL_VISUAL" = "y" then for i in G4OpenGL G4gl2ps G4OpenInventor G4Tree G4FR G4GMocren G4visHepRep G4RayTracer G4VRML G4vis_management G4modeling do LIBS="$LIBS $i-static.lib" done LIBS="$LIBS sowin1.lib coin3.lib" LIBS="$LIBS glu32.lib opengl32.lib gdi32.lib user32.lib gdi32.lib user32.lib" fi # libexpat LIBS="$LIBS libexpat.lib" ###LIBS="$LIBS libcmt.lib" LIBS="$LIBS msvcrt.lib msvcprt.lib" echo $LIBS } ### ### determine G4BL_DIR ### if test "$G4BL_DIR" = "" then G4BL_DIR=`dirname "$0"` G4BL_DIR=`\cd "$G4BL_DIR" >&- 2>&- && pwd` G4BL_DIR=`dirname "$G4BL_DIR"` if test -x /bin/cygpath then G4BL_DIR=`/bin/cygpath -m "$G4BL_DIR"` fi fi export G4BL_DIR ### ### determine SYSTEM ### if test -z "$SYSTEM" then case `uname -s` in Linux*) SYSTEM=Linux ;; Darwin*) SYSTEM=Darwin ;; CYGWIN*) SYSTEM=WIN32 ;; *) echo >&2 "g4bl-config: ERROR - UNKNOWN OS, set SYSTEM manually." exit 1 ;; esac fi ### ### handle args --dir and --sys (don't need .config file) ### case "$1" in --dir) echo $G4BL_DIR; exit 0 ;; --sys) echo $SYSTEM; exit 0 ;; --vcflags) echo "-Ox -MD -GR -EHsc -Zm200 -nologo -D_CRT_SECURE_NO_DEPRECATE -DXPNET"; exit 0 ;; --libs|--include|--main|--objs) ;; *) echo >&2 "g4bl-config: valid arguments (one only) are:" echo >&2 " --dir, --sys, --vcflags, --libs, --include, --main, --objs." echo >&2 " All but the first three require the source code." ;; esac if test ! -r "$G4BL_DIR/.config" then echo >&2 "g4bl-config: ERROR: G4beamline source not available" exit 1 fi ### ### get the .config variable definitions ### source "$G4BL_DIR/.config" case "$1" in --libs) $SYSTEM-libs ;; --include) FLAGS="-I$SOURCE/source/include" FLAGS="$FLAGS -I$G4BL_DIR/include" FLAGS="$FLAGS -I$G4BL_DIR/include/Geant4" if test "$G4BL_DEBUG" = "y" then FLAGS="$FLAGS -g" fi ###FLAGS="$FLAGS -Wno-unused" if test "$G4BL_VISUAL" = "y" then FLAGS="$FLAGS -DG4BL_VISUAL" fi if test "$G4BL_ROOT" = "y" then FLAGS="$FLAGS -DG4BL_ROOT -I$G4BL_DIR/include/root" elif test "$G4BL_ROOT" = "bin" then FLAGS="$FLAGS -DG4BL_ROOT $($ROOT/bin/root-config --cflags)" fi echo "$FLAGS" ;; --main) FLAGS="-DG4BLVERSION=$VERSION" FLAGS="$FLAGS -DG4BLDATE=`date '+%d-%b-%Y-%H:%M'`" echo "$FLAGS $SOURCE/source/g4beamline.cc" ;; --objs) # the Makefile constructed by configure generated the original list echo $G4BL_DIR/build/g4beamline/*.$OBJEXT ;; *) echo >&2 "g4bl-config: ERROR - invalid argument '$1'" exit 1 ;; esac