#!/bin/sh #----------------------------------------------------------------------- # sh config query script for Geant4 10.1.3 on UNIX platforms # Autogenerated by CMake DO NOT EDIT #----------------------------------------------------------------------- #----------------------------------------------------------------------- # Determine location of this script. # NB, we don't always use the result of this calculation, but it does not # hurt to do it. Only possible error is if too long a chain of symbolic # links are used to point to the physical script. # # Resolve symbolic links to script - we should end up with a physical file script="$0" calldir=`pwd` loopcount="" while [ "x`readlink $script`" != "x" ] ; do preloc=`dirname $script` script=`readlink $script` if [ ${script##/} = ${script##~} ] ; then # The symbolic link was relative... script="$preloc/$script" fi loopcount="l$loopcount" if [ ${#loopcount} -gt 10 ] ; then echo "error: more than 10 symbolic links to geant4-config traversed." exit 1 fi done # If we still have a relative path, then it must be relative to the # calling dir. NB we don't attempt to resolve directory symbolic # links or remove '.' or '..' if [ ${script##/} = ${script##~} ] ; then script="$calldir/$script" fi #----------------------------------------------------------------------- # Finally, grab the directory in which the script is located # Used below should we be setup to be relocatable. scriptloc=`dirname $script` #----------------------------------------------------------------------- # Expansion and calculation of all needed variables # prefix=$scriptloc/.. exec_prefix= libdir=${prefix}/lib64 includedirs="${prefix}/include/Geant4" name="geant4" description="Geant4 toolkit for the simulation of the passage of particles through matter" version="10.1.3" # 'Requires' that may affect cflags and libs. clhep_config_exe= # Basic flags and libraries for visualization vis_cflags="-DG4UI_USE_TCSH" vis_libs="-lG4Tree \ -lG4FR \ -lG4GMocren \ -lG4visHepRep \ -lG4RayTracer \ -lG4VRML \ -lG4vis_management \ -lG4modeling" #----------------------------------------------------------------------- # Core setup... # cflags=" -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -std=c++98" feature_list="" # - CXX Standard geant4_cxx_std="c++98" # - static libs have_staticlibs="no" feature_list="${feature_list} staticlibs[${have_staticlibs}]" # No action as yet # - multithreading have_multithreading="no" feature_list="${feature_list} multithreading[${have_multithreading}]" if test "x${have_multithreading}" = "xyes" ; then geant4_tls_model="" cflags="${cflags} -DG4MULTITHREADED" else geant4_tls_model="" fi # - Includes and Libs for g4incdir in ${includedirs} ; do cflags="${cflags} -I${g4incdir}" done libs="-lG4interfaces \ -lG4persistency \ -lG4analysis \ -lG4error_propagation \ -lG4readout \ -lG4physicslists \ -lG4run \ -lG4event \ -lG4tracking \ -lG4parmodels \ -lG4processes \ -lG4digits_hits \ -lG4track \ -lG4particles \ -lG4geometry \ -lG4materials \ -lG4graphics_reps \ -lG4intercoms \ -lG4global" #----------------------------------------------------------------------- # - Extra optional features that were enabled. # - ALL geant4_uses_opengl="no" geant4_uses_x11="no" # - CLHEP have_clhep="yes" feature_list="${feature_list} clhep[${have_clhep}]" if test "x${have_clhep}" = "xno" ; then cflags="${cflags} `${clhep_config_exe} --include`" libs="${libs} " fi if test "x${have_clhep}" = "xyes" ; then libs="${libs} -lG4clhep" fi # - EXPAT have_expat="no" feature_list="${feature_list} expat[${have_expat}]" if test "x${have_expat}" = "xyes" ; then libs="${libs} -lG4expat" fi # - ZLIB have_zlib="yes" feature_list="${feature_list} zlib[${have_zlib}]" if test "x${have_zlib}" = "xyes" ; then libs="${libs} -lG4zlib" fi # - GDML have_gdml="no" feature_list="${feature_list} gdml[${have_gdml}]" if test "x${have_gdml}" = "xyes" ; then cflags="${cflags} " fi # - USolids have_usolids="no" have_internal_usolids="yes" feature_list="${feature_list} usolids[${have_usolids}]" if test "x${have_usolids}" = "xyes" ; then cflags="-DG4GEOM_USE_USOLIDS ${cflags}" fi if test "x${have_internal_usolids}" = "xyes" ; then libs="${libs} -lG4geomUSolids" fi # - G3toG4 have_g3tog4="no" feature_list="${feature_list} g3tog4[${have_g3tog4}]" if test "x${have_g3tog4}" = "xyes" ; then libs="-lG3toG4 ${libs}" fi # - Qt have_qt="no" feature_list="${feature_list} qt[${have_qt}]" if test "x${have_qt}" = "xyes" ; then vis_cflags="${vis_cflags} \ -DG4INTY_USE_QT -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT " geant4_uses_opengl="yes" fi # - Motif have_motif="no" feature_list="${feature_list} motif[${have_motif}]" if test "x${have_motif}" = "xyes" ; then vis_cflags="${vis_cflags} -DG4UI_USE_XM -DG4VIS_USE_OPENGLXM" geant4_uses_x11="yes" geant4_uses_opengl="yes" fi # - RayTracerX11 have_raytracerx11="no" feature_list="${feature_list} raytracer-x11[${have_raytracerx11}]" if test "x${have_raytracerx11}" = "xyes" ; then vis_cflags="${vis_cflags} -DG4VIS_USE_RAYTRACERX" geant4_uses_x11="yes" fi # - OpenGL with X11 have_openglx11="no" feature_list="${feature_list} opengl-x11[${have_openglx11}]" if test "x${have_openglx11}" = "xyes" ; then vis_cflags="${vis_cflags} -DG4VIS_USE_OPENGLX" geant4_uses_opengl="yes" geant4_uses_x11="yes" fi # - OpenInventor # Whilst it *is* an Xt based driver, don't *think* Xt or X11 appear # in the public interface, nor do the Inventor headers... have_openinventor="no" feature_list="${feature_list} openinventor[${have_openinventor}]" if test "x${have_openinventor}" = "xyes" ; then vis_cflags="${vis_cflags} -DG4INTY_USE_XT -DG4VIS_USE_OI -DG4VIS_USE_OIX" vis_libs="-lG4OpenInventor ${vis_libs}" fi # - If we have any OpenGL based feature, then we need to add in the # OpenGL global define and the G4OpenGL/G4gl2ps libraries. if test "x${geant4_uses_opengl}" = "xyes" ; then vis_cflags="-DG4VIS_USE_OPENGL ${vis_cflags}" vis_libs="-lG4OpenGL -lG4gl2ps ${vis_libs}" fi # - If we have any X11 based feature, then we need the INTY_XT define and # *may* need the X11 includes if test "x${geant4_uses_x11}" = "xyes" ; then vis_cflags="-DG4INTY_USE_XT ${vis_cflags}" fi #----------------------------------------------------------------------- # Datasets # - List creation for sh compatibility, see: # https://wiki.ubuntu.com/DashAsBinSh # Note however that the guide in the link uses the GNU awk extension # 'length' to find the number of elements in the array. This will fail # on other awk implementations. Use standard feature of split function # returning number of elements. dataset_url="http://geant4.cern.ch/support/source" dataset_timeout="1500" dataset_list=$(awk 'BEGIN { n = split( "G4NDL|G4NEUTRONHPDATA|/data/zsoldos/cvmfs/Geant4//data/G4NDL4.5|G4NDL.4.5.tar.gz|fd29c45fe2de432f1f67232707b654c0;G4EMLOW|G4LEDATA|/data/zsoldos/cvmfs/Geant4//data/G4EMLOW6.41|G4EMLOW.6.41.tar.gz|b9b2e455d08375ca9cc5201236db6d7d;PhotonEvaporation|G4LEVELGAMMADATA|/data/zsoldos/cvmfs/Geant4//data/PhotonEvaporation3.1|G4PhotonEvaporation.3.1.tar.gz|e7870c5ef18ba702e68c22b62233cbb8;RadioactiveDecay|G4RADIOACTIVEDATA|/data/zsoldos/cvmfs/Geant4//data/RadioactiveDecay4.2|G4RadioactiveDecay.4.2.tar.gz|2eade8116387ef67d4cd6f14b9cb1512;G4NEUTRONXS|G4NEUTRONXSDATA|/data/zsoldos/cvmfs/Geant4//data/G4NEUTRONXS1.4|G4NEUTRONXS.1.4.tar.gz|665a12771267e3b31a08c622ba1238a7;G4PII|G4PIIDATA|/data/zsoldos/cvmfs/Geant4//data/G4PII1.3|G4PII.1.3.tar.gz|05f2471dbcdf1a2b17cbff84e8e83b37;RealSurface|G4REALSURFACEDATA|/data/zsoldos/cvmfs/Geant4//data/RealSurface1.0|RealSurface.1.0.tar.gz|0dde95e00fcd3bcd745804f870bb6884;G4SAIDDATA|G4SAIDXSDATA|/data/zsoldos/cvmfs/Geant4//data/G4SAIDDATA1.1|G4SAIDDATA.1.1.tar.gz|d88a31218fdf28455e5c5a3609f7216f;G4ABLA|G4ABLADATA|/data/zsoldos/cvmfs/Geant4//data/G4ABLA3.0|G4ABLA.3.0.tar.gz|d7049166ef74a592cb97df0ed4b757bd", array, ";"); for (i=1;i<=n;i++) { print array[i]; } }') #----------------------------------------------------------------------- # function print_datasets # print dataset information with one line per dataset and each # line in the format # print_datasets() { for ds in ${dataset_list} ; do dataset_name=$(echo $ds | cut -d "|" -f1) dataset_envvar=$(echo $ds | cut -d "|" -f2) dataset_path=$(echo $ds | cut -d "|" -f3) echo ${dataset_name} ${dataset_envvar} ${dataset_path} done exit 0 } #----------------------------------------------------------------------- # function check_datasets # Check whether datasets exist as directories at the expected # location. Print dataset name, path and install status # check_datasets() { for ds in ${dataset_list} ; do dataset_name=$(echo $ds | cut -d "|" -f1) dataset_path=$(echo $ds | cut -d "|" -f3) dataset_status="NOTFOUND" if test -d ${dataset_path} ; then dataset_status="INSTALLED" fi echo ${dataset_name} ${dataset_status} ${dataset_path} done } #----------------------------------------------------------------------- # function install_datasets # Download and install datasets if they are not already installed # install_datasets() { G4CURL=$(which curl) if test "x${G4CURL}" = "x" ; then echo "- error: no curl executable found" exit 1 fi if test ! -x "${G4CURL}" ; then echo "- error: curl '${G4CURL}' is not executable" exit 1 fi G4OPENSSL=$(which openssl) if test "x${G4OPENSSL}" = "x" ; then echo "- error: no openssl executable found" exit 1 fi if test ! -x "${G4OPENSSL}" ; then echo "- error: openssl '${G4OPENSSL}' is not executable" exit 1 fi G4TAR=$(which tar) if test "x${G4TAR}" = "x" ; then echo "- error: no tar executable found" exit 1 fi if test ! -x "${G4TAR}" ; then echo "- error: tar '${G4TAR}' is not executable" exit 1 fi datasets_to_install='' for ds in ${dataset_list} ; do dataset_path=$(echo $ds | cut -d "|" -f3) if test ! -d ${dataset_path} ; then datasets_to_install="${datasets_to_install} ${ds}" fi done dataset_install="ok" if test "x${datasets_to_install}" != "x" ; then # - Create download cache g4downloaddir=$(mktemp -d -t g4dlcXXXXXXXXXX) if test -d ${g4downloaddir} ; then echo "+ created download cache" else echo "- error : failed to create '${g4downloaddir}'" dataset_install="fail" break fi # - Download/install loop for ds in ${datasets_to_install} ; do # Create base path (repetitive) dataset_path=$(echo $ds | cut -d "|" -f3) mkdir -p $(dirname ${dataset_path}) if [ "$?" != "0" ] || [ ! -w $(dirname ${dataset_path}) ] ; then echo "- error : failed to create base directory '$(dirname ${dataset_path})'" dataset_install="fail" break fi # - Download bundle to cache dataset_file=$(echo $ds | cut -d "|" -f4) echo "+ downloading ${dataset_file}" ${G4CURL} -f -m ${dataset_timeout} -o ${g4downloaddir}/${dataset_file} ${dataset_url}/${dataset_file} curl_status="$?" if [ "$curl_status" != "0" ] ; then echo "- download of '${dataset_file}' failed : CURL error $?" dataset_install="fail" break fi # Validate bundle hash (basic) dataset_md5=$(echo $ds | cut -d "|" -f5) actual_md5=$(${G4OPENSSL} dgst -md5 ${g4downloaddir}/${dataset_file} | cut -d" " -f2) echo "+ checking md5 of ${dataset_file}" if [ "${actual_md5}" != "${dataset_md5}" ] ; then echo "- md5 mismatch for '${dataset_file}' : ${actual_md5}(actual) != ${dataset_md5}(expected)" dataset_install="fail" break fi # Unpack bundle echo "+ untar ${dataset_file}" ${G4TAR} -C ${g4downloaddir} -xf ${g4downloaddir}/${dataset_file} tar_status="$?" if [ "$tar_status" != "0" ] ; then echo "- untar of '${dataset_file}' failed : tar error $?" dataset_install="fail" break fi # Install bundle echo "+ installing $(basename ${dataset_path})" cp -R ${g4downloaddir}/$(basename ${dataset_path}) $(dirname ${dataset_path}) cp_status="$?" if [ "$cp_status" != "0" ] ; then echo "- copy of '$(basename ${dataset_path})' failed : cp error $?" # Extra task - remove anything copied... rm -Rf ${dataset_path} dataset_install="fail" break fi done # - Clean up download cache rm -Rf ${g4downloaddir} if test -d ${g4downloaddir} ; then echo "- failed to remove '${g4downloaddir}'" else echo "+ cleaned download cache" fi fi if [ "${dataset_install}" = "ok" ] ; then echo "+ all datasets installed" exit 0 else echo "- dataset installation failed" exit 1 fi exit 1 } #----------------------------------------------------------------------- # function help # print help on available command line arguments and enabled # and disabled features of the toolkit # help() { cat<